Skip to content

Conversation

@kg
Copy link
Member

@kg kg commented Jan 5, 2026

No description provided.

Copilot AI review requested due to automatic review settings January 5, 2026 21:32
@kg kg added arch-wasm WebAssembly architecture area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI labels Jan 5, 2026
@dotnet-policy-service
Copy link
Contributor

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

Copy link
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 removes an incorrect NYI_WASM assertion from the WasmRegAlloc::isContainableMemoryOp method. The function's implementation—returning false to indicate that memory operations are not containable on WebAssembly—was already complete. The NYI_WASM macro would throw a not-yet-implemented error when TARGET_WASM is defined, preventing the function from executing even though it was correctly implemented.

  • Removes blocking NYI_WASM assertion from a fully implemented function
  • Allows memory operation containability checks to execute correctly on WebAssembly

}
#endif // TRACK_LSRA_STATS

bool WasmRegAlloc::isContainableMemoryOp(GenTree* node)
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the call stack that hits this? We shouldn't be trying to contain any memory ops, not yet. Though we will eventually do this for casts (to emit things like CAST<long>(IND<int>) as one load).

If this is hit from a caller that "makes sense", the right implementation would be to move what is now in lsrabuild.cpp to regalloc.cpp.

Copy link
Member Author

Choose a reason for hiding this comment

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

If you run a superpmi replay on x86 right now it gets hit ~40 times, see #122627 - I reproduced it locally too

@kg
Copy link
Member Author

kg commented Jan 7, 2026

cc @dotnet/jit-contrib
SingleAccretion points out that we may want to contain indirections later, so maybe this is wrong?

@AndyAyersMS
Copy link
Member

@kg can you paste the call stack where you see this?

@kg
Copy link
Member Author

kg commented Jan 7, 2026

I don't know how to get stacks out of spmi, but here are a few of the asserts:

[14:56:31] ISSUE: <ASSERT> #6145 Z:\runtime\src\coreclr\jit\regallocwasm.cpp (51) - Assertion failed 'NYI_WASM: isContainableMemoryOp' in 'System.Single:MinMagnitudeNumber(float,float):float' during 'Lowering nodeinfo' (IL size 46; hash 0x387b13cc; FullOpts)
[14:56:31] ISSUE: <ASSERT> #14594 Z:\runtime\src\coreclr\jit\regallocwasm.cpp (51) - Assertion failed 'NYI_WASM: isContainableMemoryOp' in 'System.IO.UnmanagedMemoryAccessor:Write(long,float):this' during 'Lowering nodeinfo' (IL size 14; hash 0x82f6430c; FullOpts)
[14:56:32] ISSUE: <ASSERT> #3684 Z:\runtime\src\coreclr\jit\regallocwasm.cpp (51) - Assertion failed 'NYI_WASM: isContainableMemoryOp' in 'System.BitConverter:Int64BitsToDouble(long):double' during 'Lowering nodeinfo' (IL size 7; hash 0x8bea83fc; FullOpts)
[14:56:32] ISSUE: <ASSERT> #28900 Z:\runtime\src\coreclr\jit\regallocwasm.cpp (51) - Assertion failed 'NYI_WASM: isContainableMemoryOp' in 'System.Globalization.CultureData:GetLocaleName(System.String,byref):bool' during 'Lowering nodeinfo' (IL size 38; hash 0xc29d82d7; FullOpts)

@kg
Copy link
Member Author

kg commented Jan 7, 2026

I think this is one of them:
image

@SingleAccretion
Copy link
Contributor

ContainCheckBitCast

So this is one of those cases that "makes sense" (though it does mean we will need to handle it in bitcast codegen). That implies the second option (moving the existing impl from lsrabuild.cpp).

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.

3 participants