From 405910799f19f2b83b73b62074dcc62c9c8c84ec Mon Sep 17 00:00:00 2001 From: Larry Ewing Date: Fri, 6 Nov 2026 14:54:25 -0600 Subject: [PATCH 01/19] [wasi][coreclr] Enable WasmEnableRelaxedSimd by default on CoreCLR WASI - WasiApp.CoreCLR.targets: default WasmEnableRelaxedSimd=true; when on, pass --instruction-set:relaxed-simd to crossgen2 and set the System.Runtime.Intrinsics.Wasm.RelaxedSimd.IsSupported runtime property. - wasihost and corerun (wasm): enable the RelaxedSimd instruction set when that property is true, as browserhost does. - src/tests: apply WasmEnableRelaxedSimd to crossgen2 and corerun for browser and WASI (default on for WASI), and forward it from build.proj to test projects. Previously /p:WasmEnableRelaxedSimd=true on the hardware-intrinsics-wasm lane reached neither, so RelaxedSimd.IsSupported stayed false. - Add a RelaxedSimd test asserting IsSupported matches the host property under R2R. - Add a wasi_wasm leg to hardware-intrinsics-wasm. - Document the WASI default and trade-offs. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- docs/workflow/building/coreclr/wasi-r2r.md | 10 ++++++++++ eng/pipelines/coreclr/hardware-intrinsics-wasm.yml | 10 ++++++++++ .../templates/jit-hardware-intrinsics-wasm.yml | 4 ++++ eng/testing/tests.wasi.targets | 6 ++++++ src/coreclr/hosts/corerun/corerun.cpp | 14 ++++++++++++++ src/mono/wasi/build/WasiApp.CoreCLR.targets | 10 ++++++++++ src/native/corehost/wasihost/wasihost.cpp | 14 ++++++++++++++ src/tests/Directory.Build.targets | 12 ++++++++++++ .../Wasm/RelaxedSimd/RelaxedSimdTests.cs | 11 +++++++++++ src/tests/build.proj | 1 + 10 files changed, 92 insertions(+) diff --git a/docs/workflow/building/coreclr/wasi-r2r.md b/docs/workflow/building/coreclr/wasi-r2r.md index d1dedfe6d4c178..e0ec6726fabb7d 100644 --- a/docs/workflow/building/coreclr/wasi-r2r.md +++ b/docs/workflow/building/coreclr/wasi-r2r.md @@ -40,6 +40,16 @@ of the number of function definitions; table slots may contain duplicate or non- references. Non-composite R2R and `WasmSingleFileBundle` are not supported by this path. +### Relaxed SIMD + +`WasmEnableRelaxedSimd` defaults to `true` for CoreCLR-WASI (browser defaults to `false`). It compiles +ReadyToRun code with Crossgen2's `--instruction-set:relaxed-simd` and sets the +`System.Runtime.Intrinsics.Wasm.RelaxedSimd.IsSupported` runtime property, which the host uses to enable +`RelaxedSimd.IsSupported`. WASI has no runtime feature detection, so a host without relaxed SIMD (for +example wasmtime with `-W relaxed-simd=n`) fails to compile the module; publish with +`-p:WasmEnableRelaxedSimd=false` for such hosts. Relaxed SIMD results may differ between hosts and CPUs. +Interpreted code always reports `RelaxedSimd.IsSupported` as `false`. + ## Runtime tests The WASI runtime-test pipeline keeps separate interpreter and `R2R_CG2` jobs. The R2R job uses diff --git a/eng/pipelines/coreclr/hardware-intrinsics-wasm.yml b/eng/pipelines/coreclr/hardware-intrinsics-wasm.yml index ef75d2e19f9bcb..34529c6a998b62 100644 --- a/eng/pipelines/coreclr/hardware-intrinsics-wasm.yml +++ b/eng/pipelines/coreclr/hardware-intrinsics-wasm.yml @@ -11,6 +11,9 @@ pr: - eng/pipelines/coreclr/hardware-intrinsics-wasm.yml - eng/pipelines/coreclr/templates/jit-hardware-intrinsics-wasm.yml - src/coreclr/jit/*wasm* + - src/coreclr/hosts/corerun/** + - src/tests/Directory.Build.targets + - src/tests/build.proj - src/tests/JIT/HardwareIntrinsics/Wasm/** variables: @@ -29,3 +32,10 @@ extends: platforms: - browser_wasm testBuildArgs: '/p:WasmEnableRelaxedSimd=true -test:JIT/HardwareIntrinsics/HardwareIntrinsics_Wasm_r.csproj -test:JIT/HardwareIntrinsics/HardwareIntrinsics_Wasm_ro.csproj' + # WASI loads ReadyToRun code from a single composite. Relaxed SIMD is on by default for CoreCLR WASI. + - template: /eng/pipelines/coreclr/templates/jit-hardware-intrinsics-wasm.yml + parameters: + platforms: + - wasi_wasm + compositeBuildMode: true + testBuildArgs: '-test:JIT/HardwareIntrinsics/HardwareIntrinsics_Wasm_r.csproj -test:JIT/HardwareIntrinsics/HardwareIntrinsics_Wasm_ro.csproj' diff --git a/eng/pipelines/coreclr/templates/jit-hardware-intrinsics-wasm.yml b/eng/pipelines/coreclr/templates/jit-hardware-intrinsics-wasm.yml index 0fb12ab24e3fa0..a5759da9b09f8b 100644 --- a/eng/pipelines/coreclr/templates/jit-hardware-intrinsics-wasm.yml +++ b/eng/pipelines/coreclr/templates/jit-hardware-intrinsics-wasm.yml @@ -3,6 +3,9 @@ parameters: type: object - name: testBuildArgs type: string + - name: compositeBuildMode + type: boolean + default: false jobs: # Build CoreCLR + libraries for wasm, build the wasm HardwareIntrinsics tests, @@ -32,6 +35,7 @@ jobs: testRunNamePrefixSuffix: CoreCLR_R2R # The CoreCLR interpreter does not implement Wasm SIMD; ReadyToRun code does. readyToRun: true + compositeBuildMode: ${{ parameters.compositeBuildMode }} extraVariablesTemplates: - template: /eng/pipelines/common/templates/runtimes/test-variables.yml parameters: diff --git a/eng/testing/tests.wasi.targets b/eng/testing/tests.wasi.targets index bcc314bc7724ef..80bcaaaee0de80 100644 --- a/eng/testing/tests.wasi.targets +++ b/eng/testing/tests.wasi.targets @@ -1,4 +1,10 @@ + + + true + + diff --git a/src/coreclr/hosts/corerun/corerun.cpp b/src/coreclr/hosts/corerun/corerun.cpp index 0f3e7b1ede16da..1fe7535df98c03 100644 --- a/src/coreclr/hosts/corerun/corerun.cpp +++ b/src/coreclr/hosts/corerun/corerun.cpp @@ -11,6 +11,8 @@ #ifdef TARGET_WASM #include + +extern "C" void coreclr_wasm_set_relaxed_simd_supported(); #endif // TARGET_WASM #ifdef TARGET_BROWSER @@ -728,6 +730,18 @@ static int run(const configuration& config) #ifdef TARGET_WASM // install the pinvoke override callback to resolve p/invokes to statically linked libraries add_pinvoke_override(); + + // Wasm has no runtime feature detection; the test opts in through this property, as the app hosts do. + for (size_t i = 0; i < config.user_defined_keys.size(); ++i) + { + if (config.user_defined_keys[i] == W("System.Runtime.Intrinsics.Wasm.RelaxedSimd.IsSupported")) + { + if (config.user_defined_values[i] == W("true")) + coreclr_wasm_set_relaxed_simd_supported(); + + break; + } + } #endif // TARGET_WASM int result; diff --git a/src/mono/wasi/build/WasiApp.CoreCLR.targets b/src/mono/wasi/build/WasiApp.CoreCLR.targets index 9d54ea1733bb72..fadac26b1b1637 100644 --- a/src/mono/wasi/build/WasiApp.CoreCLR.targets +++ b/src/mono/wasi/build/WasiApp.CoreCLR.targets @@ -72,12 +72,22 @@ wasihost corehost (libWasiHost.a) per-app through its own targets below. --> false false + + true + + + + wasm true $(PublishReadyToRunCrossgen2ExtraArgs);--opt-cross-module:* + $(PublishReadyToRunCrossgen2ExtraArgs);--instruction-set:relaxed-simd true diff --git a/src/native/corehost/wasihost/wasihost.cpp b/src/native/corehost/wasihost/wasihost.cpp index 2129b1290babd3..8c7cae65b594a0 100644 --- a/src/native/corehost/wasihost/wasihost.cpp +++ b/src/native/corehost/wasihost/wasihost.cpp @@ -72,6 +72,8 @@ extern "C" int* latchedExitCode); int coreclr_set_error_writer(void (*errorWriter)(const char* line)); + + void coreclr_wasm_set_relaxed_simd_supported(); } // App-generated P/Invoke resolver (per-app, replaces libcoreclr_gen_static.a at the relink), passed @@ -380,6 +382,18 @@ int main(int argc, char* argv[]) if (!add_runtimeconfig_properties(runtimeconfig_path)) return -1; + // WASI has no runtime feature detection; the app opts in (WasmEnableRelaxedSimd) through this property. + for (size_t i = 0; i < s_property_keys.size(); ++i) + { + if (s_property_keys[i] == "System.Runtime.Intrinsics.Wasm.RelaxedSimd.IsSupported") + { + if (s_property_values[i] == "true") + coreclr_wasm_set_relaxed_simd_supported(); + + break; + } + } + std::vector property_keys; std::vector property_values; for (const std::string& key : s_property_keys) diff --git a/src/tests/Directory.Build.targets b/src/tests/Directory.Build.targets index e5c06c0c5928b4..3986cbbc05e2fa 100644 --- a/src/tests/Directory.Build.targets +++ b/src/tests/Directory.Build.targets @@ -293,6 +293,18 @@ native code need a corerun with that code linked in. --> + + + + true + + + $(CrossGen2TestExtraArguments) --instruction-set:relaxed-simd + + + + Environment.GetEnvironmentVariable("TEST_READY_TO_RUN_MODE") == "1"; + + // ReadyToRun code compiled for relaxed SIMD is rejected unless the host enables the instruction set, + // so a host that ignores the WasmEnableRelaxedSimd setting silently reports IsSupported == false. + [ConditionalFact(typeof(RelaxedSimdTests), nameof(IsReadyToRun))] + public static void IsSupportedMatchesHostConfiguration() + { + bool expected = AppContext.TryGetSwitch("System.Runtime.Intrinsics.Wasm.RelaxedSimd.IsSupported", out bool isEnabled) && isEnabled; + Assert.Equal(expected, RelaxedSimd.IsSupported); + } + [ConditionalFact(typeof(RelaxedSimdTests), nameof(IsNotSupported))] public static void UnsupportedMethodThrowsPlatformNotSupportedException() { diff --git a/src/tests/build.proj b/src/tests/build.proj index 73b8f080878a47..522d5a7202e4ae 100644 --- a/src/tests/build.proj +++ b/src/tests/build.proj @@ -258,6 +258,7 @@ $(GroupBuildCmd) /p:ContinuousIntegrationBuild=true $(GroupBuildCmd) "/p:BuildTestsOnHelix=true" $(GroupBuildCmd) "/p:MonoForceInterpreter=true" + $(GroupBuildCmd) "/p:WasmEnableRelaxedSimd=$(WasmEnableRelaxedSimd)" $(GroupBuildCmd) "/p:RunAOTCompilation=true" $(GroupBuildCmd) "/p:DevTeamProvisioning=$(DevTeamProvisioning)" From 0c785030944a5a04e129c05070ab7f6b4706b820 Mon Sep 17 00:00:00 2001 From: Larry Ewing Date: Fri, 6 Nov 2026 14:57:41 -0600 Subject: [PATCH 02/19] Quarantine WASI R2R tests that depend on R2R CoreLib against #134949 PackedSimdIsSupported, RelaxedSimdIsSupportedReflects and LoadStoreNullCheckTest call into CoreLib at run time, which is interpreted in WASI ReadyToRun test composites. Skip them only when IsWasi && IsReadyToRunCompiled; they still run in the WASI interpreter lane and on browser. Use the shared IsWasmReadyToRun predicate for IsSupportedMatchesHostConfiguration. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .../HardwareIntrinsics/Wasm/PackedSimd/PackedSimdTests.cs | 2 ++ .../HardwareIntrinsics/Wasm/RelaxedSimd/RelaxedSimdTests.cs | 5 ++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/tests/JIT/HardwareIntrinsics/Wasm/PackedSimd/PackedSimdTests.cs b/src/tests/JIT/HardwareIntrinsics/Wasm/PackedSimd/PackedSimdTests.cs index b87dff9fb29286..5eca0fd9584b63 100644 --- a/src/tests/JIT/HardwareIntrinsics/Wasm/PackedSimd/PackedSimdTests.cs +++ b/src/tests/JIT/HardwareIntrinsics/Wasm/PackedSimd/PackedSimdTests.cs @@ -13,6 +13,7 @@ public sealed class PackedSimdTests { [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/134949", typeof(TestLibrary.PlatformDetection), nameof(TestLibrary.PlatformDetection.IsWasi), nameof(TestLibrary.PlatformDetection.IsReadyToRunCompiled))] [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(PackedSimd))] public static unsafe void PackedSimdIsSupported() { @@ -1259,6 +1260,7 @@ public static unsafe void LoadScalarAndSplatTest() } [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/134949", typeof(TestLibrary.PlatformDetection), nameof(TestLibrary.PlatformDetection.IsWasi), nameof(TestLibrary.PlatformDetection.IsReadyToRunCompiled))] public static unsafe void LoadStoreNullCheckTest() { if (!PackedSimd.IsSupported) diff --git a/src/tests/JIT/HardwareIntrinsics/Wasm/RelaxedSimd/RelaxedSimdTests.cs b/src/tests/JIT/HardwareIntrinsics/Wasm/RelaxedSimd/RelaxedSimdTests.cs index 6077d10e43ff1b..14c9421183e089 100644 --- a/src/tests/JIT/HardwareIntrinsics/Wasm/RelaxedSimd/RelaxedSimdTests.cs +++ b/src/tests/JIT/HardwareIntrinsics/Wasm/RelaxedSimd/RelaxedSimdTests.cs @@ -12,6 +12,7 @@ public sealed class RelaxedSimdTests public static bool IsNotSupported => !RelaxedSimd.IsSupported; [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/134949", typeof(TestLibrary.PlatformDetection), nameof(TestLibrary.PlatformDetection.IsWasi), nameof(TestLibrary.PlatformDetection.IsReadyToRunCompiled))] public static void RelaxedSimdIsSupportedReflects() { MethodInfo? methodInfo = typeof(RelaxedSimd).GetMethod("get_IsSupported"); @@ -19,11 +20,9 @@ public static void RelaxedSimdIsSupportedReflects() Assert.Equal(RelaxedSimd.IsSupported, methodInfo.Invoke(null, null)); } - public static bool IsReadyToRun => Environment.GetEnvironmentVariable("TEST_READY_TO_RUN_MODE") == "1"; - // ReadyToRun code compiled for relaxed SIMD is rejected unless the host enables the instruction set, // so a host that ignores the WasmEnableRelaxedSimd setting silently reports IsSupported == false. - [ConditionalFact(typeof(RelaxedSimdTests), nameof(IsReadyToRun))] + [ConditionalFact(typeof(TestLibrary.PlatformDetection), nameof(TestLibrary.PlatformDetection.IsWasmReadyToRun))] public static void IsSupportedMatchesHostConfiguration() { bool expected = AppContext.TryGetSwitch("System.Runtime.Intrinsics.Wasm.RelaxedSimd.IsSupported", out bool isEnabled) && isEnabled; From 1190148bc9a067e3a2304c2e4d9044d1f7646b54 Mon Sep 17 00:00:00 2001 From: Larry Ewing Date: Fri, 6 Nov 2026 15:12:49 -0600 Subject: [PATCH 03/19] Enable wasm relaxed SIMD from the crossgen2 instruction set alone Wasm has no runtime feature detection, so the runtime's CPU flags cannot confirm the instruction sets a ReadyToRun image requires. Previously hosts read a System.Runtime.Intrinsics.Wasm.RelaxedSimd.IsSupported runtime property and called an exported coreclr_wasm_set_relaxed_simd_supported() so the image-wide instruction set fixup would pass. The engine already validates the code when it compiles the module, so on wasm treat instruction sets an image requires as supported. Must-be-unsupported assertions are still checked against the runtime flags. This removes the exported setter, the browserhost/wasihost/corerun property handling, and the RuntimeHostConfigurationOption items; WasmEnableRelaxedSimd now only selects --instruction-set:relaxed-simd (and the browser emcc flags). PublishRelaxedSimdCoreClr now publishes ReadyToRun and checks RelaxedSimd.IsSupported instead of the removed runtime property. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- docs/workflow/building/coreclr/wasi-r2r.md | 9 ++++----- .../coreclr/hardware-intrinsics-wasm.yml | 1 - src/coreclr/hosts/corerun/corerun.cpp | 14 -------------- src/coreclr/vm/codeman.cpp | 13 ------------- src/coreclr/vm/jitinterface.cpp | 8 ++++++++ .../build/BrowserWasmApp.CoreCLR.targets | 6 ------ ...ET.Sdk.WebAssembly.Browser.CoreCLR.targets | 6 ------ src/mono/wasi/build/WasiApp.CoreCLR.targets | 10 ++-------- .../wasm/Wasm.Build.Tests/WasmSIMDTests.cs | 19 ++++++++----------- .../corehost/browserhost/browserhost.cpp | 12 ------------ src/native/corehost/wasihost/wasihost.cpp | 14 -------------- src/tests/Directory.Build.targets | 7 ++----- .../Wasm/RelaxedSimd/RelaxedSimdTests.cs | 9 --------- 13 files changed, 24 insertions(+), 104 deletions(-) diff --git a/docs/workflow/building/coreclr/wasi-r2r.md b/docs/workflow/building/coreclr/wasi-r2r.md index e0ec6726fabb7d..7224b15e108942 100644 --- a/docs/workflow/building/coreclr/wasi-r2r.md +++ b/docs/workflow/building/coreclr/wasi-r2r.md @@ -43,11 +43,10 @@ Non-composite R2R and `WasmSingleFileBundle` are not supported by this path. ### Relaxed SIMD `WasmEnableRelaxedSimd` defaults to `true` for CoreCLR-WASI (browser defaults to `false`). It compiles -ReadyToRun code with Crossgen2's `--instruction-set:relaxed-simd` and sets the -`System.Runtime.Intrinsics.Wasm.RelaxedSimd.IsSupported` runtime property, which the host uses to enable -`RelaxedSimd.IsSupported`. WASI has no runtime feature detection, so a host without relaxed SIMD (for -example wasmtime with `-W relaxed-simd=n`) fails to compile the module; publish with -`-p:WasmEnableRelaxedSimd=false` for such hosts. Relaxed SIMD results may differ between hosts and CPUs. +ReadyToRun code with Crossgen2's `--instruction-set:relaxed-simd`, so `RelaxedSimd.IsSupported` is `true` in +that code. Wasm has no runtime feature detection; the runtime accepts the instruction sets an image requires +because the engine validated the module. A host without relaxed SIMD (for example wasmtime with +`-W relaxed-simd=n`) fails to compile the module; publish with `-p:WasmEnableRelaxedSimd=false` for such hosts. Relaxed SIMD results may differ between hosts and CPUs. Interpreted code always reports `RelaxedSimd.IsSupported` as `false`. ## Runtime tests diff --git a/eng/pipelines/coreclr/hardware-intrinsics-wasm.yml b/eng/pipelines/coreclr/hardware-intrinsics-wasm.yml index 34529c6a998b62..b330b8b54cb6eb 100644 --- a/eng/pipelines/coreclr/hardware-intrinsics-wasm.yml +++ b/eng/pipelines/coreclr/hardware-intrinsics-wasm.yml @@ -11,7 +11,6 @@ pr: - eng/pipelines/coreclr/hardware-intrinsics-wasm.yml - eng/pipelines/coreclr/templates/jit-hardware-intrinsics-wasm.yml - src/coreclr/jit/*wasm* - - src/coreclr/hosts/corerun/** - src/tests/Directory.Build.targets - src/tests/build.proj - src/tests/JIT/HardwareIntrinsics/Wasm/** diff --git a/src/coreclr/hosts/corerun/corerun.cpp b/src/coreclr/hosts/corerun/corerun.cpp index 1fe7535df98c03..0f3e7b1ede16da 100644 --- a/src/coreclr/hosts/corerun/corerun.cpp +++ b/src/coreclr/hosts/corerun/corerun.cpp @@ -11,8 +11,6 @@ #ifdef TARGET_WASM #include - -extern "C" void coreclr_wasm_set_relaxed_simd_supported(); #endif // TARGET_WASM #ifdef TARGET_BROWSER @@ -730,18 +728,6 @@ static int run(const configuration& config) #ifdef TARGET_WASM // install the pinvoke override callback to resolve p/invokes to statically linked libraries add_pinvoke_override(); - - // Wasm has no runtime feature detection; the test opts in through this property, as the app hosts do. - for (size_t i = 0; i < config.user_defined_keys.size(); ++i) - { - if (config.user_defined_keys[i] == W("System.Runtime.Intrinsics.Wasm.RelaxedSimd.IsSupported")) - { - if (config.user_defined_values[i] == W("true")) - coreclr_wasm_set_relaxed_simd_supported(); - - break; - } - } #endif // TARGET_WASM int result; diff --git a/src/coreclr/vm/codeman.cpp b/src/coreclr/vm/codeman.cpp index d39630b18edf0f..1fb272e66eab96 100644 --- a/src/coreclr/vm/codeman.cpp +++ b/src/coreclr/vm/codeman.cpp @@ -1457,15 +1457,6 @@ extern "C" DWORD64 __stdcall GetDataCacheZeroIDReg(); extern "C" uint64_t GetSveLengthFromOS(); #endif -#ifdef TARGET_WASM -static bool s_wasmRelaxedSimdSupported; - -extern "C" void coreclr_wasm_set_relaxed_simd_supported() -{ - s_wasmRelaxedSimdSupported = true; -} -#endif - void EEJitManager::SetCpuInfo() { LIMITED_METHOD_CONTRACT; @@ -1510,10 +1501,6 @@ void EEJitManager::SetCpuInfo() #if defined(TARGET_WASM) CPUCompileFlags.Set(InstructionSet_WasmBase); CPUCompileFlags.Set(InstructionSet_PackedSimd); - if (s_wasmRelaxedSimdSupported) - { - CPUCompileFlags.Set(InstructionSet_RelaxedSimd); - } #endif #if defined(TARGET_X86) || defined(TARGET_AMD64) diff --git a/src/coreclr/vm/jitinterface.cpp b/src/coreclr/vm/jitinterface.cpp index c4b8c0418e0ba8..ce573203237ec4 100644 --- a/src/coreclr/vm/jitinterface.cpp +++ b/src/coreclr/vm/jitinterface.cpp @@ -14638,6 +14638,14 @@ BOOL LoadDynamicInfoEntry(Module *currentModule, DWORD instructionSetEncoded = CorSigUncompressData(pBlob); bool mustInstructionSetBeSupported = !!(instructionSetEncoded & 1); ReadyToRunInstructionSet instructionSet = (ReadyToRunInstructionSet)(instructionSetEncoded >> 1); +#ifdef TARGET_WASM + // Wasm has no runtime feature detection. The engine validated this code when it compiled the + // module, so an instruction set the code requires is supported by construction. + if (mustInstructionSetBeSupported) + { + continue; + } +#endif // TARGET_WASM if (IsInstructionSetSupported(corjitFlags, instructionSet) != mustInstructionSetBeSupported) { return FALSE; diff --git a/src/mono/browser/build/BrowserWasmApp.CoreCLR.targets b/src/mono/browser/build/BrowserWasmApp.CoreCLR.targets index 8e7637785e9f8e..7ea2f43c2a90c3 100644 --- a/src/mono/browser/build/BrowserWasmApp.CoreCLR.targets +++ b/src/mono/browser/build/BrowserWasmApp.CoreCLR.targets @@ -74,12 +74,6 @@ <_ExeExt Condition="$([MSBuild]::IsOSPlatform('windows'))">.exe - - - - false false - + true - - - - wasm true diff --git a/src/mono/wasm/Wasm.Build.Tests/WasmSIMDTests.cs b/src/mono/wasm/Wasm.Build.Tests/WasmSIMDTests.cs index ca7adc8662d386..495fc9f15d3f58 100644 --- a/src/mono/wasm/Wasm.Build.Tests/WasmSIMDTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/WasmSIMDTests.cs @@ -74,7 +74,8 @@ public async Task PublishRelaxedSimdCoreClr(bool relaxedSimd) { Configuration config = Configuration.Debug; string relaxedSimdValue = relaxedSimd.ToString().ToLowerInvariant(); - string extraProperties = $"{relaxedSimdValue}"; + // ReadyToRun code is what uses relaxed SIMD; the interpreter always reports it unsupported. + string extraProperties = $"{relaxedSimdValue}true"; ProjectInfo info = CopyTestAsset( config, aot: false, @@ -83,7 +84,7 @@ public async Task PublishRelaxedSimdCoreClr(bool relaxedSimd) extraProperties: extraProperties); UpdateFile( Path.Combine("Common", "Program.cs"), - GetCoreClrRelaxedSimdProgramText(relaxedSimdValue)); + s_coreClrRelaxedSimdProgramText); ReplaceMainJsWithMinimalRunMain(); PublishProject(info, config, isNativeBuild: relaxedSimd); @@ -92,24 +93,20 @@ public async Task PublishRelaxedSimdCoreClr(bool relaxedSimd) config, TestScenario: "DotnetRun", ExpectedExitCode: 42)); - string expectedOutput = $"RelaxedSimd config: {(relaxedSimd ? "true" : "")}"; + string expectedOutput = $"RelaxedSimd.IsSupported: {relaxedSimd}"; Assert.Contains(result.TestOutput, message => message.Contains(expectedOutput)); } - private static string GetCoreClrRelaxedSimdProgramText(string expectedConfigValue) => $$""" + private static string s_coreClrRelaxedSimdProgramText = """ using System; + using System.Runtime.Intrinsics.Wasm; public class TestClass { public static int Main() { - string configuredValue = AppContext.GetData( - "System.Runtime.Intrinsics.Wasm.RelaxedSimd.IsSupported") as string; - Console.WriteLine($"TestOutput -> RelaxedSimd config: {configuredValue ?? ""}"); - - return configuredValue == {{(expectedConfigValue == "true" ? "\"true\"" : "null")}} - ? 42 - : 1; + Console.WriteLine($"TestOutput -> RelaxedSimd.IsSupported: {RelaxedSimd.IsSupported}"); + return 42; } } """; diff --git a/src/native/corehost/browserhost/browserhost.cpp b/src/native/corehost/browserhost/browserhost.cpp index b3aefce8d6e2ed..e687913cce4913 100644 --- a/src/native/corehost/browserhost/browserhost.cpp +++ b/src/native/corehost/browserhost/browserhost.cpp @@ -44,8 +44,6 @@ extern "C" pal::hresult_t coreclr_set_error_writer( coreclr_error_writer_callback_fn error_writer); - void coreclr_wasm_set_relaxed_simd_supported(); - #if !GEN_PINVOKE const void* SystemResolveDllImport(const char* name); const void* SystemJSResolveDllImport(const char* name); @@ -112,16 +110,6 @@ extern "C" void* BrowserHost_CreateHostContract(void) extern "C" int BrowserHost_InitializeDotnet(int propertiesCount, const char** propertyKeys, const char** propertyValues) { - for (int i = 0; i < propertiesCount; i++) - { - if ((strcmp(propertyKeys[i], "System.Runtime.Intrinsics.Wasm.RelaxedSimd.IsSupported") == 0) && - (strcmp(propertyValues[i], "true") == 0)) - { - coreclr_wasm_set_relaxed_simd_supported(); - break; - } - } - coreclr_set_error_writer(log_error_info); int retval = coreclr_initialize("/managed", "corehost", propertiesCount, propertyKeys, propertyValues, &CurrentClrInstance, &CurrentAppDomainId); diff --git a/src/native/corehost/wasihost/wasihost.cpp b/src/native/corehost/wasihost/wasihost.cpp index 8c7cae65b594a0..2129b1290babd3 100644 --- a/src/native/corehost/wasihost/wasihost.cpp +++ b/src/native/corehost/wasihost/wasihost.cpp @@ -72,8 +72,6 @@ extern "C" int* latchedExitCode); int coreclr_set_error_writer(void (*errorWriter)(const char* line)); - - void coreclr_wasm_set_relaxed_simd_supported(); } // App-generated P/Invoke resolver (per-app, replaces libcoreclr_gen_static.a at the relink), passed @@ -382,18 +380,6 @@ int main(int argc, char* argv[]) if (!add_runtimeconfig_properties(runtimeconfig_path)) return -1; - // WASI has no runtime feature detection; the app opts in (WasmEnableRelaxedSimd) through this property. - for (size_t i = 0; i < s_property_keys.size(); ++i) - { - if (s_property_keys[i] == "System.Runtime.Intrinsics.Wasm.RelaxedSimd.IsSupported") - { - if (s_property_values[i] == "true") - coreclr_wasm_set_relaxed_simd_supported(); - - break; - } - } - std::vector property_keys; std::vector property_values; for (const std::string& key : s_property_keys) diff --git a/src/tests/Directory.Build.targets b/src/tests/Directory.Build.targets index 3986cbbc05e2fa..b658bb69f74388 100644 --- a/src/tests/Directory.Build.targets +++ b/src/tests/Directory.Build.targets @@ -294,17 +294,14 @@ - + true $(CrossGen2TestExtraArguments) --instruction-set:relaxed-simd - - - Date: Fri, 6 Nov 2026 15:20:17 -0600 Subject: [PATCH 04/19] Clarify the WASI relaxed SIMD default comment Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- src/mono/wasi/build/WasiApp.CoreCLR.targets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mono/wasi/build/WasiApp.CoreCLR.targets b/src/mono/wasi/build/WasiApp.CoreCLR.targets index e4933f57952a4f..f9c8e6544733f6 100644 --- a/src/mono/wasi/build/WasiApp.CoreCLR.targets +++ b/src/mono/wasi/build/WasiApp.CoreCLR.targets @@ -72,8 +72,8 @@ wasihost corehost (libWasiHost.a) per-app through its own targets below. --> false false - + true From 8bffd8d5196f16d62352f596c2dddda748de8184 Mon Sep 17 00:00:00 2001 From: Larry Ewing Date: Fri, 6 Nov 2026 16:18:04 -0600 Subject: [PATCH 05/19] Make PublishRelaxedSimdCoreClr exercise relaxed SIMD Run ConvertToInt32Native and MultiplyAddEstimate through NoInlining methods and check their results when relaxed SIMD is enabled, and check that the opt-out throws PlatformNotSupportedException, instead of only printing IsSupported. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .../wasm/Wasm.Build.Tests/WasmSIMDTests.cs | 35 +++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/src/mono/wasm/Wasm.Build.Tests/WasmSIMDTests.cs b/src/mono/wasm/Wasm.Build.Tests/WasmSIMDTests.cs index 495fc9f15d3f58..c1b41a64f7fcf3 100644 --- a/src/mono/wasm/Wasm.Build.Tests/WasmSIMDTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/WasmSIMDTests.cs @@ -93,12 +93,22 @@ public async Task PublishRelaxedSimdCoreClr(bool relaxedSimd) config, TestScenario: "DotnetRun", ExpectedExitCode: 42)); - string expectedOutput = $"RelaxedSimd.IsSupported: {relaxedSimd}"; - Assert.Contains(result.TestOutput, message => message.Contains(expectedOutput)); + Assert.Contains(result.TestOutput, m => m.Contains($"RelaxedSimd.IsSupported: {relaxedSimd}")); + if (relaxedSimd) + { + Assert.Contains(result.TestOutput, m => m.Contains("ConvertToInt32Native: <1, -2, 3, -4>")); + Assert.Contains(result.TestOutput, m => m.Contains("MultiplyAddEstimate: <7, 7, 7, 7>")); + } + else + { + Assert.Contains(result.TestOutput, m => m.Contains("ConvertToInt32Native: PlatformNotSupportedException")); + } } private static string s_coreClrRelaxedSimdProgramText = """ using System; + using System.Runtime.CompilerServices; + using System.Runtime.Intrinsics; using System.Runtime.Intrinsics.Wasm; public class TestClass @@ -106,8 +116,29 @@ public class TestClass public static int Main() { Console.WriteLine($"TestOutput -> RelaxedSimd.IsSupported: {RelaxedSimd.IsSupported}"); + try + { + Console.WriteLine($"TestOutput -> ConvertToInt32Native: {ConvertToInt32Native(Vector128.Create(1.75f, -2.25f, 3.0f, -4.99f))}"); + } + catch (PlatformNotSupportedException) + { + Console.WriteLine("TestOutput -> ConvertToInt32Native: PlatformNotSupportedException"); + } + + if (RelaxedSimd.IsSupported) + { + Console.WriteLine($"TestOutput -> MultiplyAddEstimate: {MultiplyAddEstimate(Vector128.Create(2f), Vector128.Create(3f), Vector128.Create(1f))}"); + } + return 42; } + + [MethodImpl(MethodImplOptions.NoInlining)] + private static Vector128 ConvertToInt32Native(Vector128 value) => RelaxedSimd.ConvertToInt32Native(value); + + [MethodImpl(MethodImplOptions.NoInlining)] + private static Vector128 MultiplyAddEstimate(Vector128 left, Vector128 right, Vector128 addend) => + RelaxedSimd.MultiplyAddEstimate(left, right, addend); } """; From 9fa237a60dd7c532c76c1cd21420f1161e108ff3 Mon Sep 17 00:00:00 2001 From: Larry Ewing Date: Fri, 6 Nov 2026 16:29:03 -0600 Subject: [PATCH 06/19] Don't document interpreted RelaxedSimd.IsSupported as intended behavior IsSupported should be consistent across interpreted and compiled code; the mismatch is tracked by #134949. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- docs/workflow/building/coreclr/wasi-r2r.md | 1 - src/mono/wasm/Wasm.Build.Tests/WasmSIMDTests.cs | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/workflow/building/coreclr/wasi-r2r.md b/docs/workflow/building/coreclr/wasi-r2r.md index 7224b15e108942..6b1a64fbc990b7 100644 --- a/docs/workflow/building/coreclr/wasi-r2r.md +++ b/docs/workflow/building/coreclr/wasi-r2r.md @@ -47,7 +47,6 @@ ReadyToRun code with Crossgen2's `--instruction-set:relaxed-simd`, so `RelaxedSi that code. Wasm has no runtime feature detection; the runtime accepts the instruction sets an image requires because the engine validated the module. A host without relaxed SIMD (for example wasmtime with `-W relaxed-simd=n`) fails to compile the module; publish with `-p:WasmEnableRelaxedSimd=false` for such hosts. Relaxed SIMD results may differ between hosts and CPUs. -Interpreted code always reports `RelaxedSimd.IsSupported` as `false`. ## Runtime tests diff --git a/src/mono/wasm/Wasm.Build.Tests/WasmSIMDTests.cs b/src/mono/wasm/Wasm.Build.Tests/WasmSIMDTests.cs index c1b41a64f7fcf3..43508b1dace7db 100644 --- a/src/mono/wasm/Wasm.Build.Tests/WasmSIMDTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/WasmSIMDTests.cs @@ -74,7 +74,7 @@ public async Task PublishRelaxedSimdCoreClr(bool relaxedSimd) { Configuration config = Configuration.Debug; string relaxedSimdValue = relaxedSimd.ToString().ToLowerInvariant(); - // ReadyToRun code is what uses relaxed SIMD; the interpreter always reports it unsupported. + // Relaxed SIMD is selected by the ReadyToRun compiler's instruction set. string extraProperties = $"{relaxedSimdValue}true"; ProjectInfo info = CopyTestAsset( config, From 20cf33080431ebadf5f9a1d3b116a95ceae23651 Mon Sep 17 00:00:00 2001 From: Larry Ewing Date: Fri, 6 Nov 2026 16:34:40 -0600 Subject: [PATCH 07/19] Trim relaxed SIMD docs and comments Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- docs/workflow/building/coreclr/wasi-r2r.md | 9 ++------- eng/pipelines/coreclr/hardware-intrinsics-wasm.yml | 1 - eng/testing/tests.wasi.targets | 3 +-- src/coreclr/vm/jitinterface.cpp | 3 +-- src/mono/wasi/build/WasiApp.CoreCLR.targets | 3 +-- src/mono/wasm/Wasm.Build.Tests/WasmSIMDTests.cs | 1 - src/tests/Directory.Build.targets | 3 +-- 7 files changed, 6 insertions(+), 17 deletions(-) diff --git a/docs/workflow/building/coreclr/wasi-r2r.md b/docs/workflow/building/coreclr/wasi-r2r.md index 6b1a64fbc990b7..0823a9c428dfb5 100644 --- a/docs/workflow/building/coreclr/wasi-r2r.md +++ b/docs/workflow/building/coreclr/wasi-r2r.md @@ -40,13 +40,8 @@ of the number of function definitions; table slots may contain duplicate or non- references. Non-composite R2R and `WasmSingleFileBundle` are not supported by this path. -### Relaxed SIMD - -`WasmEnableRelaxedSimd` defaults to `true` for CoreCLR-WASI (browser defaults to `false`). It compiles -ReadyToRun code with Crossgen2's `--instruction-set:relaxed-simd`, so `RelaxedSimd.IsSupported` is `true` in -that code. Wasm has no runtime feature detection; the runtime accepts the instruction sets an image requires -because the engine validated the module. A host without relaxed SIMD (for example wasmtime with -`-W relaxed-simd=n`) fails to compile the module; publish with `-p:WasmEnableRelaxedSimd=false` for such hosts. Relaxed SIMD results may differ between hosts and CPUs. +`WasmEnableRelaxedSimd` (default `true`) compiles the composite with relaxed SIMD. Hosts without relaxed SIMD +fail to load it; publish with `-p:WasmEnableRelaxedSimd=false` for them. ## Runtime tests diff --git a/eng/pipelines/coreclr/hardware-intrinsics-wasm.yml b/eng/pipelines/coreclr/hardware-intrinsics-wasm.yml index b330b8b54cb6eb..51061b8671af43 100644 --- a/eng/pipelines/coreclr/hardware-intrinsics-wasm.yml +++ b/eng/pipelines/coreclr/hardware-intrinsics-wasm.yml @@ -31,7 +31,6 @@ extends: platforms: - browser_wasm testBuildArgs: '/p:WasmEnableRelaxedSimd=true -test:JIT/HardwareIntrinsics/HardwareIntrinsics_Wasm_r.csproj -test:JIT/HardwareIntrinsics/HardwareIntrinsics_Wasm_ro.csproj' - # WASI loads ReadyToRun code from a single composite. Relaxed SIMD is on by default for CoreCLR WASI. - template: /eng/pipelines/coreclr/templates/jit-hardware-intrinsics-wasm.yml parameters: platforms: diff --git a/eng/testing/tests.wasi.targets b/eng/testing/tests.wasi.targets index 80bcaaaee0de80..c99ee5e274a0d9 100644 --- a/eng/testing/tests.wasi.targets +++ b/eng/testing/tests.wasi.targets @@ -1,6 +1,5 @@ - + true diff --git a/src/coreclr/vm/jitinterface.cpp b/src/coreclr/vm/jitinterface.cpp index ce573203237ec4..b2b3d817900196 100644 --- a/src/coreclr/vm/jitinterface.cpp +++ b/src/coreclr/vm/jitinterface.cpp @@ -14639,8 +14639,7 @@ BOOL LoadDynamicInfoEntry(Module *currentModule, bool mustInstructionSetBeSupported = !!(instructionSetEncoded & 1); ReadyToRunInstructionSet instructionSet = (ReadyToRunInstructionSet)(instructionSetEncoded >> 1); #ifdef TARGET_WASM - // Wasm has no runtime feature detection. The engine validated this code when it compiled the - // module, so an instruction set the code requires is supported by construction. + // The wasm engine validated the instructions when it compiled the module. if (mustInstructionSetBeSupported) { continue; diff --git a/src/mono/wasi/build/WasiApp.CoreCLR.targets b/src/mono/wasi/build/WasiApp.CoreCLR.targets index f9c8e6544733f6..b26735617f5806 100644 --- a/src/mono/wasi/build/WasiApp.CoreCLR.targets +++ b/src/mono/wasi/build/WasiApp.CoreCLR.targets @@ -72,8 +72,7 @@ wasihost corehost (libWasiHost.a) per-app through its own targets below. --> false false - + true diff --git a/src/mono/wasm/Wasm.Build.Tests/WasmSIMDTests.cs b/src/mono/wasm/Wasm.Build.Tests/WasmSIMDTests.cs index 43508b1dace7db..c35f0f9a345923 100644 --- a/src/mono/wasm/Wasm.Build.Tests/WasmSIMDTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/WasmSIMDTests.cs @@ -74,7 +74,6 @@ public async Task PublishRelaxedSimdCoreClr(bool relaxedSimd) { Configuration config = Configuration.Debug; string relaxedSimdValue = relaxedSimd.ToString().ToLowerInvariant(); - // Relaxed SIMD is selected by the ReadyToRun compiler's instruction set. string extraProperties = $"{relaxedSimdValue}true"; ProjectInfo info = CopyTestAsset( config, diff --git a/src/tests/Directory.Build.targets b/src/tests/Directory.Build.targets index b658bb69f74388..d4c6040f3af8bf 100644 --- a/src/tests/Directory.Build.targets +++ b/src/tests/Directory.Build.targets @@ -294,8 +294,7 @@ - + true From 03aa29da272d1046bd545dd685776f3f72e17937 Mon Sep 17 00:00:00 2001 From: Larry Ewing Date: Fri, 6 Nov 2026 17:24:01 -0600 Subject: [PATCH 08/19] Compile CoreLib with relaxed SIMD in the browser HW-intrinsics leg The browser leg runs non-composite: CoreLib's R2R image is precompiled at build time while the tests are crossgen'd with --instruction-set:relaxed-simd, so the two images disagreed on RelaxedSimd.IsSupported. Let crossgen-corelib.proj add the instruction set when WasmEnableRelaxedSimd=true and pass it to the leg's runtime build. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- eng/pipelines/coreclr/hardware-intrinsics-wasm.yml | 2 ++ .../coreclr/templates/jit-hardware-intrinsics-wasm.yml | 5 ++++- src/coreclr/crossgen-corelib.proj | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/eng/pipelines/coreclr/hardware-intrinsics-wasm.yml b/eng/pipelines/coreclr/hardware-intrinsics-wasm.yml index 51061b8671af43..10f5ef8f5e300b 100644 --- a/eng/pipelines/coreclr/hardware-intrinsics-wasm.yml +++ b/eng/pipelines/coreclr/hardware-intrinsics-wasm.yml @@ -10,6 +10,7 @@ pr: include: - eng/pipelines/coreclr/hardware-intrinsics-wasm.yml - eng/pipelines/coreclr/templates/jit-hardware-intrinsics-wasm.yml + - src/coreclr/crossgen-corelib.proj - src/coreclr/jit/*wasm* - src/tests/Directory.Build.targets - src/tests/build.proj @@ -30,6 +31,7 @@ extends: parameters: platforms: - browser_wasm + extraBuildArgs: /p:WasmEnableRelaxedSimd=true testBuildArgs: '/p:WasmEnableRelaxedSimd=true -test:JIT/HardwareIntrinsics/HardwareIntrinsics_Wasm_r.csproj -test:JIT/HardwareIntrinsics/HardwareIntrinsics_Wasm_ro.csproj' - template: /eng/pipelines/coreclr/templates/jit-hardware-intrinsics-wasm.yml parameters: diff --git a/eng/pipelines/coreclr/templates/jit-hardware-intrinsics-wasm.yml b/eng/pipelines/coreclr/templates/jit-hardware-intrinsics-wasm.yml index a5759da9b09f8b..1e39547d2c672e 100644 --- a/eng/pipelines/coreclr/templates/jit-hardware-intrinsics-wasm.yml +++ b/eng/pipelines/coreclr/templates/jit-hardware-intrinsics-wasm.yml @@ -6,6 +6,9 @@ parameters: - name: compositeBuildMode type: boolean default: false + - name: extraBuildArgs + type: string + default: '' jobs: # Build CoreCLR + libraries for wasm, build the wasm HardwareIntrinsics tests, @@ -25,7 +28,7 @@ jobs: jobParameters: testGroup: outerloop nameSuffix: CoreCLR - buildArgs: -s clr+libs+packs -c $(_BuildConfig) /p:TestAssemblies=false + buildArgs: -s clr+libs+packs -c $(_BuildConfig) /p:TestAssemblies=false ${{ parameters.extraBuildArgs }} timeoutInMinutes: 180 postBuildSteps: - template: /eng/pipelines/common/templates/runtimes/build-runtime-tests-and-send-to-helix.yml diff --git a/src/coreclr/crossgen-corelib.proj b/src/coreclr/crossgen-corelib.proj index 9847370d584963..88263f8bb404a0 100644 --- a/src/coreclr/crossgen-corelib.proj +++ b/src/coreclr/crossgen-corelib.proj @@ -202,6 +202,9 @@ <_CoreLibCrossgen2ExtraArgs Include="--opt-cross-module:*" Condition="'$(PublishReadyToRunContainerFormat)' == 'wasm'" /> + + <_CoreLibCrossgen2ExtraArgs Include="--instruction-set:relaxed-simd" + Condition="'$(PublishReadyToRunContainerFormat)' == 'wasm' and '$(WasmEnableRelaxedSimd)' == 'true'" /> <_CoreLibCrossgen2ExtraArgs Include="@(WasmCoreClrFrameworkPInvokeModule->WithMetadataValue('Browser', 'true')->WithMetadataValue('PrebuiltR2RDirect', 'true')->'--directpinvoke:%(Identity)')" Condition="'$(PublishReadyToRunContainerFormat)' == 'wasm' and '$(TargetOS)' == 'browser'" /> <_CoreLibCrossgen2ExtraArgs Include="@(WasmCoreClrFrameworkPInvokeModule->WithMetadataValue('Wasi', 'true')->WithMetadataValue('PrebuiltR2RDirect', 'true')->'--directpinvoke:%(Identity)')" From 246d787e445105bd108fe378b922048d34c83406 Mon Sep 17 00:00:00 2001 From: Larry Ewing Date: Sun, 8 Nov 2026 15:28:44 -0600 Subject: [PATCH 09/19] Make relaxed SIMD a WASI compiler default and validate images against CoreLib - InstructionSetHelpers adds relaxed-simd to the default WASI instruction sets, so crossgen2 and ILC callers no longer pass it. - Add PublishReadyToRunInstructionSet, the ReadyToRun counterpart of IlcInstructionSet, and drop the WASI WasmEnableRelaxedSimd plumbing. Opt out with PublishReadyToRunInstructionSet=-relaxed-simd. - On wasm the runtime takes its instruction sets from CoreLib's ReadyToRun image and validates other images against them, instead of skipping the check. - WASI src/tests ReadyToRun run with an interpreted CoreLib (#134949), so they default to -relaxed-simd. - Remove WasiEnableCompositeR2R; PublishReadyToRunComposite is already required, so the host's composite link flags follow PublishReadyToRun. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- docs/workflow/building/coreclr/wasi-r2r.md | 4 ++-- .../coreclr/hardware-intrinsics-wasm.yml | 4 ++-- eng/testing/tests.wasi.targets | 4 ++-- src/coreclr/crossgen-corelib.proj | 6 +++--- src/coreclr/hosts/corerun/wasi_r2r_probe.hpp | 2 +- .../tools/Common/InstructionSetHelpers.cs | 5 +++++ src/coreclr/vm/codeman.h | 9 +++++++++ src/coreclr/vm/jitinterface.cpp | 6 ++++-- src/mono/wasi/build/WasiApp.CoreCLR.targets | 18 ++++-------------- .../Microsoft.NET.CrossGen.targets | 3 +++ src/tests/Directory.Build.targets | 9 +++++---- .../Wasm/RelaxedSimd/RelaxedSimdTests.cs | 1 - src/tests/build.proj | 2 +- 13 files changed, 41 insertions(+), 32 deletions(-) diff --git a/docs/workflow/building/coreclr/wasi-r2r.md b/docs/workflow/building/coreclr/wasi-r2r.md index 0823a9c428dfb5..491a3b4812e6dc 100644 --- a/docs/workflow/building/coreclr/wasi-r2r.md +++ b/docs/workflow/building/coreclr/wasi-r2r.md @@ -40,8 +40,8 @@ of the number of function definitions; table slots may contain duplicate or non- references. Non-composite R2R and `WasmSingleFileBundle` are not supported by this path. -`WasmEnableRelaxedSimd` (default `true`) compiles the composite with relaxed SIMD. Hosts without relaxed SIMD -fail to load it; publish with `-p:WasmEnableRelaxedSimd=false` for them. +Relaxed SIMD is a default WASI instruction set. Hosts without relaxed SIMD fail to load the composite; publish with +`-p:PublishReadyToRunInstructionSet=-relaxed-simd` for them. ## Runtime tests diff --git a/eng/pipelines/coreclr/hardware-intrinsics-wasm.yml b/eng/pipelines/coreclr/hardware-intrinsics-wasm.yml index 10f5ef8f5e300b..56f01ba152bdab 100644 --- a/eng/pipelines/coreclr/hardware-intrinsics-wasm.yml +++ b/eng/pipelines/coreclr/hardware-intrinsics-wasm.yml @@ -31,8 +31,8 @@ extends: parameters: platforms: - browser_wasm - extraBuildArgs: /p:WasmEnableRelaxedSimd=true - testBuildArgs: '/p:WasmEnableRelaxedSimd=true -test:JIT/HardwareIntrinsics/HardwareIntrinsics_Wasm_r.csproj -test:JIT/HardwareIntrinsics/HardwareIntrinsics_Wasm_ro.csproj' + extraBuildArgs: /p:PublishReadyToRunInstructionSet=relaxed-simd + testBuildArgs: '/p:PublishReadyToRunInstructionSet=relaxed-simd -test:JIT/HardwareIntrinsics/HardwareIntrinsics_Wasm_r.csproj -test:JIT/HardwareIntrinsics/HardwareIntrinsics_Wasm_ro.csproj' - template: /eng/pipelines/coreclr/templates/jit-hardware-intrinsics-wasm.yml parameters: platforms: diff --git a/eng/testing/tests.wasi.targets b/eng/testing/tests.wasi.targets index c99ee5e274a0d9..1880b3be3ad947 100644 --- a/eng/testing/tests.wasi.targets +++ b/eng/testing/tests.wasi.targets @@ -1,7 +1,7 @@ - + - true + true diff --git a/src/coreclr/crossgen-corelib.proj b/src/coreclr/crossgen-corelib.proj index 88263f8bb404a0..6cbe4f272f4a8a 100644 --- a/src/coreclr/crossgen-corelib.proj +++ b/src/coreclr/crossgen-corelib.proj @@ -202,9 +202,9 @@ <_CoreLibCrossgen2ExtraArgs Include="--opt-cross-module:*" Condition="'$(PublishReadyToRunContainerFormat)' == 'wasm'" /> - - <_CoreLibCrossgen2ExtraArgs Include="--instruction-set:relaxed-simd" - Condition="'$(PublishReadyToRunContainerFormat)' == 'wasm' and '$(WasmEnableRelaxedSimd)' == 'true'" /> + + <_CoreLibCrossgen2ExtraArgs Include="--instruction-set:$(PublishReadyToRunInstructionSet)" + Condition="'$(PublishReadyToRunInstructionSet)' != ''" /> <_CoreLibCrossgen2ExtraArgs Include="@(WasmCoreClrFrameworkPInvokeModule->WithMetadataValue('Browser', 'true')->WithMetadataValue('PrebuiltR2RDirect', 'true')->'--directpinvoke:%(Identity)')" Condition="'$(PublishReadyToRunContainerFormat)' == 'wasm' and '$(TargetOS)' == 'browser'" /> <_CoreLibCrossgen2ExtraArgs Include="@(WasmCoreClrFrameworkPInvokeModule->WithMetadataValue('Wasi', 'true')->WithMetadataValue('PrebuiltR2RDirect', 'true')->'--directpinvoke:%(Identity)')" diff --git a/src/coreclr/hosts/corerun/wasi_r2r_probe.hpp b/src/coreclr/hosts/corerun/wasi_r2r_probe.hpp index 234400c741e29a..15d1236a86e29a 100644 --- a/src/coreclr/hosts/corerun/wasi_r2r_probe.hpp +++ b/src/coreclr/hosts/corerun/wasi_r2r_probe.hpp @@ -6,7 +6,7 @@ // calls out to it to obtain the composite R2R webcil image and the per-assembly stubs. // // The in-tree WASI R2R composer populates the image when publishing. The host must be linked with the -// flags that supply a composite's imports -- see WasiEnableCompositeR2R in WasiApp.CoreCLR.targets. +// flags that supply a composite's imports (see WasiApp.CoreCLR.targets). // Without them this probe compiles but can never be satisfied. // // Requires corerun.hpp to be included first (for pal::try_map_file_readonly). Include exactly once per diff --git a/src/coreclr/tools/Common/InstructionSetHelpers.cs b/src/coreclr/tools/Common/InstructionSetHelpers.cs index 9933e6a3b53e63..ad2a7e0a3a7db4 100644 --- a/src/coreclr/tools/Common/InstructionSetHelpers.cs +++ b/src/coreclr/tools/Common/InstructionSetHelpers.cs @@ -93,6 +93,11 @@ public static InstructionSetSupport ConfigureInstructionSetSupport(string instru { instructionSetSupportBuilder.AddSupportedInstructionSet("base"); instructionSetSupportBuilder.AddSupportedInstructionSet("simd128"); + + if (targetOS == TargetOS.Wasi) + { + instructionSetSupportBuilder.AddSupportedInstructionSet("relaxed-simd"); + } } bool throttleAvx512 = false; diff --git a/src/coreclr/vm/codeman.h b/src/coreclr/vm/codeman.h index 4a4d294f12fa7a..23520f0e22636f 100644 --- a/src/coreclr/vm/codeman.h +++ b/src/coreclr/vm/codeman.h @@ -2341,6 +2341,15 @@ class EEJitManager final : public EECodeGenManager return m_CPUCompileFlags; } +#if defined(TARGET_WASM) && !defined(DACCESS_COMPILE) + // Wasm cannot detect instruction sets at run time; CoreLib's ReadyToRun image defines them. + void SetInstructionSetFromCoreLib(CORINFO_InstructionSet instructionSet) + { + LIMITED_METHOD_CONTRACT; + m_CPUCompileFlags.Set(instructionSet); + } +#endif + #if defined(TARGET_ARM64) inline bool UseScalableVectorT() { diff --git a/src/coreclr/vm/jitinterface.cpp b/src/coreclr/vm/jitinterface.cpp index b2b3d817900196..97f148eb7595c2 100644 --- a/src/coreclr/vm/jitinterface.cpp +++ b/src/coreclr/vm/jitinterface.cpp @@ -14639,9 +14639,11 @@ BOOL LoadDynamicInfoEntry(Module *currentModule, bool mustInstructionSetBeSupported = !!(instructionSetEncoded & 1); ReadyToRunInstructionSet instructionSet = (ReadyToRunInstructionSet)(instructionSetEncoded >> 1); #ifdef TARGET_WASM - // The wasm engine validated the instructions when it compiled the module. - if (mustInstructionSetBeSupported) + // Other images must match the instruction sets CoreLib was compiled for. + if (mustInstructionSetBeSupported && currentModule->IsSystem()) { + ExecutionManager::GetEEJitManager()->SetInstructionSetFromCoreLib(InstructionSetFromR2RInstructionSet(instructionSet)); + corjitFlags = ExecutionManager::GetEEJitManager()->GetCPUCompileFlags(); continue; } #endif // TARGET_WASM diff --git a/src/mono/wasi/build/WasiApp.CoreCLR.targets b/src/mono/wasi/build/WasiApp.CoreCLR.targets index b26735617f5806..f72bbda657bf99 100644 --- a/src/mono/wasi/build/WasiApp.CoreCLR.targets +++ b/src/mono/wasi/build/WasiApp.CoreCLR.targets @@ -72,16 +72,12 @@ wasihost corehost (libWasiHost.a) per-app through its own targets below. --> false false - - true wasm true $(PublishReadyToRunCrossgen2ExtraArgs);--opt-cross-module:* - $(PublishReadyToRunCrossgen2ExtraArgs);--instruction-set:relaxed-simd - true false @@ -96,8 +92,6 @@ Text="PublishReadyToRunContainerFormat '$(PublishReadyToRunContainerFormat)' is not supported for CoreCLR wasi-wasm; only 'wasm' is supported." /> - <_WasiRelinkOutput>$(_WasiRelinkObjDir)corerun <_WasiPublishedHost>$(WasmAppDir)managed\corerun - - false @@ -453,10 +443,10 @@ - <_WasiRelinkLinkFlags Include="-Wl,--table-base=$(WasiCompositeR2RTableBase)" Condition="'$(WasiEnableCompositeR2R)' == 'true'" /> - <_WasiRelinkLinkFlags Include="-Wl,--export-table" Condition="'$(WasiEnableCompositeR2R)' == 'true'" /> - <_WasiRelinkLinkFlags Include="-Wl,--export=__stack_pointer" Condition="'$(WasiEnableCompositeR2R)' == 'true'" /> - <_WasiRelinkLinkFlags Include="-Wl,--export=__coreclr_wasm_rtlrestorecontext_tag" Condition="'$(WasiEnableCompositeR2R)' == 'true'" /> + <_WasiRelinkLinkFlags Include="-Wl,--table-base=$(WasiCompositeR2RTableBase)" Condition="'$(PublishReadyToRun)' == 'true'" /> + <_WasiRelinkLinkFlags Include="-Wl,--export-table" Condition="'$(PublishReadyToRun)' == 'true'" /> + <_WasiRelinkLinkFlags Include="-Wl,--export=__stack_pointer" Condition="'$(PublishReadyToRun)' == 'true'" /> + <_WasiRelinkLinkFlags Include="-Wl,--export=__coreclr_wasm_rtlrestorecontext_tag" Condition="'$(PublishReadyToRun)' == 'true'" /> <_WasiRelinkLinkFlags Include="-fwasm-exceptions" /> <_WasiRelinkLinkFlags Include="-mllvm" /> <_WasiRelinkLinkFlags Include="-wasm-use-legacy-eh=false" /> diff --git a/src/tasks/Crossgen2Tasks/Microsoft.NET.CrossGen.targets b/src/tasks/Crossgen2Tasks/Microsoft.NET.CrossGen.targets index be51a722fc14ae..47500b8fe4d2c7 100644 --- a/src/tasks/Crossgen2Tasks/Microsoft.NET.CrossGen.targets +++ b/src/tasks/Crossgen2Tasks/Microsoft.NET.CrossGen.targets @@ -50,6 +50,9 @@ Copyright (c) .NET Foundation. All rights reserved. $(PublishReadyToRunCrossgen2ExtraArgs);--strip-debug-info $(PublishReadyToRunCrossgen2ExtraArgs);--strip-debug-info $(PublishReadyToRunCrossgen2ExtraArgs);--strip-debug-info + + + $(PublishReadyToRunCrossgen2ExtraArgs);--instruction-set:$(PublishReadyToRunInstructionSet) + - true + -relaxed-simd - - $(CrossGen2TestExtraArguments) --instruction-set:relaxed-simd + + $(CrossGen2TestExtraArguments) --instruction-set:$(PublishReadyToRunInstructionSet) !RelaxedSimd.IsSupported; [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/134949", typeof(TestLibrary.PlatformDetection), nameof(TestLibrary.PlatformDetection.IsWasi), nameof(TestLibrary.PlatformDetection.IsReadyToRunCompiled))] public static void RelaxedSimdIsSupportedReflects() { MethodInfo? methodInfo = typeof(RelaxedSimd).GetMethod("get_IsSupported"); diff --git a/src/tests/build.proj b/src/tests/build.proj index 522d5a7202e4ae..fedf0235f0fa8e 100644 --- a/src/tests/build.proj +++ b/src/tests/build.proj @@ -258,7 +258,7 @@ $(GroupBuildCmd) /p:ContinuousIntegrationBuild=true $(GroupBuildCmd) "/p:BuildTestsOnHelix=true" $(GroupBuildCmd) "/p:MonoForceInterpreter=true" - $(GroupBuildCmd) "/p:WasmEnableRelaxedSimd=$(WasmEnableRelaxedSimd)" + $(GroupBuildCmd) "/p:PublishReadyToRunInstructionSet=$(PublishReadyToRunInstructionSet)" $(GroupBuildCmd) "/p:RunAOTCompilation=true" $(GroupBuildCmd) "/p:DevTeamProvisioning=$(DevTeamProvisioning)" From 27c08856d4991202621ea6bd3c55e02c779df45a Mon Sep 17 00:00:00 2001 From: Larry Ewing Date: Sun, 8 Nov 2026 15:53:16 -0600 Subject: [PATCH 10/19] Run the wasm intrinsics library tests on WASI Add the WASI target framework to System.Runtime.Intrinsics.Tests and run PackedSimdTests and RelaxedSimdTests on WASI as well as browser, so the WASI library ReadyToRun lane exercises relaxed SIMD with CoreLib in the composite. Drop the tests.wasi.targets default; the substitutions it fed are not used on WASI. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- eng/testing/tests.wasi.targets | 5 ----- .../tests/System.Runtime.Intrinsics.Tests.csproj | 2 +- .../System.Runtime.Intrinsics/tests/Wasm/PackedSimdTests.cs | 2 +- .../System.Runtime.Intrinsics/tests/Wasm/RelaxedSimdTests.cs | 2 +- 4 files changed, 3 insertions(+), 8 deletions(-) diff --git a/eng/testing/tests.wasi.targets b/eng/testing/tests.wasi.targets index 1880b3be3ad947..bcc314bc7724ef 100644 --- a/eng/testing/tests.wasi.targets +++ b/eng/testing/tests.wasi.targets @@ -1,9 +1,4 @@ - - - true - - diff --git a/src/libraries/System.Runtime.Intrinsics/tests/System.Runtime.Intrinsics.Tests.csproj b/src/libraries/System.Runtime.Intrinsics/tests/System.Runtime.Intrinsics.Tests.csproj index 264b8039125d7a..d788d52bdc9bba 100644 --- a/src/libraries/System.Runtime.Intrinsics/tests/System.Runtime.Intrinsics.Tests.csproj +++ b/src/libraries/System.Runtime.Intrinsics/tests/System.Runtime.Intrinsics.Tests.csproj @@ -4,7 +4,7 @@ $(NoWarn),1718,SYSLIB0013 true true - $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-unix;$(NetCoreAppCurrent)-browser + $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-unix;$(NetCoreAppCurrent)-browser;$(NetCoreAppCurrent)-wasi true false diff --git a/src/libraries/System.Runtime.Intrinsics/tests/Wasm/PackedSimdTests.cs b/src/libraries/System.Runtime.Intrinsics/tests/Wasm/PackedSimdTests.cs index 1d8030ff35ab77..ac74ffffeb0891 100644 --- a/src/libraries/System.Runtime.Intrinsics/tests/Wasm/PackedSimdTests.cs +++ b/src/libraries/System.Runtime.Intrinsics/tests/Wasm/PackedSimdTests.cs @@ -13,7 +13,7 @@ namespace System.Runtime.Intrinsics.Wasm.Tests { - [PlatformSpecific(TestPlatforms.Browser)] + [PlatformSpecific(TestPlatforms.Browser | TestPlatforms.Wasi)] [ConditionalClass(typeof(PackedSimdTests), nameof(IsSupported))] public sealed class PackedSimdTests { diff --git a/src/libraries/System.Runtime.Intrinsics/tests/Wasm/RelaxedSimdTests.cs b/src/libraries/System.Runtime.Intrinsics/tests/Wasm/RelaxedSimdTests.cs index 39468eaa7452ea..533aad2bc7e986 100644 --- a/src/libraries/System.Runtime.Intrinsics/tests/Wasm/RelaxedSimdTests.cs +++ b/src/libraries/System.Runtime.Intrinsics/tests/Wasm/RelaxedSimdTests.cs @@ -8,7 +8,7 @@ namespace System.Runtime.Intrinsics.Wasm.Tests { - [PlatformSpecific(TestPlatforms.Browser)] + [PlatformSpecific(TestPlatforms.Browser | TestPlatforms.Wasi)] public sealed class RelaxedSimdTests { public static bool IsNotSupported => !RelaxedSimd.IsSupported; From 907eec7e1a4bff7e9c972ab431ede602276713e2 Mon Sep 17 00:00:00 2001 From: Larry Ewing Date: Wed, 11 Nov 2026 18:14:51 -0600 Subject: [PATCH 11/19] Run the WASI wasm intrinsics tests in whole-program composite mode The WASI hardware-intrinsics leg sets WholeProgramCompositeBuildMode, which compiles CoreLib into each test composite, so the tests are built with relaxed SIMD and the #134949 quarantines no longer apply there. Other WASI R2R runs keep the -relaxed-simd default and the quarantines. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- eng/pipelines/coreclr/hardware-intrinsics-wasm.yml | 5 +++-- .../coreclr/templates/jit-hardware-intrinsics-wasm.yml | 8 ++++---- src/tests/Common/CLRTest.Execute.Bash.targets | 3 +++ src/tests/Common/CoreCLRTestLibrary/PlatformDetection.cs | 3 +++ src/tests/Common/helixpublishwitharcade.proj | 2 ++ src/tests/Directory.Build.targets | 3 ++- .../HardwareIntrinsics/Wasm/PackedSimd/PackedSimdTests.cs | 4 ++-- 7 files changed, 19 insertions(+), 9 deletions(-) diff --git a/eng/pipelines/coreclr/hardware-intrinsics-wasm.yml b/eng/pipelines/coreclr/hardware-intrinsics-wasm.yml index 56f01ba152bdab..21042c818c3fd9 100644 --- a/eng/pipelines/coreclr/hardware-intrinsics-wasm.yml +++ b/eng/pipelines/coreclr/hardware-intrinsics-wasm.yml @@ -37,5 +37,6 @@ extends: parameters: platforms: - wasi_wasm - compositeBuildMode: true - testBuildArgs: '-test:JIT/HardwareIntrinsics/HardwareIntrinsics_Wasm_r.csproj -test:JIT/HardwareIntrinsics/HardwareIntrinsics_Wasm_ro.csproj' + # Compiles CoreLib into each test composite, so the tests can use relaxed SIMD. + extraHelixArguments: /p:WholeProgramCompositeBuildMode=true + testBuildArgs: '/p:PublishReadyToRunInstructionSet=relaxed-simd -test:JIT/HardwareIntrinsics/HardwareIntrinsics_Wasm_r.csproj -test:JIT/HardwareIntrinsics/HardwareIntrinsics_Wasm_ro.csproj' diff --git a/eng/pipelines/coreclr/templates/jit-hardware-intrinsics-wasm.yml b/eng/pipelines/coreclr/templates/jit-hardware-intrinsics-wasm.yml index 1e39547d2c672e..5ff4d8fdca3b2d 100644 --- a/eng/pipelines/coreclr/templates/jit-hardware-intrinsics-wasm.yml +++ b/eng/pipelines/coreclr/templates/jit-hardware-intrinsics-wasm.yml @@ -3,9 +3,9 @@ parameters: type: object - name: testBuildArgs type: string - - name: compositeBuildMode - type: boolean - default: false + - name: extraHelixArguments + type: string + default: '' - name: extraBuildArgs type: string default: '' @@ -38,7 +38,7 @@ jobs: testRunNamePrefixSuffix: CoreCLR_R2R # The CoreCLR interpreter does not implement Wasm SIMD; ReadyToRun code does. readyToRun: true - compositeBuildMode: ${{ parameters.compositeBuildMode }} + extraHelixArguments: ${{ parameters.extraHelixArguments }} extraVariablesTemplates: - template: /eng/pipelines/common/templates/runtimes/test-variables.yml parameters: diff --git a/src/tests/Common/CLRTest.Execute.Bash.targets b/src/tests/Common/CLRTest.Execute.Bash.targets index 194ec9d95e56c3..913eaf2d2e12cb 100644 --- a/src/tests/Common/CLRTest.Execute.Bash.targets +++ b/src/tests/Common/CLRTest.Execute.Bash.targets @@ -517,6 +517,9 @@ if [ ! -z ${RunCrossGen2+x} ] && [ "$(CrossGenTest)" != "false" ]; then # Keep the probe's stubs private to this host, so a subsequent interpreter run # cannot discover a composite that is not spliced into its own corerun. __WasiR2RArgs="--env TEST_READY_TO_RUN_MODE=1 --env APP_ASSEMBLIES=EXTERNAL --env CORE_LIBRARIES=/$__WasiCrossgen2OutputDirectory/wasi-r2r" + if [ ! -z ${WholeProgramCompositeBuildMode+x} ]; then + __WasiR2RArgs="$__WasiR2RArgs --env WholeProgramCompositeBuildMode" + fi fi ]]> diff --git a/src/tests/Common/CoreCLRTestLibrary/PlatformDetection.cs b/src/tests/Common/CoreCLRTestLibrary/PlatformDetection.cs index 88090f1a556415..76eb0feb28be78 100644 --- a/src/tests/Common/CoreCLRTestLibrary/PlatformDetection.cs +++ b/src/tests/Common/CoreCLRTestLibrary/PlatformDetection.cs @@ -113,6 +113,9 @@ public static bool IsMonoInterpreter public static bool IsWasm => IsBrowser || IsWasi; public static bool IsReadyToRunCompiled => Environment.GetEnvironmentVariable("TEST_READY_TO_RUN_MODE") == "1"; public static bool IsWasmReadyToRun => IsWasm && IsReadyToRunCompiled; + // The test assemblies and CoreLib were compiled into one composite image. + public static bool IsWholeProgramComposite => IsReadyToRunCompiled && Environment.GetEnvironmentVariable("WholeProgramCompositeBuildMode") is not null; + public static bool IsNotWholeProgramComposite => !IsWholeProgramComposite; // CoreCLR on WebAssembly (FEATURE_PORTABLE_ENTRYPOINTS) cannot create native-callable entrypoints at run time, // e.g. for Marshal.GetFunctionPointerForDelegate or a delegate passed to a P/Invoke. diff --git a/src/tests/Common/helixpublishwitharcade.proj b/src/tests/Common/helixpublishwitharcade.proj index 29950f2bf0f866..2d0ac96d344d6f 100644 --- a/src/tests/Common/helixpublishwitharcade.proj +++ b/src/tests/Common/helixpublishwitharcade.proj @@ -672,6 +672,7 @@ + @@ -728,6 +729,7 @@ + diff --git a/src/tests/Directory.Build.targets b/src/tests/Directory.Build.targets index f6a4bf3c9d8890..55afceabb74865 100644 --- a/src/tests/Directory.Build.targets +++ b/src/tests/Directory.Build.targets @@ -297,7 +297,8 @@ Condition="('$(TargetOS)' == 'browser' or '$(TargetOS)' == 'wasi') and '$(RuntimeFlavor)' == 'coreclr' and '$(TestBuildMode)' != 'nativeaot'" /> + only use the runtime's baseline instruction sets. Runs with WholeProgramCompositeBuildMode compile CoreLib into the + composite and can set PublishReadyToRunInstructionSet=relaxed-simd. --> -relaxed-simd diff --git a/src/tests/JIT/HardwareIntrinsics/Wasm/PackedSimd/PackedSimdTests.cs b/src/tests/JIT/HardwareIntrinsics/Wasm/PackedSimd/PackedSimdTests.cs index 5eca0fd9584b63..c4db4448e86235 100644 --- a/src/tests/JIT/HardwareIntrinsics/Wasm/PackedSimd/PackedSimdTests.cs +++ b/src/tests/JIT/HardwareIntrinsics/Wasm/PackedSimd/PackedSimdTests.cs @@ -13,7 +13,7 @@ public sealed class PackedSimdTests { [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/134949", typeof(TestLibrary.PlatformDetection), nameof(TestLibrary.PlatformDetection.IsWasi), nameof(TestLibrary.PlatformDetection.IsReadyToRunCompiled))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/134949", typeof(TestLibrary.PlatformDetection), nameof(TestLibrary.PlatformDetection.IsWasi), nameof(TestLibrary.PlatformDetection.IsReadyToRunCompiled), nameof(TestLibrary.PlatformDetection.IsNotWholeProgramComposite))] [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(PackedSimd))] public static unsafe void PackedSimdIsSupported() { @@ -1260,7 +1260,7 @@ public static unsafe void LoadScalarAndSplatTest() } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/134949", typeof(TestLibrary.PlatformDetection), nameof(TestLibrary.PlatformDetection.IsWasi), nameof(TestLibrary.PlatformDetection.IsReadyToRunCompiled))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/134949", typeof(TestLibrary.PlatformDetection), nameof(TestLibrary.PlatformDetection.IsWasi), nameof(TestLibrary.PlatformDetection.IsReadyToRunCompiled), nameof(TestLibrary.PlatformDetection.IsNotWholeProgramComposite))] public static unsafe void LoadStoreNullCheckTest() { if (!PackedSimd.IsSupported) From 68c3c1190ade497af33953785e9e3edd5e2e91c4 Mon Sep 17 00:00:00 2001 From: Larry Ewing Date: Wed, 11 Nov 2026 18:18:53 -0600 Subject: [PATCH 12/19] Clarify the WASI test instruction-set comment Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- src/tests/Directory.Build.targets | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/tests/Directory.Build.targets b/src/tests/Directory.Build.targets index 55afceabb74865..1d6935eac903b5 100644 --- a/src/tests/Directory.Build.targets +++ b/src/tests/Directory.Build.targets @@ -296,9 +296,8 @@ - + -relaxed-simd From f38c904f708bbfc98252dd6aec46f426675d29b5 Mon Sep 17 00:00:00 2001 From: Larry Ewing Date: Sat, 14 Nov 2026 13:37:00 -0600 Subject: [PATCH 13/19] Recompile ReadyToRun images when the instruction sets change WASI publishing records a hash of the crossgen2 arguments as an input of _CreateR2RImages and deletes stale images when it changes, as browser already does. CoreLib's crossgen step records PublishReadyToRunInstructionSet. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- src/coreclr/crossgen-corelib.proj | 11 ++++++++ src/mono/wasi/build/WasiApp.CoreCLR.targets | 28 +++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/src/coreclr/crossgen-corelib.proj b/src/coreclr/crossgen-corelib.proj index 6cbe4f272f4a8a..f45312f575b3ee 100644 --- a/src/coreclr/crossgen-corelib.proj +++ b/src/coreclr/crossgen-corelib.proj @@ -133,6 +133,16 @@ DependsOnTargets="ResolveProjectReferences;MergeMibcFiles" /> + + <_CoreLibInstructionSetStampFile>$(IntermediatesDir)System.Private.CoreLib.instruction-set.stamp + + + + + @@ -140,6 +150,7 @@ + diff --git a/src/mono/wasi/build/WasiApp.CoreCLR.targets b/src/mono/wasi/build/WasiApp.CoreCLR.targets index f72bbda657bf99..218e46111fd243 100644 --- a/src/mono/wasi/build/WasiApp.CoreCLR.targets +++ b/src/mono/wasi/build/WasiApp.CoreCLR.targets @@ -31,6 +31,34 @@ + + + + <_WasiReadyToRunStateHash>$([MSBuild]::StableStringHash('$(PublishReadyToRunCrossgen2ExtraArgs)', 'Sha256')) + <_WasiReadyToRunStateFile>$([MSBuild]::NormalizePath('$(IntermediateOutputPath)', 'R2R', 'wasi-r2r-state.stamp')) + <_WasiPreviousReadyToRunStateHash /> + + + + + + + + + + <_ReadyToRunCompilerInputs Include="$(_WasiReadyToRunStateFile)" /> + + + + - true + true false true false diff --git a/src/tests/build.proj b/src/tests/build.proj index fedf0235f0fa8e..888f0ef329e4b0 100644 --- a/src/tests/build.proj +++ b/src/tests/build.proj @@ -259,6 +259,7 @@ $(GroupBuildCmd) "/p:BuildTestsOnHelix=true" $(GroupBuildCmd) "/p:MonoForceInterpreter=true" $(GroupBuildCmd) "/p:PublishReadyToRunInstructionSet=$(PublishReadyToRunInstructionSet)" + $(GroupBuildCmd) "/p:IlcInstructionSet=$(IlcInstructionSet)" $(GroupBuildCmd) "/p:RunAOTCompilation=true" $(GroupBuildCmd) "/p:DevTeamProvisioning=$(DevTeamProvisioning)" From 8b54f697f8b929b5d12eb09de9250e1df683001c Mon Sep 17 00:00:00 2001 From: Larry Ewing Date: Sat, 14 Nov 2026 14:10:07 -0600 Subject: [PATCH 15/19] [wasm][coreclr] Replace WasmEnableRelaxedSimd with PublishReadyToRunInstructionSet Relaxed SIMD only affects ReadyToRun code, so browser opts in the same way as WASI: PublishReadyToRunInstructionSet=relaxed-simd. WasmEnableRelaxedSimd duplicated that and could disagree with it. - Drop -mrelaxed-simd, WASM_ENABLE_RELAXED_SIMD, the relink trigger and the workload requirement; no native code uses relaxed SIMD. - Always enable relaxed SIMD in wasm-opt, so the ReadyToRun wasm-opt pass accepts images built with it. Enabling a feature only allows it. - Stop folding IsSupported with trimmer substitutions on CoreCLR. The JIT and interpreter decide support per method, and measured on a trimmed WASI R2R app the folding saved about 2.7 KB of R2R code. Delete the relaxed SIMD substitution files. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- eng/native.wasm.targets | 2 -- eng/testing/tests.wasm.targets | 15 +++------------ .../tests/System.Runtime.Intrinsics.Tests.csproj | 2 +- .../browser/build/BrowserWasmApp.CoreCLR.targets | 12 ++++-------- .../ILLink.Substitutions.NoWasmRelaxedSimd.xml | 7 ------- .../ILLink.Substitutions.WasmRelaxedSimd.xml | 7 ------- ...ft.NET.Sdk.WebAssembly.Browser.CoreCLR.targets | 1 - .../WorkloadManifest.targets.in | 1 - .../Blazor/WorkloadRequiredTests.cs | 1 - .../CoreCLRWasmNativeDefaultsTests.cs | 2 -- src/mono/wasm/Wasm.Build.Tests/WasmSIMDTests.cs | 6 ++++-- .../Wasm/RelaxedSimd/RelaxedSimdTests_r.csproj | 1 - .../Wasm/RelaxedSimd/RelaxedSimdTests_ro.csproj | 1 - 13 files changed, 12 insertions(+), 46 deletions(-) delete mode 100644 src/mono/browser/build/ILLink.Substitutions.NoWasmRelaxedSimd.xml delete mode 100644 src/mono/browser/build/ILLink.Substitutions.WasmRelaxedSimd.xml diff --git a/eng/native.wasm.targets b/eng/native.wasm.targets index 0018a56403f0c7..0bf21780042ac4 100644 --- a/eng/native.wasm.targets +++ b/eng/native.wasm.targets @@ -58,14 +58,12 @@ false false false - false <_CoreCLRPropertyThatTriggersRelinking Include="InvariantGlobalization" RuntimePackValue="$(BrowserHostInvariantGlobalization)" /> <_CoreCLRPropertyThatTriggersRelinking Include="InvariantTimezone" RuntimePackValue="$(BrowserHostInvariantTimezone)" /> <_CoreCLRPropertyThatTriggersRelinking Include="EnableDiagnostics" RuntimePackValue="$(BrowserHostEnableDiagnostics)" /> - <_CoreCLRPropertyThatTriggersRelinking Include="WasmEnableRelaxedSimd" RuntimePackValue="$(BrowserHostEnableRelaxedSimd)" /> <_CoreCLRPropertyThatTriggersRelinking Include="WasmInitialHeapSize" RuntimePackValue="$(BrowserHostInitialHeapSize)" /> <_CoreCLRPropertyThatTriggersRelinking Include="EmccMaximumHeapSize" RuntimePackValue="$(BrowserHostMaximumHeapSize)" /> <_CoreCLRPropertyThatTriggersRelinking Include="EmccStackSize" RuntimePackValue="$(BrowserHostStackSize)" /> diff --git a/eng/testing/tests.wasm.targets b/eng/testing/tests.wasm.targets index 3baa68261cfb92..a19d9f98c62df6 100644 --- a/eng/testing/tests.wasm.targets +++ b/eng/testing/tests.wasm.targets @@ -87,19 +87,11 @@ So, set those parameters explicitly here. --> + <_WasmIntrinsicsSubstitutions Condition="'$(WasmEnableSIMD)' != 'false'">WasmIntrinsics <_WasmIntrinsicsSubstitutions Condition="'$(WasmEnableSIMD)' == 'false'">NoWasmIntrinsics - - <_WasmRelaxedSimdSubstitutions Condition="'$(WasmEnableSIMD)' != 'false' and '$(WasmEnableRelaxedSimd)' == 'true' and '$(RuntimeFlavor)' == 'CoreCLR'">WasmRelaxedSimd - <_WasmRelaxedSimdSubstitutions Condition="'$(WasmEnableSIMD)' != 'false' and '$(_WasmRelaxedSimdSubstitutions)' == ''">NoWasmRelaxedSimd - - <_WasmIntrinsicsSubstitutions Condition="'$(RuntimeFlavor)' == 'CoreCLR' and '$(PublishReadyToRun)' != 'true'">NoWasmIntrinsics - <_WasmRelaxedSimdSubstitutions Condition="'$(RuntimeFlavor)' == 'CoreCLR' and '$(PublishReadyToRun)' != 'true'"> - <_ExtraTrimmerArgs>$(_ExtraTrimmerArgs) --substitutions "$(BrowserProjectRoot)build\ILLink.Substitutions.$(_WasmIntrinsicsSubstitutions).xml" - <_ExtraTrimmerArgs Condition="'$(_WasmRelaxedSimdSubstitutions)' != ''">$(_ExtraTrimmerArgs) --substitutions "$(BrowserProjectRoot)build\ILLink.Substitutions.$(_WasmRelaxedSimdSubstitutions).xml" + <_ExtraTrimmerArgs Condition="'$(RuntimeFlavor)' != 'CoreCLR'">$(_ExtraTrimmerArgs) --substitutions "$(BrowserProjectRoot)build\ILLink.Substitutions.$(_WasmIntrinsicsSubstitutions).xml" @@ -170,7 +162,6 @@ <_WasmPropertyNames Include="WasmBuildNative" /> <_WasmPropertyNames Include="WasmDebugLevel" /> <_WasmPropertyNames Include="WasmDedup" /> - <_WasmPropertyNames Include="WasmEnableRelaxedSimd" /> <_WasmPropertyNames Include="WasmLinkIcalls" /> <_WasmPropertyNames Include="WasmNativeStrip" /> <_WasmPropertyNames Include="WasmNativeDebugSymbols" /> diff --git a/src/libraries/System.Runtime.Intrinsics/tests/System.Runtime.Intrinsics.Tests.csproj b/src/libraries/System.Runtime.Intrinsics/tests/System.Runtime.Intrinsics.Tests.csproj index d788d52bdc9bba..639e122cefb1ea 100644 --- a/src/libraries/System.Runtime.Intrinsics/tests/System.Runtime.Intrinsics.Tests.csproj +++ b/src/libraries/System.Runtime.Intrinsics/tests/System.Runtime.Intrinsics.Tests.csproj @@ -5,7 +5,7 @@ true true $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-unix;$(NetCoreAppCurrent)-browser;$(NetCoreAppCurrent)-wasi - true + relaxed-simd false $(Features.Replace('nullablePublicOnly', '') diff --git a/src/mono/browser/build/BrowserWasmApp.CoreCLR.targets b/src/mono/browser/build/BrowserWasmApp.CoreCLR.targets index 80f6c2ee1a79af..08843fadbcd0fc 100644 --- a/src/mono/browser/build/BrowserWasmApp.CoreCLR.targets +++ b/src/mono/browser/build/BrowserWasmApp.CoreCLR.targets @@ -39,11 +39,9 @@ <_CoreCLRInvalidSIMD Condition="'$(WasmEnableSIMD)' != '' and '$(WasmEnableSIMD)' != 'true'">true true true - false emcc <_WasmDefaultFlags>-fwasm-exceptions -sWASM_LEGACY_EXCEPTIONS=0 -msimd128 - <_WasmDefaultFlags Condition="'$(WasmEnableRelaxedSimd)' == 'true'">$(_WasmDefaultFlags) -mrelaxed-simd Build Publish @@ -127,11 +125,12 @@ - + <_WasmOptFeatureFlag Include="@(_WasmOptBaselineFeatureFlag)" /> - <_WasmOptFeatureFlag Include="--enable-relaxed-simd" Condition="'$(WasmEnableRelaxedSimd)' == 'true'" /> + <_WasmOptFeatureFlag Include="--enable-relaxed-simd" /> @@ -552,8 +551,6 @@ - - @@ -612,7 +609,6 @@ <_EmccCommonFlags Include="-fwasm-exceptions" /> <_EmccCommonFlags Include="-sWASM_LEGACY_EXCEPTIONS=0" /> <_EmccCommonFlags Include="-msimd128" /> - <_EmccCommonFlags Include="-mrelaxed-simd" Condition="'$(WasmEnableRelaxedSimd)' == 'true'" /> $(PublishReadyToRunCrossgen2ExtraArgs);--opt-cross-module:* - $(PublishReadyToRunCrossgen2ExtraArgs);--instruction-set:relaxed-simd <_WasmNativeWorkloadNeeded Condition=" '$(WasmEnableSIMD)' == 'false' or - '$(WasmEnableRelaxedSimd)' == 'true' or '$(WasmEnableExceptionHandling)' == 'false' or '$(InvariantTimezone)' == 'true' or '$(WasmNativeStrip)' == 'false' or diff --git a/src/mono/wasm/Wasm.Build.Tests/Blazor/WorkloadRequiredTests.cs b/src/mono/wasm/Wasm.Build.Tests/Blazor/WorkloadRequiredTests.cs index bf19729961dc31..9dbf10ac2a365e 100644 --- a/src/mono/wasm/Wasm.Build.Tests/Blazor/WorkloadRequiredTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/Blazor/WorkloadRequiredTests.cs @@ -23,7 +23,6 @@ public static (string propertyName, bool triggerValue)[] PropertiesWithTriggerVa { ("RunAOTCompilation", true), ("WasmEnableSIMD", false), - ("WasmEnableRelaxedSimd", true), ("WasmEnableExceptionHandling", false), ("InvariantTimezone", true), //("InvariantGlobalization", true), - not applicable for blazor diff --git a/src/mono/wasm/Wasm.Build.Tests/CoreCLRWasmNativeDefaultsTests.cs b/src/mono/wasm/Wasm.Build.Tests/CoreCLRWasmNativeDefaultsTests.cs index 8836129ed57410..ce46d88d8681f9 100644 --- a/src/mono/wasm/Wasm.Build.Tests/CoreCLRWasmNativeDefaultsTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/CoreCLRWasmNativeDefaultsTests.cs @@ -40,7 +40,6 @@ public CoreCLRWasmNativeDefaultsTests(ITestOutputHelper output, SharedBuildPerTe { "false", false }, { "false", false }, { "false", false }, - { "false", false }, // property left unset -> no relink { "", false }, // casing must not matter, MSBuild string comparison is case-insensitive @@ -49,7 +48,6 @@ public CoreCLRWasmNativeDefaultsTests(ITestOutputHelper output, SharedBuildPerTe { "true", true }, { "true", true }, { "true", true }, - { "true", true }, { "67108864", true }, // EmccInitialHeapSize is the documented browser property and EmccTotalMemory its legacy // alias; both must be normalized into WasmInitialHeapSize before the registry compares. diff --git a/src/mono/wasm/Wasm.Build.Tests/WasmSIMDTests.cs b/src/mono/wasm/Wasm.Build.Tests/WasmSIMDTests.cs index dd74400fdd2e5d..d9c556e28b6d91 100644 --- a/src/mono/wasm/Wasm.Build.Tests/WasmSIMDTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/WasmSIMDTests.cs @@ -74,7 +74,9 @@ public async Task PublishRelaxedSimdCoreClr(bool relaxedSimd) { Configuration config = Configuration.Debug; string relaxedSimdValue = relaxedSimd.ToString().ToLowerInvariant(); - string extraProperties = $"{relaxedSimdValue}true"; + string extraProperties = "true"; + if (relaxedSimd) + extraProperties += "relaxed-simd"; ProjectInfo info = CopyTestAsset( config, aot: false, @@ -86,7 +88,7 @@ public async Task PublishRelaxedSimdCoreClr(bool relaxedSimd) s_coreClrRelaxedSimdProgramText); ReplaceMainJsWithMinimalRunMain(); - PublishProject(info, config, isNativeBuild: relaxedSimd); + PublishProject(info, config, isNativeBuild: false); RunResult result = await RunForPublishWithWebServer(new BrowserRunOptions( config, diff --git a/src/tests/JIT/HardwareIntrinsics/Wasm/RelaxedSimd/RelaxedSimdTests_r.csproj b/src/tests/JIT/HardwareIntrinsics/Wasm/RelaxedSimd/RelaxedSimdTests_r.csproj index 07a855f245a73a..0da79aaa9de1e1 100644 --- a/src/tests/JIT/HardwareIntrinsics/Wasm/RelaxedSimd/RelaxedSimdTests_r.csproj +++ b/src/tests/JIT/HardwareIntrinsics/Wasm/RelaxedSimd/RelaxedSimdTests_r.csproj @@ -4,7 +4,6 @@ Embedded True true - true diff --git a/src/tests/JIT/HardwareIntrinsics/Wasm/RelaxedSimd/RelaxedSimdTests_ro.csproj b/src/tests/JIT/HardwareIntrinsics/Wasm/RelaxedSimd/RelaxedSimdTests_ro.csproj index 9035420319aa24..01547ec19ce0a0 100644 --- a/src/tests/JIT/HardwareIntrinsics/Wasm/RelaxedSimd/RelaxedSimdTests_ro.csproj +++ b/src/tests/JIT/HardwareIntrinsics/Wasm/RelaxedSimd/RelaxedSimdTests_ro.csproj @@ -4,7 +4,6 @@ Embedded true - true From 5c8595c43deeffa06209f0dc7db7dec797dc0f1f Mon Sep 17 00:00:00 2001 From: Larry Ewing Date: Sat, 14 Nov 2026 18:27:23 -0600 Subject: [PATCH 16/19] Remove the WASI-only R2R argument stamp and a misplaced comment Changing crossgen2 arguments doesn't recompile R2R images on any target, so the fix belongs in the common crossgen2 targets rather than WASI's. Also drop the instruction-set comment in crossgen-corelib.proj, per review. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- src/coreclr/crossgen-corelib.proj | 1 - src/mono/wasi/build/WasiApp.CoreCLR.targets | 28 --------------------- 2 files changed, 29 deletions(-) diff --git a/src/coreclr/crossgen-corelib.proj b/src/coreclr/crossgen-corelib.proj index f45312f575b3ee..4b6999cbb412d7 100644 --- a/src/coreclr/crossgen-corelib.proj +++ b/src/coreclr/crossgen-corelib.proj @@ -213,7 +213,6 @@ <_CoreLibCrossgen2ExtraArgs Include="--opt-cross-module:*" Condition="'$(PublishReadyToRunContainerFormat)' == 'wasm'" /> - <_CoreLibCrossgen2ExtraArgs Include="--instruction-set:$(PublishReadyToRunInstructionSet)" Condition="'$(PublishReadyToRunInstructionSet)' != ''" /> <_CoreLibCrossgen2ExtraArgs Include="@(WasmCoreClrFrameworkPInvokeModule->WithMetadataValue('Browser', 'true')->WithMetadataValue('PrebuiltR2RDirect', 'true')->'--directpinvoke:%(Identity)')" diff --git a/src/mono/wasi/build/WasiApp.CoreCLR.targets b/src/mono/wasi/build/WasiApp.CoreCLR.targets index 218e46111fd243..f72bbda657bf99 100644 --- a/src/mono/wasi/build/WasiApp.CoreCLR.targets +++ b/src/mono/wasi/build/WasiApp.CoreCLR.targets @@ -31,34 +31,6 @@ - - - - <_WasiReadyToRunStateHash>$([MSBuild]::StableStringHash('$(PublishReadyToRunCrossgen2ExtraArgs)', 'Sha256')) - <_WasiReadyToRunStateFile>$([MSBuild]::NormalizePath('$(IntermediateOutputPath)', 'R2R', 'wasi-r2r-state.stamp')) - <_WasiPreviousReadyToRunStateHash /> - - - - - - - - - - <_ReadyToRunCompilerInputs Include="$(_WasiReadyToRunStateFile)" /> - - - - + + + $(PublishReadyToRunCrossgen2ExtraArgs);--instruction-set:$(PublishReadyToRunInstructionSet) + + + + + + $(PublishReadyToRunCrossgen2ExtraArgs);--instruction-set:$(PublishReadyToRunInstructionSet) + + + From 99381dc596a0162224a2c1ddedcf9ae23355f447 Mon Sep 17 00:00:00 2001 From: Larry Ewing Date: Sat, 14 Nov 2026 20:03:32 -0600 Subject: [PATCH 18/19] Link the PublishReadyToRunInstructionSet fallback targets to #137571 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .../Microsoft.NET.Sdk.WebAssembly.Browser.CoreCLR.targets | 4 ++-- src/mono/wasi/build/WasiApp.CoreCLR.targets | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.CoreCLR.targets b/src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.CoreCLR.targets index 4ef1e9424c487b..f099e8c6fba453 100644 --- a/src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.CoreCLR.targets +++ b/src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.CoreCLR.targets @@ -44,8 +44,8 @@ Copyright (c) .NET Foundation. All rights reserved. $(PublishReadyToRunCrossgen2ExtraArgs);--opt-cross-module:* - + diff --git a/src/mono/wasi/build/WasiApp.CoreCLR.targets b/src/mono/wasi/build/WasiApp.CoreCLR.targets index 5e39c3dde8ac2a..4b3523eb7bf073 100644 --- a/src/mono/wasi/build/WasiApp.CoreCLR.targets +++ b/src/mono/wasi/build/WasiApp.CoreCLR.targets @@ -83,8 +83,8 @@ false - + From 9a7786e96058e729e44c1b1adc6a0c06b96352b3 Mon Sep 17 00:00:00 2001 From: Larry Ewing Date: Sat, 14 Nov 2026 21:28:19 -0600 Subject: [PATCH 19/19] [wasm] Quarantine relaxed SIMD WBT instead of overriding SDK crossgen targets Remove the fallback targets that mapped PublishReadyToRunInstructionSet for app publishes and disable the enabled case of PublishRelaxedSimdCoreClr against #137571 until an SDK with the mapping flows. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- ...soft.NET.Sdk.WebAssembly.Browser.CoreCLR.targets | 10 ---------- src/mono/wasi/build/WasiApp.CoreCLR.targets | 10 ---------- src/mono/wasm/Wasm.Build.Tests/WasmSIMDTests.cs | 13 +++++++++---- 3 files changed, 9 insertions(+), 24 deletions(-) diff --git a/src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.CoreCLR.targets b/src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.CoreCLR.targets index f099e8c6fba453..51666998b2d5e9 100644 --- a/src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.CoreCLR.targets +++ b/src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.CoreCLR.targets @@ -44,16 +44,6 @@ Copyright (c) .NET Foundation. All rights reserved. $(PublishReadyToRunCrossgen2ExtraArgs);--opt-cross-module:* - - - - $(PublishReadyToRunCrossgen2ExtraArgs);--instruction-set:$(PublishReadyToRunInstructionSet) - - - - - - $(PublishReadyToRunCrossgen2ExtraArgs);--instruction-set:$(PublishReadyToRunInstructionSet) - - - diff --git a/src/mono/wasm/Wasm.Build.Tests/WasmSIMDTests.cs b/src/mono/wasm/Wasm.Build.Tests/WasmSIMDTests.cs index d9c556e28b6d91..0cfaaf259e2a41 100644 --- a/src/mono/wasm/Wasm.Build.Tests/WasmSIMDTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/WasmSIMDTests.cs @@ -66,11 +66,16 @@ public async Task PublishSIMD_AOT(Configuration config, bool aot, bool simd) Assert.Contains(result.TestOutput, m => m.Contains("Hello, World!")); } - [Theory] - [InlineData(false)] - [InlineData(true)] + [Fact] + [TestCategory("coreclr"), TestCategory("wasm-opt")] + public Task PublishRelaxedSimdCoreClr() => PublishRelaxedSimdCoreClrCore(relaxedSimd: false); + + [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/137571")] [TestCategory("coreclr"), TestCategory("wasm-opt")] - public async Task PublishRelaxedSimdCoreClr(bool relaxedSimd) + public Task PublishRelaxedSimdEnabledCoreClr() => PublishRelaxedSimdCoreClrCore(relaxedSimd: true); + + private async Task PublishRelaxedSimdCoreClrCore(bool relaxedSimd) { Configuration config = Configuration.Debug; string relaxedSimdValue = relaxedSimd.ToString().ToLowerInvariant();