Repository navigation
[wasm] Add V8 native code diffs alongside SuperPMI - #138595
pavelsavara wants to merge 3 commits into
Conversation
Compare the same ReadyToRun method through Crossgen2, V8 Liftoff, and V8 TurboFan, with reproducible publish snapshots and linked disassembly. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Stage matching ReadyToRun publishes and pinned V8 tools for an opt-in Windows x64 Helix work item. Report the comparison alongside existing SuperPMI diffs and normalize mapped V8 helper addresses without hiding changed call targets. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
Example: native code diffs from the fixed Browser ReadyToRun fixtureThis is from a local run with Windows x64 V8 debug
Selected lines from the generated Wasm patch (not the full hunk): - (i32.shl
+ (call_indirect (type $0)Selected lines from the generated TurboFan x64 patch (offset, instruction bytes, disassembly): - b7 8d0412 leal rax,[rdx+rdx*1]
+ 23e 43ff140a call [r10+r9*1]The local report links to full baseline/candidate disassemblies and patches for all three stages. These are emitted byte counts, not performance measurements. Note This comment was generated with GitHub Copilot from verified local output. |
|
Tagging subscribers to 'arch-wasm': @lewing, @pavelsavara |
| from superpmi_wasm_native_diffs import REPO, SCRIPTS, sha256, write_json | ||
|
|
||
|
|
||
| JIT = "clrjit_universal_wasm_x64.dll" |
There was a problem hiding this comment.
I will move the installation elsewhere
Acquire pinned V8 debug and shared Binaryen through the Wasm tool cache. Restore the cache in opt-in CI jobs while continuing to stage tools for offline Helix execution. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Summary
superpmi.py wasm-native-diffscommand that compares the same Browser ReadyToRun method as Wasm and as x64 code emitted by V8 Liftoff and TurboFan. The command can reuse saved publish snapshots and reports missing or ambiguous captures explicitly.The pilot is off by default. It complements
.mchreplay and measures code size, not app throughput or startup.How to try it
On Windows x64, run from the runtime checkout with Python, a compatible .NET 12 SDK, and the Browser runtime, WebAssembly SDK, and Crossgen2 packs at the same version. The WebAssembly SDK pack must already be in the NuGet cache because the fixture imports its targets during project evaluation. Set
NUGET_PACKAGESif the packs are in a non-default cache. Set$dotnet,$d8, and$wasmDisto the paths ofdotnet.exe, a disassembler-enabled d8 executable (V8 debug16.0.141was tested), andwasm-dis.exe(Binaryen 129 was tested). For jsvu, point to the installed.exe, not its.cmdshim.Reproduce a known diff. Set
$jittoclrjit_universal_wasm_x64.dllfrom the matching Crossgen2 pack. Use the same binary on both sides and disable inlining only for the candidate:For a real JIT comparison, pass the baseline and candidate binaries separately and omit
-diff_jit_option. Both JITs must match the selected Crossgen2's JIT–EE interface. The tool uses a fixedProgram.Target(int)console fixture, not an arbitrary app or.mchcollection.Read and rerun. The command prints its output directory (
artifacts\spmiby default, overridable with-spmi_locationorSUPERPMI_CACHE_DIRECTORY). Opensummary.mdfor byte counts and links to the Wasm and native disassembly.result.jsonhas the machine-readable result;commands.jsonrecords exact invocations. To skip publishing on a rerun, set$snapshotto the printed output directory:Pass the same snapshot to both flags for an A/A check.
CI pilot. When the SuperPMI diffs pipeline is available, set
spmi_wasm_native_diff_pack_versionto the exact pack version compatible with both checked Wasm JITs. Leaving it blank keeps the pilot off. Look for the Browser/Wasm → V8 x64 summary section andWasmNativeDiffs.zipin the SuperPMI diffs artifact.Validation
python -m unittest discover -s .\src\coreclr\scripts -p test_superpmi_wasm_native_diffs.py -vpassed all six tests. SuperPMI Python scripts compiled, andgit diff --checkpassed.dotnet msbuild .\src\coreclr\scripts\superpmi-diffs.proj -getItem:HelixWorkItemwithTargetOS=windows,TargetArchitecture=x64, andSuperPmiWasmNativeDiffstoggled showed the dedicated work item only when enabled.50a63f58444and71cbb0b2549) with matching12.0.0-alpha.1.26575.102packs. Crossgen2 used the intended JIT on each side. All three stages matched for the fixture.JitNoInline=1positive control still reported changes in all three stages after normalization: +22 Wasm bytes, +532 Liftoff x64 instruction bytes, and +480 TurboFan x64 instruction bytes.Note
This description was generated with GitHub Copilot.