Skip to content

Allow intrinsic roots in partial no-JIT compilations - #134030

Merged
jkotas merged 2 commits into
mainfrom
lewing-fix-partial-intrinsic-roots
Sep 16, 2026
Merged

jkotas merged 2 commits into
mainfrom
lewing-fix-partial-intrinsic-roots

Conversation

@lewing

@lewing lewing commented Sep 16, 2026 •

Copy link
Copy Markdown
Member

Summary

  • allow hardware-intrinsic methods to bypass the partial profile restriction when the target cannot generate code at runtime
  • preserve profile filtering for non-intrinsic methods and for all methods on JIT-capable targets

This is related to #132825, where the affected compilation mode was observed, but it does not fully resolve that issue.

Validation

  • Required baseline: ./build.sh clr+libs+host
  • Browser-Wasm Debug: PATH=/opt/homebrew/bin:$PATH ./build.sh clr+libs -os browser -arch wasm -c Debug -cmakeargs "-DCMAKE_CXX_FLAGS=-Wno-unguarded-availability-new"
  • Browser-Wasm Release: PATH=/opt/homebrew/bin:$PATH ./build.sh clr+libs -os browser -arch wasm -c Release -cmakeargs "-DCMAKE_CXX_FLAGS=-Wno-unguarded-availability-new"
  • ILCompiler.ReadyToRun.Tests Debug and Release builds for browser-wasm

Exact repro command:

crossgen2 System.Private.CoreLib.dll \
  -r '<browser-wasm runtime pack>/*.dll' \
  --targetarch:wasm \
  --targetos:browser \
  --partial \
  --out:System.Private.CoreLib.wasm

R2RDump --entrypoints method counts:

Build PackedSimd WasmBase
Before 0 0
After 473 5

Note

This pull request description was generated with GitHub Copilot.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings September 16, 2026 04:56
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
13 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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

No unresolved issues were identified that would block approval.

Review tier: Lite
Findings: None

What changed in this PR

Updates partial ReadyToRun compilation so hardware-intrinsic methods remain available on targets without runtime code generation, while preserving profile filtering elsewhere.

Changes:

  • Bypasses profile exclusion for hardware intrinsics on no-JIT targets.
  • Adds Wasm regression coverage for PackedSimd, WasmBase, and non-intrinsic methods.
  • Allows tests to simulate both JIT-capable and non-JIT targets.
File Description
src/​coreclr/​tools/​aot/​ILCompiler.ReadyToRun/​Compiler/​ReadyToRunSingleAssemblyCompilationModuleGroup.cs Updated as part of this pull request.
src/​coreclr/​tools/​aot/​ILCompiler.ReadyToRun.Tests/​WasmArgumentLayoutTests.cs Updated as part of this pull request.

@lewing
lewing requested a review from jkotas September 16, 2026 05:08
@jkotas
jkotas self-requested a review September 16, 2026 05:14
Comment thread src/coreclr/tools/aot/ILCompiler.ReadyToRun.Tests/WasmArgumentLayoutTests.cs Outdated
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings September 16, 2026 15:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Add regression coverage for partial no-JIT compilations with profiles, including non-intrinsic filtering.

Get a fresh assessment by requesting another Copilot review.

Review tier: Lite
Findings: 1 Medium severity

Open (1)

@jkotas
jkotas merged commit fdae13f into main Sep 16, 2026
109 of 112 checks passed
@jkotas
jkotas deleted the lewing-fix-partial-intrinsic-roots branch September 16, 2026 21:31
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Sep 17, 2026
jtschuster pushed a commit to jtschuster/runtime that referenced this pull request Sep 18, 2026
## Summary

- allow hardware-intrinsic methods to bypass the partial profile
restriction when the target cannot generate code at runtime
- preserve profile filtering for non-intrinsic methods and for all
methods on JIT-capable targets

This is related to dotnet#132825, where the affected compilation mode was
observed, but it does not fully resolve that issue.

> [!NOTE]
> This pull request description was generated with GitHub Copilot.

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
lewing added a commit that referenced this pull request Sep 24, 2026
## Summary

- add `dotnet-pgo create-mibc-from-method-list` for constructing
deterministic profile root sets from JSON
- resolve assembly-qualified declaring, parameter, and generic argument
types through an Ecma-backed type-system context
- reject invalid JSON, missing references, unresolved or ambiguous
methods, wrong generic arity, duplicate entries, open generic types, and
non-`.mibc` output
- document the JSON format and add focused end-to-end tests, including
MIBC dump round-tripping and input-order determinism

This is an exploratory, general-purpose profile-rooting tool motivated
by the scenarios discussed in #132825. It does not claim to resolve that
issue.

The tool supports controlled differential ReadyToRun investigations
without collecting a trace or hand-authoring MIBC IL. It has already
been used to:

- root `MemoryExtensions.Contains<int>` through
`PublishReadyToRunPgoFiles`, proving the profile was accepted and the
compiled body was emitted while live execution still entered
`WasmR2RToInterpreterThunk`; this isolated the problem to closed-generic
dispatch/adapter behavior rather than missing rooting
- root `Delegate.CtorOpen` and `Delegate.CtorClosed`, proving that
adding the compiled bodies did not change delegate construction dispatch
or timing and ruling out missing bodies as the cause of #134564

This tool is not needed as a workaround for automatic hardware-intrinsic
rooting in partial no-JIT compilations; #134030 fixed that behavior.

## Validation

- `./dotnet.sh test
src/coreclr/tools/dotnet-pgo/tests/dotnet-pgo.Tests.csproj -c Debug` — 7
passed
- `./dotnet.sh test
src/coreclr/tools/dotnet-pgo/tests/dotnet-pgo.Tests.csproj -c Release` —
7 passed
- repeated default compressed generation after a delay produced
identical SHA-256 hashes
- an assembly-qualified array signature continued to resolve
successfully
- a constructed generic type with an unqualified generic argument was
rejected

> [!NOTE]
> This pull request description was generated with GitHub Copilot.

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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.

4 participants