dotnet / dotnet/runtime

[browser][coreCLR] R2R: Consume the WASM PGO profile in the CoreLib R2R build

Open
#132,717 1 comment 0 reactions 1 assignee Claimed by @pavelsavara View on GitHub
arch-wasm area-ReadyToRun os-browser
Dominant language
C#
Stars
18.3k
Forks
5.6k
PR merge metrics
PR metrics pending

Description

Part of #130524. Related: #130517, #130521. Depends on the profile-production issue (the `optimization.browser-wasm.MIBC.Runtime` package).

## Goal

Wire the browser-wasm interpreter PGO profile into the **WASM CoreLib R2R optimization-data merge**, so precompilation uses the interpreter-collected startup hotness.

## Why

Once the profile package exists (separate production issue) and WASM CoreLib R2R is enabled (already in progress on a separate branch), the profile still has to be restored and merged into the optimization data the R2R build consumes. Today browser/wasm has no dedicated profile — it falls back to desktop (linux-x64) profiles.

## Scope (runtime-side wiring only)

**In:**
- Add the `optimization.browser-wasm.MIBC.Runtime` dependency (`eng/Version.Details.xml`) + version property (`eng/Versions.props`).
- Add a `MibcArchitecture="browser/wasm"` entry (+ `PackageDownload`) in `eng/restore/optimizationData.targets`, so the package restores into `artifacts/mibc/browser/wasm/data/` and is merged into `StandardOptimizationData.mibc` by `src/coreclr/crossgen-corelib.proj`'s existing merge target.
- Guard with `Condition="Exists(...)"` so it's a no-op until the package is available.

**Out:**
- Producing the package (separate production issue).
- **Enabling R2R for the WASM CoreLib** — already in progress on a separate branch. This issue only ensures the WASM profile **flows into** that merge.

## Notes

- MIBC is architecture-independent; this replaces the desktop-profile fallback for browser/wasm with WASM interpreter-startup-specific data.
- Do not commit ad-hoc/sample-derived `.mibc` as optimization data — the profile comes from the package.

## Success criteria

- With the package present, the WASM CoreLib R2R build consumes the merged `StandardOptimizationData.mibc` including the browser-wasm data, with no changes to the precompilation toolchain.

## Open questions

- Confirm crossgen2 accepts interpreter-produced, IL-offset-keyed counts unchanged and selects the expected hot methods (relates to the open question in #130517).

> [!NOTE]
> This issue was drafted with GitHub Copilot assistance.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.