Skip to content
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

Allow AltJit for matched VM to also use otherwise unsupported ISAs #110320

Merged
merged 1 commit into from
Dec 4, 2024

Conversation

tannergooding
Copy link
Member

This allows easier local validation of new ISAs including for the platform you're running on. Previously additional hoops had to be jumped through in order to validate codegen for an unsupported ISA on the same platform you're running against.

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Dec 2, 2024
Copy link
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

@tannergooding
Copy link
Member Author

CC. @dotnet/jit-contrib for review

As per the top post, this is a relatively simple change that allows any AltJit to be used to validate ISAs that aren't supported by the underlying CPU. Previously it was only allowed under a "mismatched VM", which meant that if you were on an x64 Windows machine, you couldn't use the x64 Windows AltJit and validate codegen for something like AVX10.1.

This simply improves the overall UX and makes it easier to validate new ISAs being brought online; including being able to validate SVE codegen from an Arm64 machine and APX codegen from an x64 machine.

@tannergooding tannergooding merged commit 8672edd into dotnet:main Dec 4, 2024
105 of 108 checks passed
@tannergooding tannergooding deleted the intrin-altjit branch December 4, 2024 18:38
@BruceForstall
Copy link
Member

With this change, if you use an altjit will you automatically get support for ISAs that aren't supported by the target platform, or do you need to opt in to them?

I know some people have used same-architecture altjit as part of their inner-loop development/debugging flow, with the resulting code actually running, so could this break that flow?

@tannergooding
Copy link
Member Author

With this change, if you use an altjit will you automatically get support for ISAs that aren't supported by the target platform, or do you need to opt in to them?

Yes, but that was already the case for mismatched VM (i.e. targeting x64 Unix from x64 Windows, any Arm64 from x64, or vice versa). This only normalizes the behavior so that it also happens for matched VM.

We currently have a per-ISA opt-out, but not a general switch that forces the config to match the host VM. It wouldn't be difficult to add such a config knob and have whichever is the "better" default. Mismatches (such as x64 on Arm64, or vice versa) would still need their own default, which is currently "everything".

@BruceForstall
Copy link
Member

but that was already the case for mismatched VM

It was always safe for mismatched VM because the generated code was never run. With a matched VM, the code is run, so it's not safe to generate code for an unsupported ISA.

If we keep this change as the default, you might want to change the config RunAltJitCode from 1 to 0, so we don't run altjit code. (and make this config available in Release).

@tannergooding
Copy link
Member Author

If we keep this change as the default, you might want to change the config RunAltJitCode from 1 to 0, so we don't run altjit code. (and make this config available in Release).

I'll get a new PR up that conditions the opportunistic ISA light up based on RunAltJitCode being false.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants