Skip to content

Conversation

@viewizard
Copy link
Member

Could be used for compile on x64 host for arm64 target (for example, during Tizen OS image creation).

CC @gbalykov

Could be used for compile on x64 host for arm64 target (for example, during Tizen OS image creation).
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Oct 29, 2025
new("--reference", "-r") { CustomParser = result => Helpers.BuildPathDictionary(result.Tokens, false), DefaultValueFactory = result => Helpers.BuildPathDictionary(result.Tokens, false), Description = SR.ReferenceFiles };
public Option<string> InstructionSet { get; } =
new("--instruction-set") { Description = SR.InstructionSets };
public Option<bool> NoOptimisticInstructionSet { get; } =
Copy link
Member

@tannergooding tannergooding Oct 29, 2025

Choose a reason for hiding this comment

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

The same switch should probably exist for NAOT as well, to make it simpler to manage (we've had requests before and it can make it simpler to target an exact machine).

A "better" option might even be to just make it part of --instruction-set so that by default you get --instruction-set sse4.2,optimistic for example, and you can opt-out like you would for other instructions sets by specifying -optimistic. Then it's a bit more "intuitive" and fits in with the other existing msbuild properties and general support that exists

Copy link
Member

Choose a reason for hiding this comment

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

you can opt-out like you would for other instructions sets by specifying -optimistic

Do you mean --instruction-set -optimistic?

Copy link
Member

@tannergooding tannergooding Oct 29, 2025

Choose a reason for hiding this comment

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

Yes, or <IlcInstructionSet>-optimistic</IlcInstructionSet> and so on. That way it integrates with the existing pattern for how ISAs can be enabled or disabled.

It might warrant further weigh-in from @MichalStrehovsky and @EgorBo

Copy link
Member

Choose a reason for hiding this comment

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

Yes, or <IlcInstructionSet>-optimistic</IlcInstructionSet> and so on. That way it integrates with the existing pattern for how ISAs can be enabled or disabled.

It might warrant further weigh-in from @MichalStrehovsky and @EgorBo

This sounds like a good plan to me!

@tannergooding
Copy link
Member

Could be used for compile on x64 host for arm64 target

What's the issue here? Shouldn't we default to just the baseline and any ISAs that fit into the same encoding schema?

That is, cross compiling should mirror the default ISAs you'd get if you ran crossgen natively.

@gbalykov
Copy link
Member

What's the issue here?

We want to compile exactly for instruction set specified and not include optimistic one. For example, current optimistic one includes sets not available on rpi4 and we get a lot of rejected R2R methods during execution.

@viewizard
Copy link
Member Author

The same switch should probably exist for NAOT as well, to make it simpler to manage.

Could you please point me on NAOT related sources? I don't find any sources except src/coreclr/tools/aot/ILCompiler/ILCompilerRootCommand.cs and src/coreclr/tools/aot/crossgen2/Crossgen2RootCommand.cs that have --instruction-set option related code.

@tannergooding
Copy link
Member

tannergooding commented Oct 29, 2025

We want to compile exactly for instruction set specified and not include optimistic one. For example, current optimistic one includes sets not available on rpi4 and we get a lot of rejected R2R methods during execution.

Gotcha. So specifically the problem is that R2R defaults to including LSE (atomics) support which is in a majority of Arm64 hardware, but which is still missing on many Raspberry PIs.

Could you please point me on NAOT related sources? I don't find any sources except src/coreclr/tools/aot/ILCompiler/ILCompilerRootCommand.cs and src/coreclr/tools/aot/crossgen2/Crossgen2RootCommand.cs that have --instruction-set option related code.

Yes, that would be the place where the NAOT command line options are if you were to keep this as --no-optimistic-instruction-set.

If you were instead to do the -optimistic approach, that is in ConfigureInstructionSetSupport here: https://github.com/tannergooding/runtime/blob/main/src/coreclr/tools/Common/InstructionSetHelpers.cs

Specficially, it checks for just "native" and otherwise splits based on , (comma), removing those that are prefixed with - (minus) and adding those prefixed with nothing or + (plus)

You'd end up specially handling optimistic, likely in the loop, so that allowOptimistic is set to false. This would in turn avoid the optimistic sets from being added

@viewizard
Copy link
Member Author

@tannergooding as you proposed, I create another approach for disable optimistic instruction set to be added - #121203 could you please take a look?

I close this PR, looks like new one looks really better and more clear.

@viewizard viewizard closed this Oct 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-crossgen2-coreclr community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants