Skip to content

Add base lightup support for most of the WASM intrinsics#130161

Merged
tannergooding merged 8 commits into
dotnet:mainfrom
tannergooding:wasm-simd
Jul 8, 2026
Merged

Add base lightup support for most of the WASM intrinsics#130161
tannergooding merged 8 commits into
dotnet:mainfrom
tannergooding:wasm-simd

Conversation

@tannergooding

@tannergooding tannergooding commented Jul 3, 2026

Copy link
Copy Markdown
Member

This does not cover the cases which require more complex codegen/handling or which are dependent on Shuffle, GetElement, or WithElement

Diffs

It provides an 11.57% improvement to the WASM throughput for corelib crossgen. The asm output is a regression, namely due to intrinsics APIs actually being intrinsic and not eating the inlining budget, so the other hot code is meaningfully inlined instead. It should balance out more when the rest of the intrinsics are brought online but is itself an improvement in terms of perf and codegen.

Copilot AI review requested due to automatic review settings July 3, 2026 07: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 Jul 3, 2026

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

This PR extends CoreCLR JIT support for WASM SIMD “lightup” by wiring additional Vector/PackedSimd intrinsics through import/lowering, updating intrinsic metadata tables, and enabling some folding/value-numbering/assertion-range recognition for PackedSimd.Bitmask.

Changes:

  • Adds WASM handling for PackedSimd.Bitmask in value numbering, folding, and assertion range analysis.
  • Extends WASM lowering for Vector128 Create and equality/inequality, and adds a lowering workaround for Vector128<ulong> ordered compares.
  • Updates WASM intrinsic tables / xplat importer paths to light up more intrinsics and conversions.
Show a summary per file
File Description
src/coreclr/jit/valuenum.cpp Treats PackedSimd.Bitmask similarly to xarch movemask for VN evaluation.
src/coreclr/jit/lowerwasm.cpp Adds lowering for Vector.Create/CreateScalar and Vector equality/inequality; adds ulong ordered-compare fixup.
src/coreclr/jit/hwintrinsicwasm.cpp Adjusts WASM special-import handling; changes default to unreached().
src/coreclr/jit/hwintrinsiclistwasm.h Enables additional PackedSimd intrinsics and reclassifies several as HW_Category_IMM / MemoryLoad.
src/coreclr/jit/hwintrinsiclist.h Changes Vector.CreateScalarUnsafe metadata for non-xarch/non-arm64 targets.
src/coreclr/jit/hwintrinsic.h Removes a stale TODO comment.
src/coreclr/jit/hwintrinsic.cpp Removes the WASM “only Vector.Create” lightup gate; maps more Vector intrinsics to WASM equivalents or TODO returns.
src/coreclr/jit/gentree.cpp Adds WASM implementations for some SIMD conversion/minmax/widen cases, but keeps CreateScalar/CreateScalarUnsafe as TODO returning null.
src/coreclr/jit/assertionprop.cpp Treats PackedSimd.Bitmask similarly to xarch movemask for range inference.

Copilot's findings

  • Files reviewed: 9/9 changed files
  • Comments generated: 7

Comment thread src/coreclr/jit/hwintrinsiclist.h
Comment thread src/coreclr/jit/lowerwasm.cpp
Comment thread src/coreclr/jit/lowerwasm.cpp
Comment thread src/coreclr/jit/gentree.cpp Outdated
Comment thread src/coreclr/jit/gentree.cpp Outdated
Comment thread src/coreclr/jit/hwintrinsiclistwasm.h
Comment thread src/coreclr/jit/hwintrinsicwasm.cpp
@tannergooding tannergooding marked this pull request as ready for review July 3, 2026 18:16
Copilot AI review requested due to automatic review settings July 3, 2026 18:16
@tannergooding tannergooding requested a review from adamperlin July 3, 2026 18:18

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's findings

  • Files reviewed: 11/11 changed files
  • Comments generated: 3

Comment thread src/coreclr/jit/gentree.cpp
Comment thread src/coreclr/jit/gentree.cpp Outdated
Comment thread src/coreclr/jit/gentree.cpp Outdated
Copilot AI review requested due to automatic review settings July 7, 2026 11:17
@tannergooding

Copy link
Copy Markdown
Member Author

CC. @dotnet/jit-contrib, @adamperlin this is ready for review and gets most of the WASM SIMD support ready.

What's not covered will be handled in a separate PR after #130272 also goes in.

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's findings

  • Files reviewed: 11/11 changed files
  • Comments generated: 0 new

@adamperlin

Copy link
Copy Markdown
Contributor

CC. @dotnet/jit-contrib, @adamperlin this is ready for review and gets most of the WASM SIMD support ready.

What's not covered will be handled in a separate PR after #130272 also goes in.

Thanks for the ping, I'll take a look today!

@adamperlin adamperlin 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.

Overall this looks good to me, I just had two small questions. Thank you for this work!

Comment thread src/coreclr/jit/gentree.cpp
Comment thread src/coreclr/jit/gentree.cpp
@tannergooding tannergooding enabled auto-merge (squash) July 7, 2026 18:22
@JulieLeeMSFT JulieLeeMSFT added the arch-wasm WebAssembly architecture label Jul 7, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to 'arch-wasm': @lewing, @pavelsavara
See info in area-owners.md if you want to be subscribed.

Copilot AI review requested due to automatic review settings July 7, 2026 20:54

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's findings

  • Files reviewed: 11/11 changed files
  • Comments generated: 1

Comment thread src/coreclr/jit/lowerwasm.cpp Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 7, 2026 21:01

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's findings

  • Files reviewed: 11/11 changed files
  • Comments generated: 1

Comment thread src/coreclr/jit/lclmorph.cpp
@tannergooding tannergooding merged commit c76054f into dotnet:main Jul 8, 2026
135 of 137 checks passed
@tannergooding tannergooding deleted the wasm-simd branch July 8, 2026 00:35
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-preview7 milestone Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arch-wasm WebAssembly architecture 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.

4 participants