Skip to content

Wasm spmi collection2#128819

Open
AndyAyersMS wants to merge 7 commits into
dotnet:mainfrom
AndyAyersMS:WasmSPMICollection2
Open

Wasm spmi collection2#128819
AndyAyersMS wants to merge 7 commits into
dotnet:mainfrom
AndyAyersMS:WasmSPMICollection2

Conversation

@AndyAyersMS
Copy link
Copy Markdown
Member

Actually enable the collection.

AndyAyersMS and others added 7 commits May 15, 2026 09:17
Adds wasm (browser/wasm) coverage to the SuperPMI (SPMI) collection, replay,
and asmdiffs CI pipelines. The new collection records crossgen2 compilation
of a release build of System.Private.CoreLib.dll targeting browser/wasm,
exercising the cross-targeting JIT (clrjit_universal_wasm_x64.dll) under the
superpmi-shim-collector. A new daily replay pipeline replays the wasm MCH
on a windows_x64 host. The existing asmdiffs and asmdiffs-checked-release
pipelines, and the rolling-build baseline, are extended to also produce
diffs for the wasm jit.

Collection (crossgen2/corelib/browser/wasm):
- superpmi.py: when target_os/target_arch differ from host, write
  --targetarch/--targetos to the crossgen2 rsp; for wasm also write
  --obj-format:wasm and --codegenopt:JitWasmNyiToR2RUnsupported=1 to mirror
  src/coreclr/crossgen-corelib.proj.
- superpmi_collect_setup.py: accept -target_os/-target_arch (default to host);
  new "corelib" collection_name uses the release Core_Root and builds a
  single-file input directory containing only System.Private.CoreLib.dll;
  set TargetOS/TargetArchitecture pipeline variables.
- superpmi-collect.proj: append target args to the crossgen2 work-item
  command; fall back HelixRuntimeRid to host-OS rid when target OS doesn't
  have a .NET runtime (browser).
- run-superpmi-collect-job.yml, superpmi-collect-job.yml,
  superpmi-send-to-helix.yml: thread targetOS/targetArch through and let them
  override the TargetOS/TargetArchitecture env vars passed to MSBuild.
- superpmi-collect-pipeline.yml: include clr.wasmjit in the release
  windows_x64/linux_x64 build args; add a corelib/browser/wasm
  platform-matrix entry.

Replay:
- superpmi_replay.py / superpmi_replay_setup.py: accept type "wasm";
  re-derive host OS/arch from the running machine since -arch/-platform
  describe the target; use determine_jit_name with use_cross_compile_jit=True
  to get clrjit_universal_wasm_x64.dll; pass --altjit.
- superpmi-replay.proj: add a single browser-wasm partition for x64 hosts.
- jit-replay-pipeline.yml: include clr.wasmjit in buildArgs when
  replayType == "wasm".
- New superpmi-replay-wasm.yml: daily-scheduled wasm replay pipeline
  extending jit-replay-pipeline.yml.

Asmdiffs / tpdiff / metricdiff:
- superpmi_diffs_setup.py: extend target matrix with ("browser", "wasm",
  "x64") for 64-bit hosts; record real target_arch in partition JSON while
  walking the blob_arch (x64) directory where wasm MCHs are uploaded.
- superpmi_diffs.py: append --altjit in create_jit_options_args when
  arch_name == "wasm" (covers asmdiffs, tpdiff, metricdiff).
- superpmi-diffs.yml and superpmi-asmdiffs-checked-release.yml: include
  clr.wasmjit in checked/release build args.
- superpmi-asmdiffs-checked-release.proj: add a browser-wasm partition for
  x64 hosts.
- superpmi_asmdiffs_checked_release.py: handle wasm target by deriving
  host arch/OS, using determine_jit_name to locate the jit, and passing
  --altjit.
- jitrollingbuild.yml: include clr.wasmjit so the baseline wasm jit is
  uploaded for PR asmdiffs to download.

Storage path note: superpmi.py overrides mch_arch from "wasm" to the host
arch (x64) at line 5078, so wasm MCHs upload to and download from
<jit_ee_version>/browser/x64/.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Disable all SPMI collection matrix entries except the new corelib_wasm

collection so CI exercises only the wasm collection path in isolation.

All unwanted platform-matrix blocks have their platforms list set to

an empty list, which short-circuits platform-matrix.yml to emit zero jobs

for each disabled block. The release windows_x64 build is preserved

(narrowed from windows_x64+linux_x64) because the corelib_wasm collection

depends on its BuildArtifacts_windows_x64_Release output.

Revert this commit (or restore the matrices) before merging.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
merge-mch defaults build_type to Checked, which causes find_tool to

search artifacts/bin/coreclr/<host>.<arch>.Checked for mcs.exe. For

release-configured collections (e.g. corelib/crossgen2-wasm), that path

doesn't exist, so mcs.exe can't be found and the merge step fails.

Forward buildConfig to merge-mch as -build_type so the auto-deduced

product_location matches the actually downloaded build artifact. No-op

for existing collections which already use checked.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The corelib_wasm SPMI collection needs a System.Private.CoreLib.dll that was built targeting browser/wasm so the crossgen2 layout matches the wasm runtime. Previously the collection only had access to the host-arch CoreLib.

Add a dedicated browser_wasm_win Release build to superpmi-collect-pipeline.yml that builds the clr.corelib subset only (no native code, no emsdk provisioning required). The build uploads its artifacts/bin tree as BuildArtifacts_browser_wasm_Release.

Wire the corelib + wasm collection in superpmi-collect-job.yml to depend on that build and download the artifact into artifacts/bin alongside the host-arch payloads.

Update the corelib branch in superpmi_collect_setup.py to source System.Private.CoreLib.dll from artifacts/bin/coreclr/browser.wasm.Release when target_arch == 'wasm', falling back to the host release Core_Root otherwise.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This reverts commit 8986d7a.

The wasm corelib collection is now additive: it runs alongside all the existing SPMI collections (libraries_tests, benchmarks, libraries crossgen2, etc.) rather than replacing them.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The wasm corelib build (build.cmd -arch wasm -os browser -s clr.corelib -c
Release) emits System.Private.CoreLib.dll into the 'IL' subdirectory of the
configuration output, i.e.

  artifacts\bin\coreclr\browser.wasm.Release\IL\System.Private.CoreLib.dll

not at the root of browser.wasm.Release like native builds do. The previous
path produced 'Cannot find System.Private.CoreLib.dll at
.../browser.wasm.Release/System.Private.CoreLib.dll' in superpmi_collect_setup.py
during corelib_wasm collection setup.

Verified locally and against the failing CI build log.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Resolves conflicts arising from upstream merge of PR dotnet#128669 (squash commit 0f9f5ec), which is the upstream version of our initial wasm SPMI work.

Preserved our follow-up commits: mcs.exe merge fix, browser_wasm_win build wiring, and the artifacts/bin/coreclr/browser.wasm.Release/IL/ corelib source path.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 31, 2026 14:44
@github-actions github-actions Bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label May 31, 2026
@AndyAyersMS
Copy link
Copy Markdown
Member Author

@dotnet/jit-contrib PTAL

This got dropped from the original PR.

@dotnet-policy-service
Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the SuperPMI collection infrastructure to support a wasm-targeted corelib (crossgen2) collection by ensuring the right host JIT bits are built and by pointing the corelib input directory at the wasm build output layout.

Changes:

  • Adjusts the corelib wasm input directory to use the browser.wasm.Release/IL subdirectory (where the managed CoreLib is emitted).
  • Updates the SuperPMI collect pipeline to build clr.wasmjit on x64 hosts and adds a browser_wasm_win CoreLib build producing the wasm-targeted System.Private.CoreLib.dll.
  • Adds a new corelib crossgen2 collection job targeting browser/wasm.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/coreclr/scripts/superpmi_collect_setup.py Updates guidance comment for corelib wasm input directory layout (.../IL).
eng/pipelines/coreclr/templates/superpmi-collect-pipeline.yml Builds clr.wasmjit, adds a browser/wasm CoreLib build job, and adds a new wasm corelib collection job.
eng/pipelines/coreclr/templates/run-superpmi-collect-job.yml Points corelib wasm InputDirectory to browser.wasm.Release/IL (Windows + non-Windows paths).

Comment on lines +172 to +175
# Release build of System.Private.CoreLib.dll targeting browser/wasm, hosted on
# Windows x64. Produces artifacts/bin/coreclr/browser.wasm.Release/System.Private.CoreLib.dll,
# which is the assembly the corelib_wasm SPMI collection runs crossgen2 over.
# We only need the managed CoreLib here, so build the minimal clr.corelib subset.
Comment on lines +338 to +353
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
jobTemplate: /eng/pipelines/coreclr/templates/superpmi-collect-job.yml
buildConfig: release
platforms:
- windows_x64
helixQueueGroup: ci
helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml
jobParameters:
testGroup: outerloop
liveLibrariesBuildConfig: Release
collectionType: crossgen2
collectionName: corelib
targetOS: browser
targetArch: wasm

Copy link
Copy Markdown
Member

@kg kg left a comment

Choose a reason for hiding this comment

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

LGTM other than copilot's feedback

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