Skip to content

Add PerfMap OS/arch constants for wasm and wasi targets - #132693

Draft
pavelsavara wants to merge 1 commit into
dotnet:mainfrom
pavelsavara:PerfMap_wasm
Draft

Add PerfMap OS/arch constants for wasm and wasi targets#132693
pavelsavara wants to merge 1 commit into
dotnet:mainfrom
pavelsavara:PerfMap_wasm

Conversation

@pavelsavara

Copy link
Copy Markdown
Member

Summary

Crossgen2 ReadyToRun compilation for browser-wasm and wasi-wasm targets threw System.NotImplementedException from PerfMapWriter.TranslateTargetDetailsToPerfmapConstants when PublishReadyToRunPerfmapFormatVersion was set. PerfMapOSToken had no Browser/Wasi members and PerfMapArchitectureToken had no Wasm member, so the switch expressions fell through to their throwing default arms.

Observed stack:

System.NotImplementedException: Browser
   at ILCompiler.Diagnostics.PerfMapWriter.TranslateTargetDetailsToPerfmapConstants(TargetDetails details) in PerfMapWriter.cs:line 121
   at ILCompiler.Diagnostics.PerfMapWriter.PerfMapV1SignatureHelper(...)
   at ILCompiler.DependencyAnalysis.ReadyToRun.PerfMapDebugDirectoryEntryNode.GetData(...)
   at ILCompiler.ReadyToRunCodegenCompilation.Compile(String outputFile)

Changes

  • Add Browser = 8 and Wasi = 9 to PerfMapOSToken, and Wasm = 7 to PerfMapArchitectureToken (appended after the highest existing value to preserve the numeric contract consumed by symbol-upload / PerfView tooling).
  • Map TargetOS.Browser/TargetOS.Wasi and TargetArchitecture.Wasm32 in the PerfMapWriter switches.
  • Update docs/design/coreclr/botr/r2r-perfmap-format.md to match, also filling in the already-shipped OpenBSD/RiscV64/LoongArch64 rows that were missing from the doc.

Validation

  • Built ILCompiler.Diagnostics (Release) — clean.
  • Full Release build with PublishReadyToRunPerfmapFormatVersion = 1 — the CreateReadyToRunImages target now runs with 0 errors where it previously threw.

Note

This PR description and the code changes were generated with the assistance of GitHub Copilot.

Crossgen2 R2R compilation for browser-wasm and wasi-wasm targets threw
System.NotImplementedException from PerfMapWriter.TranslateTargetDetailsToPerfmapConstants
because PerfMapOSToken had no Browser/Wasi members and PerfMapArchitectureToken
had no Wasm member, so the switch expressions hit their throwing default arms
when PublishReadyToRunPerfmapFormatVersion was set.

Add Browser/Wasi to PerfMapOSToken, Wasm to PerfMapArchitectureToken, map the
corresponding TargetOS/TargetArchitecture values, and update the r2r-perfmap-format
doc to match (also filling in the already-shipped OpenBSD/RiscV64/LoongArch64 rows).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings August 24, 2026 11:14
@pavelsavara pavelsavara self-assigned this Aug 24, 2026
@pavelsavara pavelsavara added the arch-wasm WebAssembly architecture label Aug 24, 2026
@pavelsavara pavelsavara added this to the 12.0.0 milestone Aug 24, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 4 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.

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.

Pull request overview

Adds missing PerfMap v1 target OS/architecture tokens and wiring so Crossgen2 ReadyToRun perfmap emission can support WebAssembly targets (Browser/WASI) without falling into the “unknown target” throwing paths. Also updates the design doc to reflect the expanded token sets.

Changes:

  • Extend PerfMapOSToken with Browser/Wasi and PerfMapArchitectureToken with Wasm.
  • Map TargetOS.Browser/TargetOS.Wasi and TargetArchitecture.Wasm32 to the new tokens in PerfMapWriter.
  • Update r2r-perfmap-format.md to include the current token tables.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/coreclr/tools/aot/ILCompiler.Diagnostics/ReadyToRunDiagnosticsConstants.cs Adds new perfmap OS/arch enum values used as the on-disk perfmap contract.
src/coreclr/tools/aot/ILCompiler.Diagnostics/PerfMapWriter.cs Extends target-to-token translation to cover Browser/WASI and Wasm32.
docs/design/coreclr/botr/r2r-perfmap-format.md Documents the updated token values for perfmap v1 headers.

@pavelsavara
pavelsavara marked this pull request as draft August 24, 2026 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arch-wasm WebAssembly architecture area-ReadyToRun

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants