Skip to content

Prefer the portable ILCompiler when publishing for the portable RID on a source-built SDK. #41754

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 1, 2024

Conversation

tmds
Copy link
Member

@tmds tmds commented Jun 24, 2024

@ghost ghost added Area-Infrastructure untriaged Request triage from a team member labels Jun 24, 2024
Copy link
Member

@ViktorHofer ViktorHofer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but I defer to @dsplaisted who is the ProcessFrameworkReferences expert.

Copy link
Member

@baronfel baronfel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is reasonable to me as well. @tmds where would be the best place to test this? dotnet/source-build?

@tmds
Copy link
Member Author

tmds commented Jun 24, 2024

where would be the best place to test this? dotnet/source-build?

I recently learned about https://github.com/dotnet/scenario-tests.
The caveat with the test is that it probably expects there to be a portable ILCompiler package, but the non-portable build is not responsible for building it. I don't know if and how scenario-tests handles such cases.

We have our own test but only run it (late) on releases (including preview releases) since we know Microsoft will have published the portable ILCompiler package to nuget.org for those.

@tmds
Copy link
Member Author

tmds commented Jun 24, 2024

@baronfel is there still time to get this into preview6?

@baronfel
Copy link
Member

It's looking like a 'no' unless we can get Daniel to take a look at this today, after talking to the build team.

@dsplaisted
Copy link
Member

It seems to me like this type of logic should be in .targets files, and it should set an MSBuild property for the RuntimeIdentifier to use. Maybe NETCoreSdkRuntimeIdentifier should generally be the same as NETCoreSdkPortableRuntimeIdentifier.

However, if there's still time to get it in preview 6, I'm OK with this change for now.

@tmds
Copy link
Member Author

tmds commented Jun 25, 2024

Maybe NETCoreSdkRuntimeIdentifier should generally be the same as NETCoreSdkPortableRuntimeIdentifier.

I considered this. If we do this, as you say, it makes sense to apply it everywhere, and based on that I had opted to write this PR with a "localized" change instead.

I will look into this.

However, if there's still time to get it in preview 6, I'm OK with this change for now.

I think we missed the deadline. I had preferred for this to be in preview 6, but I don't consider it a blocker.

@tmds
Copy link
Member Author

tmds commented Jun 25, 2024

@dsplaisted if we set NETCoreSdkRuntimeIdentifier=linux-x64 and RuntimeIdentifier=linux-x64 then ProcessFrameworkReferences isn't ever going to resolve a non-portable RID assets. So I don't think we can change to pass NETCoreSdkPortableRuntimeIdentifier instead of NETCoreSdkRuntimeIdentifier to ProcessFrameworkReferences?

@dsplaisted
Copy link
Member

dsplaisted commented Jun 25, 2024

@dsplaisted if we set NETCoreSdkRuntimeIdentifier=linux-x64 and RuntimeIdentifier=linux-x64 then ProcessFrameworkReferences isn't ever going to resolve a non-portable RID assets. So I don't think we can change to pass NETCoreSdkPortableRuntimeIdentifier instead of NETCoreSdkRuntimeIdentifier to ProcessFrameworkReferences?

What if the RuntimeIdentifier is fedora.40-x64? It should resolve the runtime pack in that case, do the tool packs not use the RuntimeIdentifier the same way?

EDIT: Basically IIUC, the default RuntimeIdentifier should be linux-x64, but there should be the option to use fedora.40-x64. So if you explicitly set the RuntimeIdentifier to fedora.40-x64, would it work?

@tmds
Copy link
Member Author

tmds commented Jun 25, 2024

The issue we're trying to fix is that for linux-x64 we want the to prefer the linux-x64 ILCompiler for the host over the non-portable ILCompiler that matches the SDK rid (even though it's a better graph match).

@@ -778,9 +780,12 @@ enum ToolPackSupport
var packNamePattern = knownPack.GetMetadata(packName + "PackNamePattern");
var packSupportedRuntimeIdentifiers = knownPack.GetMetadata(packName + "RuntimeIdentifiers").Split(';');

// When publishing for the RuntimeIdentifier that matches NETCoreSdkPortableRuntimeIdentifier, prefer NETCoreSdkPortableRuntimeIdentifier for the host.
// This makes us use a portable ILCompiler when publishing for a portable RID on a non-portable SDK.
string hostRuntimeIdentifier = RuntimeIdentifier == NETCoreSdkPortableRuntimeIdentifier ? NETCoreSdkPortableRuntimeIdentifier : NETCoreSdkRuntimeIdentifier;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dsplaisted I re-wrote this in a way it could be moved into the .targets file.
NETCoreSdkRuntimeIdentifier would be passed what hostRuntimeIdentifier is set to.

Do you want me to move it to the .targets file, or keep it here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's fine here for now. It seems to me like we might eventually need to know which host Runtime Identifier we're using elsewhere. But until we run into a case like that I think it's good as is.

@ViktorHofer ViktorHofer merged commit e18cfb7 into dotnet:main Jul 1, 2024
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Infrastructure untriaged Request triage from a team member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Portable RID PublishAOT doesn't work from source-build VMR .NET 9 Preview 5
4 participants