Skip to content

Root vector acceleration queries in partial no-JIT ReadyToRun compilations - #138183

Merged
lewing merged 1 commit into
dotnet:mainfrom
lewing:lewing-browser-r2r-batch-7-failure
Nov 24, 2026
Merged

lewing merged 1 commit into
dotnet:mainfrom
lewing:lewing-browser-r2r-batch-7-failure

Conversation

@lewing

@lewing lewing commented Nov 24, 2026

Copy link
Copy Markdown
Member

Browser CoreCLR R2R publishes compile with --partial whenever PGO data is supplied. In partial no-JIT compilations, crossgen2 compiles platform intrinsic types like PackedSimd even when they aren't in the profile. The portable acceleration queries (Vector.IsHardwareAccelerated and Vector64/128/256/512.IsHardwareAccelerated) get no such exemption. They fall back to the interpreter, which reports false, so Vector128.IsHardwareAccelerated disagrees with PackedSimd.IsSupported. That mismatch is why PackedSimdTests.PackedSimdIsSupported fails in browser-wasm R2R Batch-7 on main.

Changes

  • ReadyToRunHardwareIntrinsicRootProvider now roots the get_IsHardwareAccelerated getters on Vector and Vector64/128/256/512 when trimmed CoreLib still has them. The provider is only used on targets without runtime codegen.
  • ReadyToRunSingleAssemblyCompilationModuleGroup exempts intrinsic get_IsHardwareAccelerated methods from partial-profile filtering on no-runtime-codegen targets. This is the same rule that already applies to platform hardware intrinsics.
  • I added a regression test in ReadyToRunLibraryRootProviderTests. It covers all five getters and checks that an ordinary unprofiled method is still excluded. It fails without the fix.

Interpreter behavior, the test assertion and the profiles themselves are unchanged.

Validation

  • ./build.sh -arch wasm -os browser -s clr+libs+host+packs -c Release: succeeded.
  • ILCompiler.ReadyToRun.Tests (browser/wasm Release): the new test failed before the fix (5/5 missing roots). After the fix the full suite had 396 passed, 43 skipped and 0 failed.
  • Full System.Runtime.Intrinsics.Tests on browser CoreCLR R2R with CI settings (TestWasmReadyToRun=true, EnableAggressiveTrimming=true, Chrome), using the default StandardOptimizationData.mibc + --partial: 13,346 passed, 1 skipped, 0 failed. Before the fix, 1 test failed.
  • I generated a minimal profile with dotnet-pgo create-mibc-from-method-list containing only System.Int32.GetHashCode, so neither the vector getters nor any test method were profiled. PackedSimdIsSupported passed with it.

Not run: the other Batch-7 suites and non-browser targets. The changed code paths only take effect without runtime codegen.

Resolves #138182

Note

This PR description was drafted with GitHub Copilot.

Compile portable IsHardwareAccelerated getters independently of the input profile so interpreted callers observe the target's ReadyToRun SIMD support.

Co-authored-by: Copilot App <[email protected]>
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
12 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/crossgen-contrib
See info in area-owners.md if you want to be subscribed.

@lewing

lewing commented Nov 24, 2026

Copy link
Copy Markdown
Member Author

If there is a preferable way to do this let me know

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

browser-wasm CoreCLR R2R: PackedSimdIsSupported fails because Vector128.IsHardwareAccelerated is interpreted under partial PGO

2 participants