From 55ce15de74fca5e943f7418f205da9435d3f110d Mon Sep 17 00:00:00 2001 From: yowl00 Date: Sat, 7 Dec 2024 16:22:46 -0500 Subject: [PATCH 01/59] use same upstream macro for wasm threads --- src/coreclr/gc/gcpriv.h | 2 +- src/coreclr/nativeaot/Runtime/GCHelpers.cpp | 4 ++-- src/coreclr/nativeaot/Runtime/unix/PalRedhawkUnix.cpp | 2 +- src/coreclr/nativeaot/Runtime/wasm/AllocFast.cpp | 4 ++-- src/coreclr/nativeaot/Runtime/wasm/PalRedhawkWasm.cpp | 4 ++-- src/coreclr/nativeaot/Runtime/wasm/PalRedhawkWasm.h | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/coreclr/gc/gcpriv.h b/src/coreclr/gc/gcpriv.h index 7208e41437b7..641201e4d496 100644 --- a/src/coreclr/gc/gcpriv.h +++ b/src/coreclr/gc/gcpriv.h @@ -188,7 +188,7 @@ inline void FATAL_GC_ERROR() #define FEATURE_PREMORTEM_FINALIZATION #define GC_HISTORY -#if !defined(TARGET_WASM) || defined(FEATURE_WASM_THREADS) +#if !defined(TARGET_WASM) || defined(FEATURE_WASM_MANAGED_THREADS) #define BACKGROUND_GC //concurrent background GC (requires WRITE_WATCH) #endif diff --git a/src/coreclr/nativeaot/Runtime/GCHelpers.cpp b/src/coreclr/nativeaot/Runtime/GCHelpers.cpp index e2fc46b809d6..71156cbf5605 100644 --- a/src/coreclr/nativeaot/Runtime/GCHelpers.cpp +++ b/src/coreclr/nativeaot/Runtime/GCHelpers.cpp @@ -36,7 +36,7 @@ GPTR_DECL(MethodTable, g_pFreeObjectEEType); GPTR_IMPL(Thread, g_pFinalizerThread); -#if defined(HOST_WASM) && !defined(FEATURE_WASM_THREADS) +#if defined(HOST_WASM) && !defined(FEATURE_WASM_MANAGED_THREADS) void FinalizeFinalizableObjects(); #endif @@ -113,7 +113,7 @@ EXTERN_C void QCALLTYPE RhpCollect(uint32_t uGeneration, uint32_t uMode, UInt32_ pCurThread->EnablePreemptiveMode(); -#if defined(HOST_WASM) && !defined(FEATURE_WASM_THREADS) +#if defined(HOST_WASM) && !defined(FEATURE_WASM_MANAGED_THREADS) FinalizeFinalizableObjects(); #endif } diff --git a/src/coreclr/nativeaot/Runtime/unix/PalRedhawkUnix.cpp b/src/coreclr/nativeaot/Runtime/unix/PalRedhawkUnix.cpp index 6e8f9d1aba97..1d63ea1cdcd7 100644 --- a/src/coreclr/nativeaot/Runtime/unix/PalRedhawkUnix.cpp +++ b/src/coreclr/nativeaot/Runtime/unix/PalRedhawkUnix.cpp @@ -1213,7 +1213,7 @@ REDHAWK_PALEXPORT bool PalGetMaximumStackBounds(_Out_ void** ppStackLowOut, _Out { if (pStackHighOut == NULL) { -#if defined(HOST_WASM) && !defined(FEATURE_WASM_THREADS) +#if defined(HOST_WASM) && !defined(FEATURE_WASM_MANAGED_THREADS) PalGetMaximumStackBounds_SingleThreadedWasm(&pStackLowOut, &pStackHighOut); #elif defined(__APPLE__) // This is a Mac specific method diff --git a/src/coreclr/nativeaot/Runtime/wasm/AllocFast.cpp b/src/coreclr/nativeaot/Runtime/wasm/AllocFast.cpp index 563bf1337f09..ccf690d80d13 100644 --- a/src/coreclr/nativeaot/Runtime/wasm/AllocFast.cpp +++ b/src/coreclr/nativeaot/Runtime/wasm/AllocFast.cpp @@ -47,7 +47,7 @@ static Object* AllocateObject(void* pShadowStack, MethodTable* pEEType, uint32_t pThread->SetShadowStackTop(pShadowStack); Object* obj = (Object*)RhpGcAlloc(pEEType, uFlags, numElements, &frame); -#ifndef FEATURE_WASM_THREADS +#ifndef FEATURE_WASM_MANAGED_THREADS if (g_FinalizationRequestPending) { GCFrameRegistration gc; // GC-protect our exposed object. @@ -70,7 +70,7 @@ static Object* AllocateObject(void* pShadowStack, MethodTable* pEEType, uint32_t pThread->PopGCFrameRegistration(&gc); } } -#endif // !FEATURE_WASM_THREADS +#endif // !FEATURE_WASM_MANAGED_THREADS if (obj == nullptr) { diff --git a/src/coreclr/nativeaot/Runtime/wasm/PalRedhawkWasm.cpp b/src/coreclr/nativeaot/Runtime/wasm/PalRedhawkWasm.cpp index 2d8dbb2ca268..a210ddaa4245 100644 --- a/src/coreclr/nativeaot/Runtime/wasm/PalRedhawkWasm.cpp +++ b/src/coreclr/nativeaot/Runtime/wasm/PalRedhawkWasm.cpp @@ -19,7 +19,7 @@ #define MEM_COMMIT 0x1000 #define MEM_RELEASE 0x8000 -#ifndef FEATURE_WASM_THREADS +#ifndef FEATURE_WASM_MANAGED_THREADS // // Note that we return the native stack bounds here, not shadow stack ones. Currently this functionality is mainly // used for RuntimeHelpers.TryEnsureSufficientExecutionStack, and we do use the native stack in codegen, so this @@ -189,7 +189,7 @@ extern "C" int __cxa_thread_atexit(Dtor dtor, void* obj, void*) return 0; } #endif // TARGET_WASI -#endif // !FEATURE_WASM_THREADS +#endif // !FEATURE_WASM_MANAGED_THREADS // Recall that WASM's model is extremely simple: we have one linear memory, which can only be grown, in chunks // of 64K pages. Thus, "mmap"/"munmap" fundamentally cannot be faithfully recreated and the Unix emulators we diff --git a/src/coreclr/nativeaot/Runtime/wasm/PalRedhawkWasm.h b/src/coreclr/nativeaot/Runtime/wasm/PalRedhawkWasm.h index f15dc7604b6e..3030a582b58a 100644 --- a/src/coreclr/nativeaot/Runtime/wasm/PalRedhawkWasm.h +++ b/src/coreclr/nativeaot/Runtime/wasm/PalRedhawkWasm.h @@ -1,6 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -#ifndef FEATURE_WASM_THREADS +#ifndef FEATURE_WASM_MANAGED_THREADS void PalGetMaximumStackBounds_SingleThreadedWasm(void** ppStackLowOut, void** ppStackHighOut); -#endif // !FEATURE_WASM_THREADS +#endif // !FEATURE_WASM_MANAGED_THREADS From 6e8d5cf4ec39b40aae236ba0c751c98b73dac91b Mon Sep 17 00:00:00 2001 From: "scott.waye@hubse.com" Date: Mon, 24 Mar 2025 10:45:33 -0500 Subject: [PATCH 02/59] enable threads nativeoat --- .../System.Private.CoreLib/src/System.Private.CoreLib.csproj | 4 ++++ .../src/System/Threading/Monitor.NativeAot.cs | 2 ++ .../src/System.Private.CoreLib.Shared.projitems | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System.Private.CoreLib.csproj b/src/coreclr/nativeaot/System.Private.CoreLib/src/System.Private.CoreLib.csproj index 2607031c327f..d0a025fd3792 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System.Private.CoreLib.csproj +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System.Private.CoreLib.csproj @@ -36,6 +36,10 @@ true true + true + true + $(DefineConstants);FEATURE_WASM_MANAGED_THREADS + $(DefineConstants);FEATURE_WASM_PERFTRACING true diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/Monitor.NativeAot.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/Monitor.NativeAot.cs index bed275c1ea99..8f3c2c23246c 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/Monitor.NativeAot.cs +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/Monitor.NativeAot.cs @@ -143,7 +143,9 @@ public static bool IsEntered(object obj) #region Public Wait/Pulse methods +#if !FEATURE_WASM_MANAGED_THREADS [UnsupportedOSPlatform("browser")] +#endif public static bool Wait(object obj, int millisecondsTimeout) { return GetCondition(obj).Wait(millisecondsTimeout, obj); diff --git a/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems b/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems index f2923753ea22..fc8b0e43b255 100644 --- a/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems +++ b/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems @@ -2725,7 +2725,7 @@ - + From 34619490d5fd09e8b1a978a138c3a6527fcae9f5 Mon Sep 17 00:00:00 2001 From: "scott.waye@hubse.com" Date: Sat, 29 Mar 2025 20:51:42 -0500 Subject: [PATCH 03/59] packaage name --- eng/native/gen-buildsys.cmd | 4 ++-- src/installer/pkg/projects/host-packages.proj | 2 +- src/installer/pkg/projects/nativeaot-packages.proj | 3 ++- .../Microsoft.NETCore.App.Runtime.NativeAOT.sfxproj | 3 +++ src/native/external/zlib-ng.cmake | 6 ++++-- 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/eng/native/gen-buildsys.cmd b/eng/native/gen-buildsys.cmd index b78a073c8c11..23d9861bdb41 100644 --- a/eng/native/gen-buildsys.cmd +++ b/eng/native/gen-buildsys.cmd @@ -65,7 +65,7 @@ if /i "%__Arch%" == "wasm" ( set "WASI_SDK_PATH=!WASI_SDK_PATH:\=/!" if not "!WASI_SDK_PATH:~-1!" == "/" set "WASI_SDK_PATH=!WASI_SDK_PATH!/" set __CmakeGenerator=Ninja - set __ExtraCmakeParams=%__ExtraCmakeParams% -DCLR_CMAKE_TARGET_OS=wasi -DCLR_CMAKE_TARGET_ARCH=wasm "-DWASI_SDK_PREFIX=!WASI_SDK_PATH!" "-DCMAKE_TOOLCHAIN_FILE=!WASI_SDK_PATH!/share/cmake/wasi-sdk-p2.cmake" "-DCMAKE_SYSROOT=!WASI_SDK_PATH!share/wasi-sysroot" "-DCMAKE_CROSSCOMPILING_EMULATOR=node --experimental-wasm-bigint --experimental-wasi-unstable-preview1" + set __ExtraCmakeParams=%__ExtraCmakeParams% -DCLR_CMAKE_TARGET_OS=wasi -DCLR_CMAKE_TARGET_ARCH=wasm "-DWASI_SDK_PREFIX=!WASI_SDK_PATH!" "-DCMAKE_TOOLCHAIN_FILE=!WASI_SDK_PATH!/share/cmake/wasi-sdk-p2.cmake" "-DCMAKE_SYSROOT=!WASI_SDK_PATH!share/wasi-sysroot" "-DCMAKE_CROSSCOMPILING_EMULATOR=node --experimental-wasm-bigint --experimental-wasi-unstable-preview1 -D_WASI_EMULATED_PTHREAD" ) ) else ( set __ExtraCmakeParams=%__ExtraCmakeParams% "-DCMAKE_SYSTEM_VERSION=10.0" @@ -102,7 +102,7 @@ if not "%__ConfigureOnly%" == "1" ( if /i "%__UseEmcmake%" == "1" ( call "!EMSDK!/emsdk_env" > nul 2>&1 && emcmake "%CMakePath%" %__ExtraCmakeParams% --no-warn-unused-cli -G "%__CmakeGenerator%" -B %__IntermediatesDir% -S %__SourceDir% ) else ( - "%CMakePath%" %__ExtraCmakeParams% --no-warn-unused-cli -G "%__CmakeGenerator%" -B %__IntermediatesDir% -S %__SourceDir% + "%CMakePath%" --trace-source=zlib-ng.cmake %__ExtraCmakeParams% --no-warn-unused-cli -G "%__CmakeGenerator%" -B %__IntermediatesDir% -S %__SourceDir% ) if "%errorlevel%" == "0" ( diff --git a/src/installer/pkg/projects/host-packages.proj b/src/installer/pkg/projects/host-packages.proj index 71469d32d649..657bc8194286 100644 --- a/src/installer/pkg/projects/host-packages.proj +++ b/src/installer/pkg/projects/host-packages.proj @@ -1,6 +1,6 @@ - + diff --git a/src/installer/pkg/projects/nativeaot-packages.proj b/src/installer/pkg/projects/nativeaot-packages.proj index 8a640a9c08c0..0a1404df62c1 100644 --- a/src/installer/pkg/projects/nativeaot-packages.proj +++ b/src/installer/pkg/projects/nativeaot-packages.proj @@ -4,7 +4,8 @@ - + + diff --git a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.NativeAOT.sfxproj b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.NativeAOT.sfxproj index 34587e9fa806..4c8bb638d2a7 100644 --- a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.NativeAOT.sfxproj +++ b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.NativeAOT.sfxproj @@ -24,6 +24,9 @@ Condition="Exists('$(CoreCLRArtifactsPath)StandardOptimizationData.mibc')" /> + + multithread + diff --git a/src/native/external/zlib-ng.cmake b/src/native/external/zlib-ng.cmake index b2338d682e14..0049a1041804 100644 --- a/src/native/external/zlib-ng.cmake +++ b/src/native/external/zlib-ng.cmake @@ -26,8 +26,10 @@ if (CLR_CMAKE_TARGET_BROWSER OR CLR_CMAKE_TARGET_WASI) # zlib-ng uses atomics, so we need to enable threads when requested for browser/wasi, otherwise the wasm target won't have thread support. if (CMAKE_USE_PTHREADS) - add_compile_options(-pthread) - add_linker_flag(-pthread) + #add_compile_options(-pthread) + #add_linker_flag(-pthread) + add_compile_options(-D_WASI_EMULATED_PTHREAD ) + add_linker_flag(-Wl,-lwasi-emulated-pthread) endif() endif() From 556ce1cdc7ca4b35d17f666dc89df80a40eef0e8 Mon Sep 17 00:00:00 2001 From: "scott.waye@hubse.com" Date: Sat, 29 Mar 2025 21:00:22 -0500 Subject: [PATCH 04/59] revert some tests --- src/installer/pkg/projects/host-packages.proj | 2 +- .../Microsoft.NETCore.App.Runtime.NativeAOT.sfxproj | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/installer/pkg/projects/host-packages.proj b/src/installer/pkg/projects/host-packages.proj index 657bc8194286..71469d32d649 100644 --- a/src/installer/pkg/projects/host-packages.proj +++ b/src/installer/pkg/projects/host-packages.proj @@ -1,6 +1,6 @@ - + diff --git a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.NativeAOT.sfxproj b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.NativeAOT.sfxproj index 4c8bb638d2a7..34587e9fa806 100644 --- a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.NativeAOT.sfxproj +++ b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.NativeAOT.sfxproj @@ -24,9 +24,6 @@ Condition="Exists('$(CoreCLRArtifactsPath)StandardOptimizationData.mibc')" /> - - multithread - From ec558b6cd0746ac2258fee43132f3b25eb3028a1 Mon Sep 17 00:00:00 2001 From: "scott.waye@hubse.com" Date: Sat, 12 Apr 2025 07:42:56 -0500 Subject: [PATCH 05/59] add multithread step --- eng/pipelines/common/global-build-job.yml | 2 +- eng/pipelines/common/platform-matrix.yml | 23 +++++++++++++++++++++++ eng/pipelines/runtimelab.yml | 2 ++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/eng/pipelines/common/global-build-job.yml b/eng/pipelines/common/global-build-job.yml index abe13f65b536..6799bc57bb3a 100644 --- a/eng/pipelines/common/global-build-job.yml +++ b/eng/pipelines/common/global-build-job.yml @@ -219,7 +219,7 @@ jobs: - script: pwsh $(Build.SourcesDirectory)/eng/pipelines/runtimelab/install-nodejs.ps1 $(Build.SourcesDirectory)/wasm-tools displayName: Install NodeJS - - ${{ if and(eq(parameters.runtimeFlavor, 'coreclr'), or(eq(parameters.platform, 'wasi_wasm_win'), eq(parameters.platform, 'wasi_wasm_linux_x64_naot_llvm'))) }}: + - ${{ if and(eq(parameters.runtimeFlavor, 'coreclr'), in(parameters.platform, 'wasi_wasm_win', 'wasi_wasm_linux_x64_naot_llvm', 'wasi_multithread_wasm_win'))) }}: # Install Wasi Wasm dependencies: wasi-sdk, wasmtime - script: pwsh $(Build.SourcesDirectory)/eng/pipelines/runtimelab/install-wasi-sdk.ps1 -CI -InstallDir $(Build.SourcesDirectory)/wasm-tools displayName: Install wasi-sdk diff --git a/eng/pipelines/common/platform-matrix.yml b/eng/pipelines/common/platform-matrix.yml index 1c34c26eecdb..8765cae72f42 100644 --- a/eng/pipelines/common/platform-matrix.yml +++ b/eng/pipelines/common/platform-matrix.yml @@ -500,6 +500,29 @@ jobs: buildConfig: ${{ parameters.buildConfig }} ${{ insert }}: ${{ parameters.jobParameters }} +- ${{ if containsValue(parameters.platforms, 'wasi_multithread_wasm_win') }}: + - template: xplat-setup.yml + parameters: + jobTemplate: ${{ parameters.jobTemplate }} + helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} + variables: ${{ parameters.variables }} + osGroup: wasi + archType: wasm + targetRid: wasi-wasm + platform: wasi_wasm_win + shouldContinueOnError: ${{ parameters.shouldContinueOnError }} + jobParameters: + hostedOs: windows + runtimeFlavor: ${{ parameters.runtimeFlavor }} + stagedBuild: ${{ parameters.stagedBuild }} + buildConfig: ${{ parameters.buildConfig }} + # Turn on threads by adding to the buildArgs + ${{ each param in parameters.jobParameters }}: + ${{ each pair in param }}: + ${{ if ne(pair.key, 'buildArgs') }}: + ${{ pair.key }}: ${{ pair.value }} + buildArgs: ${{ buildArgs }} '/p:WasmEnableThreads=true' + # Browser WebAssembly Linux X64 for NAOT-LLVM # Use a different name to differentiate from upstream as we need the -sanitizer image to get build tools that are not present in the stock browser_wasm image. diff --git a/eng/pipelines/runtimelab.yml b/eng/pipelines/runtimelab.yml index cf88871b348c..b856fd960153 100644 --- a/eng/pipelines/runtimelab.yml +++ b/eng/pipelines/runtimelab.yml @@ -61,6 +61,7 @@ extends: - windows_x64 - browser_wasm_win - wasi_wasm_win + - wasi_multithread_wasm_win - Browser_wasm_linux_x64_naot_llvm - wasi_wasm_linux_x64_naot_llvm jobParameters: @@ -103,6 +104,7 @@ extends: - windows_x64 - Browser_wasm_win - wasi_wasm_win + - wasi_multithread_wasm_win - wasi_wasm_linux_x64_naot_llvm - Browser_wasm_linux_x64_naot_llvm jobParameters: From c6ccccb9f13cdd26f31b153befdb9f82fc927cf4 Mon Sep 17 00:00:00 2001 From: "scott.waye@hubse.com" Date: Sat, 12 Apr 2025 07:45:50 -0500 Subject: [PATCH 06/59] yaml --- eng/pipelines/common/platform-matrix.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/eng/pipelines/common/platform-matrix.yml b/eng/pipelines/common/platform-matrix.yml index 8765cae72f42..ef0fe1a1a437 100644 --- a/eng/pipelines/common/platform-matrix.yml +++ b/eng/pipelines/common/platform-matrix.yml @@ -517,11 +517,11 @@ jobs: stagedBuild: ${{ parameters.stagedBuild }} buildConfig: ${{ parameters.buildConfig }} # Turn on threads by adding to the buildArgs - ${{ each param in parameters.jobParameters }}: - ${{ each pair in param }}: - ${{ if ne(pair.key, 'buildArgs') }}: - ${{ pair.key }}: ${{ pair.value }} - buildArgs: ${{ buildArgs }} '/p:WasmEnableThreads=true' +# ${{ each param in parameters.jobParameters }}: +# ${{ each pair in param }}: +# ${{ if ne(pair.key, 'buildArgs') }}: +# ${{ pair.key }}: ${{ pair.value }} + # buildArgs: ${{ buildArgs }} '/p:WasmEnableThreads=true' # Browser WebAssembly Linux X64 for NAOT-LLVM # Use a different name to differentiate from upstream as we need the -sanitizer image to get build tools that are not present in the stock browser_wasm image. From 3412fc6bd10d54a57a8dadc50cc4b790add55fc3 Mon Sep 17 00:00:00 2001 From: "scott.waye@hubse.com" Date: Sat, 12 Apr 2025 07:50:42 -0500 Subject: [PATCH 07/59] yaml --- eng/pipelines/common/global-build-job.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/pipelines/common/global-build-job.yml b/eng/pipelines/common/global-build-job.yml index 6799bc57bb3a..560096f9400f 100644 --- a/eng/pipelines/common/global-build-job.yml +++ b/eng/pipelines/common/global-build-job.yml @@ -219,7 +219,7 @@ jobs: - script: pwsh $(Build.SourcesDirectory)/eng/pipelines/runtimelab/install-nodejs.ps1 $(Build.SourcesDirectory)/wasm-tools displayName: Install NodeJS - - ${{ if and(eq(parameters.runtimeFlavor, 'coreclr'), in(parameters.platform, 'wasi_wasm_win', 'wasi_wasm_linux_x64_naot_llvm', 'wasi_multithread_wasm_win'))) }}: + - ${{ if and(eq(parameters.runtimeFlavor, 'coreclr'), in(parameters.platform, 'wasi_wasm_win', 'wasi_wasm_linux_x64_naot_llvm', 'wasi_multithread_wasm_win')) }}: # Install Wasi Wasm dependencies: wasi-sdk, wasmtime - script: pwsh $(Build.SourcesDirectory)/eng/pipelines/runtimelab/install-wasi-sdk.ps1 -CI -InstallDir $(Build.SourcesDirectory)/wasm-tools displayName: Install wasi-sdk @@ -228,7 +228,7 @@ jobs: - script: pwsh $(Build.SourcesDirectory)/eng/pipelines/runtimelab/install-jco.ps1 $(Build.SourcesDirectory) displayName: Install Jco - - ${{ if or(eq(parameters.platform, 'browser_wasm_win'), and(eq(parameters.platform, 'wasi_wasm_win'), not(eq(parameters.runtimeFlavor, 'coreclr')))) }}: + - ${{ if or(eq(parameters.platform, 'browser_wasm_win'), and(in(parameters.platform, 'wasi_wasm_win', 'wasi_multithread_wasm_win'), not(eq(parameters.runtimeFlavor, 'coreclr'))) }}: # Update machine certs - task: PowerShell@2 displayName: Update machine certs From dedeba87c89af3352d9dcc11c85e7137659b555f Mon Sep 17 00:00:00 2001 From: "scott.waye@hubse.com" Date: Sat, 12 Apr 2025 07:57:10 -0500 Subject: [PATCH 08/59] yaml --- eng/pipelines/common/global-build-job.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/common/global-build-job.yml b/eng/pipelines/common/global-build-job.yml index 560096f9400f..161efb15b2c2 100644 --- a/eng/pipelines/common/global-build-job.yml +++ b/eng/pipelines/common/global-build-job.yml @@ -228,7 +228,7 @@ jobs: - script: pwsh $(Build.SourcesDirectory)/eng/pipelines/runtimelab/install-jco.ps1 $(Build.SourcesDirectory) displayName: Install Jco - - ${{ if or(eq(parameters.platform, 'browser_wasm_win'), and(in(parameters.platform, 'wasi_wasm_win', 'wasi_multithread_wasm_win'), not(eq(parameters.runtimeFlavor, 'coreclr'))) }}: + - ${{ if or(eq(parameters.platform, 'browser_wasm_win'), and(in(parameters.platform, 'wasi_wasm_win', 'wasi_multithread_wasm_win'), not(eq(parameters.runtimeFlavor, 'coreclr')))) }}: # Update machine certs - task: PowerShell@2 displayName: Update machine certs From b5e66eed458f0baf735059b54feb35433e720b6a Mon Sep 17 00:00:00 2001 From: "scott.waye@hubse.com" Date: Sat, 12 Apr 2025 08:01:04 -0500 Subject: [PATCH 09/59] yaml --- eng/pipelines/runtimelab.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/runtimelab.yml b/eng/pipelines/runtimelab.yml index b856fd960153..419b172bcd68 100644 --- a/eng/pipelines/runtimelab.yml +++ b/eng/pipelines/runtimelab.yml @@ -104,7 +104,7 @@ extends: - windows_x64 - Browser_wasm_win - wasi_wasm_win - - wasi_multithread_wasm_win +# - wasi_multithread_wasm_win - wasi_wasm_linux_x64_naot_llvm - Browser_wasm_linux_x64_naot_llvm jobParameters: From 7d40fc375756498fd1360c9ee70a8cc6502d0d08 Mon Sep 17 00:00:00 2001 From: "scott.waye@hubse.com" Date: Sat, 12 Apr 2025 08:02:21 -0500 Subject: [PATCH 10/59] yaml --- eng/pipelines/runtimelab.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/runtimelab.yml b/eng/pipelines/runtimelab.yml index 419b172bcd68..c83bdfa5af99 100644 --- a/eng/pipelines/runtimelab.yml +++ b/eng/pipelines/runtimelab.yml @@ -61,7 +61,7 @@ extends: - windows_x64 - browser_wasm_win - wasi_wasm_win - - wasi_multithread_wasm_win +# - wasi_multithread_wasm_win - Browser_wasm_linux_x64_naot_llvm - wasi_wasm_linux_x64_naot_llvm jobParameters: From 0847c47d4a14f1c120ab11eb9848412a72f7dcf5 Mon Sep 17 00:00:00 2001 From: yowl Date: Mon, 5 May 2025 16:50:18 -0500 Subject: [PATCH 11/59] add back condition --- .../src/System.Private.CoreLib.Shared.projitems | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems b/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems index 1c509de60800..159dac4212f5 100644 --- a/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems +++ b/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems @@ -2708,7 +2708,7 @@ - + From 4111a2c86bebaec25d89a8670262ca623d48f7b9 Mon Sep 17 00:00:00 2001 From: yowl Date: Tue, 6 May 2025 18:30:49 -0500 Subject: [PATCH 12/59] enable mt yml --- eng/pipelines/runtimelab.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/runtimelab.yml b/eng/pipelines/runtimelab.yml index c83bdfa5af99..419b172bcd68 100644 --- a/eng/pipelines/runtimelab.yml +++ b/eng/pipelines/runtimelab.yml @@ -61,7 +61,7 @@ extends: - windows_x64 - browser_wasm_win - wasi_wasm_win -# - wasi_multithread_wasm_win + - wasi_multithread_wasm_win - Browser_wasm_linux_x64_naot_llvm - wasi_wasm_linux_x64_naot_llvm jobParameters: From 30fb4a8a2b2f2c2cf9365ba18103d5ff5d0bc38e Mon Sep 17 00:00:00 2001 From: yowl Date: Tue, 6 May 2025 18:34:55 -0500 Subject: [PATCH 13/59] yml --- eng/pipelines/common/platform-matrix.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/eng/pipelines/common/platform-matrix.yml b/eng/pipelines/common/platform-matrix.yml index ef0fe1a1a437..cafa2df24af5 100644 --- a/eng/pipelines/common/platform-matrix.yml +++ b/eng/pipelines/common/platform-matrix.yml @@ -516,6 +516,7 @@ jobs: runtimeFlavor: ${{ parameters.runtimeFlavor }} stagedBuild: ${{ parameters.stagedBuild }} buildConfig: ${{ parameters.buildConfig }} + ${{ insert }}: ${{ parameters.jobParameters }} # Turn on threads by adding to the buildArgs # ${{ each param in parameters.jobParameters }}: # ${{ each pair in param }}: From c936248803e7cf6172a567730fe6933be35aa68d Mon Sep 17 00:00:00 2001 From: yowl Date: Tue, 6 May 2025 18:38:14 -0500 Subject: [PATCH 14/59] yml --- eng/pipelines/common/platform-matrix.yml | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/eng/pipelines/common/platform-matrix.yml b/eng/pipelines/common/platform-matrix.yml index cafa2df24af5..1c34c26eecdb 100644 --- a/eng/pipelines/common/platform-matrix.yml +++ b/eng/pipelines/common/platform-matrix.yml @@ -500,30 +500,6 @@ jobs: buildConfig: ${{ parameters.buildConfig }} ${{ insert }}: ${{ parameters.jobParameters }} -- ${{ if containsValue(parameters.platforms, 'wasi_multithread_wasm_win') }}: - - template: xplat-setup.yml - parameters: - jobTemplate: ${{ parameters.jobTemplate }} - helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} - variables: ${{ parameters.variables }} - osGroup: wasi - archType: wasm - targetRid: wasi-wasm - platform: wasi_wasm_win - shouldContinueOnError: ${{ parameters.shouldContinueOnError }} - jobParameters: - hostedOs: windows - runtimeFlavor: ${{ parameters.runtimeFlavor }} - stagedBuild: ${{ parameters.stagedBuild }} - buildConfig: ${{ parameters.buildConfig }} - ${{ insert }}: ${{ parameters.jobParameters }} - # Turn on threads by adding to the buildArgs -# ${{ each param in parameters.jobParameters }}: -# ${{ each pair in param }}: -# ${{ if ne(pair.key, 'buildArgs') }}: -# ${{ pair.key }}: ${{ pair.value }} - # buildArgs: ${{ buildArgs }} '/p:WasmEnableThreads=true' - # Browser WebAssembly Linux X64 for NAOT-LLVM # Use a different name to differentiate from upstream as we need the -sanitizer image to get build tools that are not present in the stock browser_wasm image. From 58e17fcb4fc27c5f17e232109d033e7c93189fbd Mon Sep 17 00:00:00 2001 From: yowl Date: Tue, 6 May 2025 18:39:45 -0500 Subject: [PATCH 15/59] yml --- eng/pipelines/common/platform-matrix.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/eng/pipelines/common/platform-matrix.yml b/eng/pipelines/common/platform-matrix.yml index 1c34c26eecdb..77c9b20ccd15 100644 --- a/eng/pipelines/common/platform-matrix.yml +++ b/eng/pipelines/common/platform-matrix.yml @@ -500,6 +500,24 @@ jobs: buildConfig: ${{ parameters.buildConfig }} ${{ insert }}: ${{ parameters.jobParameters }} +- ${{ if containsValue(parameters.platforms, 'wasi_multithread_wasm_win') }}: + - template: xplat-setup.yml + parameters: + jobTemplate: ${{ parameters.jobTemplate }} + helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} + variables: ${{ parameters.variables }} + osGroup: wasi + archType: wasm + targetRid: wasi-wasm + platform: wasi_wasm_win + shouldContinueOnError: ${{ parameters.shouldContinueOnError }} + jobParameters: + hostedOs: windows + runtimeFlavor: ${{ parameters.runtimeFlavor }} + stagedBuild: ${{ parameters.stagedBuild }} + buildConfig: ${{ parameters.buildConfig }} + ${{ insert }}: ${{ parameters.jobParameters }} + # Browser WebAssembly Linux X64 for NAOT-LLVM # Use a different name to differentiate from upstream as we need the -sanitizer image to get build tools that are not present in the stock browser_wasm image. From e183e1dbe82860830a9338d4fa1207c846e0bff2 Mon Sep 17 00:00:00 2001 From: yowl Date: Tue, 6 May 2025 18:41:04 -0500 Subject: [PATCH 16/59] yml --- eng/pipelines/runtimelab.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eng/pipelines/runtimelab.yml b/eng/pipelines/runtimelab.yml index 419b172bcd68..b8dd383f58a6 100644 --- a/eng/pipelines/runtimelab.yml +++ b/eng/pipelines/runtimelab.yml @@ -61,7 +61,8 @@ extends: - windows_x64 - browser_wasm_win - wasi_wasm_win - - wasi_multithread_wasm_win +# - wasi_multithread_wasm_win + - wasi_wasm_win - Browser_wasm_linux_x64_naot_llvm - wasi_wasm_linux_x64_naot_llvm jobParameters: From b1b305a51ed70fb379d7818fcd9d1113600a4050 Mon Sep 17 00:00:00 2001 From: yowl Date: Tue, 6 May 2025 18:51:13 -0500 Subject: [PATCH 17/59] yml --- eng/pipelines/libraries/helix-queues-setup.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/libraries/helix-queues-setup.yml b/eng/pipelines/libraries/helix-queues-setup.yml index 46f897e80b25..3bf8ad250179 100644 --- a/eng/pipelines/libraries/helix-queues-setup.yml +++ b/eng/pipelines/libraries/helix-queues-setup.yml @@ -175,7 +175,7 @@ jobs: - (Ubuntu.2204.Amd64)Ubuntu.2204.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-22.04-helix-webassembly # Browser WebAssembly windows - - ${{ if in(parameters.platform, 'browser_wasm_win', 'wasi_wasm_win') }}: + - ${{ if in(parameters.platform, 'browser_wasm_win', 'wasi_wasm_win', 'wasi_multithread_wasm_win') }}: - (Windows.Amd64.Server2022.Open)windows.amd64.server2022.open@mcr.microsoft.com/dotnet-buildtools/prereqs:windowsservercore-ltsc2022-helix-webassembly - (Windows.Server2025.Amd64.Open)windows.server2025.amd64.open@mcr.microsoft.com/dotnet-buildtools/prereqs:windowsservercore-ltsc2025-helix-webassembly-amd64 From 3f8872ccce3f9b3c57c8cc6dd994c288d638a46f Mon Sep 17 00:00:00 2001 From: yowl Date: Tue, 6 May 2025 18:51:41 -0500 Subject: [PATCH 18/59] yml --- eng/pipelines/runtimelab.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/eng/pipelines/runtimelab.yml b/eng/pipelines/runtimelab.yml index b8dd383f58a6..419b172bcd68 100644 --- a/eng/pipelines/runtimelab.yml +++ b/eng/pipelines/runtimelab.yml @@ -61,8 +61,7 @@ extends: - windows_x64 - browser_wasm_win - wasi_wasm_win -# - wasi_multithread_wasm_win - - wasi_wasm_win + - wasi_multithread_wasm_win - Browser_wasm_linux_x64_naot_llvm - wasi_wasm_linux_x64_naot_llvm jobParameters: From e512b33aa29da4fbed83df955bf931821ca1bffe Mon Sep 17 00:00:00 2001 From: yowl Date: Tue, 6 May 2025 19:02:44 -0500 Subject: [PATCH 19/59] yml --- eng/pipelines/common/platform-matrix.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/common/platform-matrix.yml b/eng/pipelines/common/platform-matrix.yml index 77c9b20ccd15..783cb3994ab8 100644 --- a/eng/pipelines/common/platform-matrix.yml +++ b/eng/pipelines/common/platform-matrix.yml @@ -509,7 +509,7 @@ jobs: osGroup: wasi archType: wasm targetRid: wasi-wasm - platform: wasi_wasm_win + platform: wasi_multithread_wasm_win shouldContinueOnError: ${{ parameters.shouldContinueOnError }} jobParameters: hostedOs: windows From 51fa2d46e62a69c6b5b3d6f2547d240e125cce7d Mon Sep 17 00:00:00 2001 From: yowl Date: Tue, 6 May 2025 19:04:16 -0500 Subject: [PATCH 20/59] yml --- eng/pipelines/common/platform-matrix.yml | 30 ++++++++++++------------ 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/eng/pipelines/common/platform-matrix.yml b/eng/pipelines/common/platform-matrix.yml index 783cb3994ab8..ebaf29eece77 100644 --- a/eng/pipelines/common/platform-matrix.yml +++ b/eng/pipelines/common/platform-matrix.yml @@ -502,21 +502,21 @@ jobs: - ${{ if containsValue(parameters.platforms, 'wasi_multithread_wasm_win') }}: - template: xplat-setup.yml - parameters: - jobTemplate: ${{ parameters.jobTemplate }} - helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} - variables: ${{ parameters.variables }} - osGroup: wasi - archType: wasm - targetRid: wasi-wasm - platform: wasi_multithread_wasm_win - shouldContinueOnError: ${{ parameters.shouldContinueOnError }} - jobParameters: - hostedOs: windows - runtimeFlavor: ${{ parameters.runtimeFlavor }} - stagedBuild: ${{ parameters.stagedBuild }} - buildConfig: ${{ parameters.buildConfig }} - ${{ insert }}: ${{ parameters.jobParameters }} + # parameters: + # jobTemplate: ${{ parameters.jobTemplate }} + # helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} + # variables: ${{ parameters.variables }} + # osGroup: wasi + # archType: wasm + # targetRid: wasi-wasm + # platform: wasi_wasm_win + # shouldContinueOnError: ${{ parameters.shouldContinueOnError }} + # jobParameters: + # hostedOs: windows + # runtimeFlavor: ${{ parameters.runtimeFlavor }} + # stagedBuild: ${{ parameters.stagedBuild }} + # buildConfig: ${{ parameters.buildConfig }} + # ${{ insert }}: ${{ parameters.jobParameters }} # Browser WebAssembly Linux X64 for NAOT-LLVM # Use a different name to differentiate from upstream as we need the -sanitizer image to get build tools that are not present in the stock browser_wasm image. From b71ecfafe59789c64659a67a0f19c480f30f5666 Mon Sep 17 00:00:00 2001 From: yowl Date: Tue, 6 May 2025 19:05:25 -0500 Subject: [PATCH 21/59] yml --- eng/pipelines/common/platform-matrix.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/pipelines/common/platform-matrix.yml b/eng/pipelines/common/platform-matrix.yml index ebaf29eece77..338d601eb091 100644 --- a/eng/pipelines/common/platform-matrix.yml +++ b/eng/pipelines/common/platform-matrix.yml @@ -500,8 +500,8 @@ jobs: buildConfig: ${{ parameters.buildConfig }} ${{ insert }}: ${{ parameters.jobParameters }} -- ${{ if containsValue(parameters.platforms, 'wasi_multithread_wasm_win') }}: - - template: xplat-setup.yml +# - ${{ if containsValue(parameters.platforms, 'wasi_multithread_wasm_win') }}: +# - template: xplat-setup.yml # parameters: # jobTemplate: ${{ parameters.jobTemplate }} # helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} From 75949384030ef3203cf8bc8b7b7ac9e0da821053 Mon Sep 17 00:00:00 2001 From: yowl Date: Tue, 6 May 2025 19:06:51 -0500 Subject: [PATCH 22/59] yml --- eng/pipelines/common/platform-matrix.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/common/platform-matrix.yml b/eng/pipelines/common/platform-matrix.yml index 338d601eb091..4491809cb937 100644 --- a/eng/pipelines/common/platform-matrix.yml +++ b/eng/pipelines/common/platform-matrix.yml @@ -500,7 +500,7 @@ jobs: buildConfig: ${{ parameters.buildConfig }} ${{ insert }}: ${{ parameters.jobParameters }} -# - ${{ if containsValue(parameters.platforms, 'wasi_multithread_wasm_win') }}: +- ${{ if containsValue(parameters.platforms, 'wasi_multithread_wasm_win') }}: # - template: xplat-setup.yml # parameters: # jobTemplate: ${{ parameters.jobTemplate }} From d6aa762ecec0a6fddaa5d9772e4077468e8284da Mon Sep 17 00:00:00 2001 From: yowl Date: Tue, 6 May 2025 19:08:28 -0500 Subject: [PATCH 23/59] yml --- eng/pipelines/common/platform-matrix.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/common/platform-matrix.yml b/eng/pipelines/common/platform-matrix.yml index 4491809cb937..af3b1d698b3e 100644 --- a/eng/pipelines/common/platform-matrix.yml +++ b/eng/pipelines/common/platform-matrix.yml @@ -500,7 +500,7 @@ jobs: buildConfig: ${{ parameters.buildConfig }} ${{ insert }}: ${{ parameters.jobParameters }} -- ${{ if containsValue(parameters.platforms, 'wasi_multithread_wasm_win') }}: +- ${{ if containsValue(parameters.platforms, 'wasi_multcithread_wasm_win') }}: # - template: xplat-setup.yml # parameters: # jobTemplate: ${{ parameters.jobTemplate }} From 6cbfb269794c8645126a8a02fe66e5023f4d93c4 Mon Sep 17 00:00:00 2001 From: yowl Date: Tue, 6 May 2025 19:12:43 -0500 Subject: [PATCH 24/59] yml --- eng/pipelines/common/platform-matrix.yml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/eng/pipelines/common/platform-matrix.yml b/eng/pipelines/common/platform-matrix.yml index af3b1d698b3e..d5dcc24d4662 100644 --- a/eng/pipelines/common/platform-matrix.yml +++ b/eng/pipelines/common/platform-matrix.yml @@ -500,7 +500,23 @@ jobs: buildConfig: ${{ parameters.buildConfig }} ${{ insert }}: ${{ parameters.jobParameters }} -- ${{ if containsValue(parameters.platforms, 'wasi_multcithread_wasm_win') }}: +- ${{ if containsValue(parameters.platforms, 'wasi_wasm_win') }}: + - template: xplat-setup.yml + parameters: + jobTemplate: ${{ parameters.jobTemplate }} + helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} + variables: ${{ parameters.variables }} + osGroup: wasi + archType: wasm + targetRid: wasi-wasm + platform: wasi_wasm_win + shouldContinueOnError: ${{ parameters.shouldContinueOnError }} + jobParameters: + hostedOs: windows + runtimeFlavor: ${{ parameters.runtimeFlavor }} + stagedBuild: ${{ parameters.stagedBuild }} + buildConfig: ${{ parameters.buildConfig }} + ${{ insert }}: ${{ parameters.jobParameters }} # - template: xplat-setup.yml # parameters: # jobTemplate: ${{ parameters.jobTemplate }} From 1cb2f85162187505190f6efd06b36a5b477bd65e Mon Sep 17 00:00:00 2001 From: yowl Date: Tue, 6 May 2025 19:19:09 -0500 Subject: [PATCH 25/59] yml --- eng/pipelines/common/platform-matrix.yml | 18 +----------------- eng/pipelines/runtimelab.yml | 2 +- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/eng/pipelines/common/platform-matrix.yml b/eng/pipelines/common/platform-matrix.yml index d5dcc24d4662..ef411038319f 100644 --- a/eng/pipelines/common/platform-matrix.yml +++ b/eng/pipelines/common/platform-matrix.yml @@ -500,23 +500,7 @@ jobs: buildConfig: ${{ parameters.buildConfig }} ${{ insert }}: ${{ parameters.jobParameters }} -- ${{ if containsValue(parameters.platforms, 'wasi_wasm_win') }}: - - template: xplat-setup.yml - parameters: - jobTemplate: ${{ parameters.jobTemplate }} - helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} - variables: ${{ parameters.variables }} - osGroup: wasi - archType: wasm - targetRid: wasi-wasm - platform: wasi_wasm_win - shouldContinueOnError: ${{ parameters.shouldContinueOnError }} - jobParameters: - hostedOs: windows - runtimeFlavor: ${{ parameters.runtimeFlavor }} - stagedBuild: ${{ parameters.stagedBuild }} - buildConfig: ${{ parameters.buildConfig }} - ${{ insert }}: ${{ parameters.jobParameters }} +- ${{ if containsValue(parameters.platforms, 'wasi_multiythread_wasm_win') }}: # - template: xplat-setup.yml # parameters: # jobTemplate: ${{ parameters.jobTemplate }} diff --git a/eng/pipelines/runtimelab.yml b/eng/pipelines/runtimelab.yml index 419b172bcd68..6948e302bde7 100644 --- a/eng/pipelines/runtimelab.yml +++ b/eng/pipelines/runtimelab.yml @@ -61,7 +61,7 @@ extends: - windows_x64 - browser_wasm_win - wasi_wasm_win - - wasi_multithread_wasm_win + - wasi_multixthread_wasm_win - Browser_wasm_linux_x64_naot_llvm - wasi_wasm_linux_x64_naot_llvm jobParameters: From 846cd3259259688481fca00c3c4e86ebad47a5ba Mon Sep 17 00:00:00 2001 From: yowl Date: Tue, 6 May 2025 19:23:27 -0500 Subject: [PATCH 26/59] yml --- eng/pipelines/common/platform-matrix.yml | 34 ++++++++++++------------ eng/pipelines/runtimelab.yml | 2 +- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/eng/pipelines/common/platform-matrix.yml b/eng/pipelines/common/platform-matrix.yml index ef411038319f..77c9b20ccd15 100644 --- a/eng/pipelines/common/platform-matrix.yml +++ b/eng/pipelines/common/platform-matrix.yml @@ -500,23 +500,23 @@ jobs: buildConfig: ${{ parameters.buildConfig }} ${{ insert }}: ${{ parameters.jobParameters }} -- ${{ if containsValue(parameters.platforms, 'wasi_multiythread_wasm_win') }}: -# - template: xplat-setup.yml - # parameters: - # jobTemplate: ${{ parameters.jobTemplate }} - # helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} - # variables: ${{ parameters.variables }} - # osGroup: wasi - # archType: wasm - # targetRid: wasi-wasm - # platform: wasi_wasm_win - # shouldContinueOnError: ${{ parameters.shouldContinueOnError }} - # jobParameters: - # hostedOs: windows - # runtimeFlavor: ${{ parameters.runtimeFlavor }} - # stagedBuild: ${{ parameters.stagedBuild }} - # buildConfig: ${{ parameters.buildConfig }} - # ${{ insert }}: ${{ parameters.jobParameters }} +- ${{ if containsValue(parameters.platforms, 'wasi_multithread_wasm_win') }}: + - template: xplat-setup.yml + parameters: + jobTemplate: ${{ parameters.jobTemplate }} + helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} + variables: ${{ parameters.variables }} + osGroup: wasi + archType: wasm + targetRid: wasi-wasm + platform: wasi_wasm_win + shouldContinueOnError: ${{ parameters.shouldContinueOnError }} + jobParameters: + hostedOs: windows + runtimeFlavor: ${{ parameters.runtimeFlavor }} + stagedBuild: ${{ parameters.stagedBuild }} + buildConfig: ${{ parameters.buildConfig }} + ${{ insert }}: ${{ parameters.jobParameters }} # Browser WebAssembly Linux X64 for NAOT-LLVM # Use a different name to differentiate from upstream as we need the -sanitizer image to get build tools that are not present in the stock browser_wasm image. diff --git a/eng/pipelines/runtimelab.yml b/eng/pipelines/runtimelab.yml index 6948e302bde7..419b172bcd68 100644 --- a/eng/pipelines/runtimelab.yml +++ b/eng/pipelines/runtimelab.yml @@ -61,7 +61,7 @@ extends: - windows_x64 - browser_wasm_win - wasi_wasm_win - - wasi_multixthread_wasm_win + - wasi_multithread_wasm_win - Browser_wasm_linux_x64_naot_llvm - wasi_wasm_linux_x64_naot_llvm jobParameters: From 533409f8855740661170579d1bc6b445b1625ace Mon Sep 17 00:00:00 2001 From: yowl Date: Tue, 6 May 2025 19:31:54 -0500 Subject: [PATCH 27/59] yml --- eng/pipelines/common/platform-matrix.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/common/platform-matrix.yml b/eng/pipelines/common/platform-matrix.yml index 77c9b20ccd15..783cb3994ab8 100644 --- a/eng/pipelines/common/platform-matrix.yml +++ b/eng/pipelines/common/platform-matrix.yml @@ -509,7 +509,7 @@ jobs: osGroup: wasi archType: wasm targetRid: wasi-wasm - platform: wasi_wasm_win + platform: wasi_multithread_wasm_win shouldContinueOnError: ${{ parameters.shouldContinueOnError }} jobParameters: hostedOs: windows From 39539a93ec25f0766e8d4d13e72c72715be844a6 Mon Sep 17 00:00:00 2001 From: yowl Date: Wed, 7 May 2025 18:45:46 -0500 Subject: [PATCH 28/59] yml --- eng/pipelines/common/platform-matrix.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/common/platform-matrix.yml b/eng/pipelines/common/platform-matrix.yml index 783cb3994ab8..7996a43a0e51 100644 --- a/eng/pipelines/common/platform-matrix.yml +++ b/eng/pipelines/common/platform-matrix.yml @@ -509,7 +509,7 @@ jobs: osGroup: wasi archType: wasm targetRid: wasi-wasm - platform: wasi_multithread_wasm_win + platform: wasi_wasm_winx shouldContinueOnError: ${{ parameters.shouldContinueOnError }} jobParameters: hostedOs: windows From f2298845a771bc307770381cf086c985803f61da Mon Sep 17 00:00:00 2001 From: yowl Date: Fri, 9 May 2025 20:15:24 -0500 Subject: [PATCH 29/59] yml --- eng/pipelines/common/platform-matrix.yml | 2 +- eng/pipelines/runtimelab.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/pipelines/common/platform-matrix.yml b/eng/pipelines/common/platform-matrix.yml index 7996a43a0e51..77c9b20ccd15 100644 --- a/eng/pipelines/common/platform-matrix.yml +++ b/eng/pipelines/common/platform-matrix.yml @@ -509,7 +509,7 @@ jobs: osGroup: wasi archType: wasm targetRid: wasi-wasm - platform: wasi_wasm_winx + platform: wasi_wasm_win shouldContinueOnError: ${{ parameters.shouldContinueOnError }} jobParameters: hostedOs: windows diff --git a/eng/pipelines/runtimelab.yml b/eng/pipelines/runtimelab.yml index 419b172bcd68..78fa26e3d2cd 100644 --- a/eng/pipelines/runtimelab.yml +++ b/eng/pipelines/runtimelab.yml @@ -60,7 +60,7 @@ extends: platforms: - windows_x64 - browser_wasm_win - - wasi_wasm_win +# - wasi_wasm_win - wasi_multithread_wasm_win - Browser_wasm_linux_x64_naot_llvm - wasi_wasm_linux_x64_naot_llvm From dfd09a34aa94c7f60795aa753dbb3e9e9e397cba Mon Sep 17 00:00:00 2001 From: yowl Date: Fri, 9 May 2025 20:17:14 -0500 Subject: [PATCH 30/59] yml --- eng/pipelines/common/platform-matrix.yml | 2 +- eng/pipelines/runtimelab.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/pipelines/common/platform-matrix.yml b/eng/pipelines/common/platform-matrix.yml index 77c9b20ccd15..783cb3994ab8 100644 --- a/eng/pipelines/common/platform-matrix.yml +++ b/eng/pipelines/common/platform-matrix.yml @@ -509,7 +509,7 @@ jobs: osGroup: wasi archType: wasm targetRid: wasi-wasm - platform: wasi_wasm_win + platform: wasi_multithread_wasm_win shouldContinueOnError: ${{ parameters.shouldContinueOnError }} jobParameters: hostedOs: windows diff --git a/eng/pipelines/runtimelab.yml b/eng/pipelines/runtimelab.yml index 78fa26e3d2cd..419b172bcd68 100644 --- a/eng/pipelines/runtimelab.yml +++ b/eng/pipelines/runtimelab.yml @@ -60,7 +60,7 @@ extends: platforms: - windows_x64 - browser_wasm_win -# - wasi_wasm_win + - wasi_wasm_win - wasi_multithread_wasm_win - Browser_wasm_linux_x64_naot_llvm - wasi_wasm_linux_x64_naot_llvm From ba36825c90ebbe41ffdf1ec5d3d145294eb1e1c0 Mon Sep 17 00:00:00 2001 From: yowl Date: Fri, 9 May 2025 20:29:42 -0500 Subject: [PATCH 31/59] yml --- eng/pipelines/common/platform-matrix.yml | 2 +- eng/pipelines/runtimelab.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/pipelines/common/platform-matrix.yml b/eng/pipelines/common/platform-matrix.yml index 783cb3994ab8..7cbf8e002caa 100644 --- a/eng/pipelines/common/platform-matrix.yml +++ b/eng/pipelines/common/platform-matrix.yml @@ -507,7 +507,7 @@ jobs: helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} variables: ${{ parameters.variables }} osGroup: wasi - archType: wasm + archType: wasmx targetRid: wasi-wasm platform: wasi_multithread_wasm_win shouldContinueOnError: ${{ parameters.shouldContinueOnError }} diff --git a/eng/pipelines/runtimelab.yml b/eng/pipelines/runtimelab.yml index 419b172bcd68..32d307cb6257 100644 --- a/eng/pipelines/runtimelab.yml +++ b/eng/pipelines/runtimelab.yml @@ -61,9 +61,9 @@ extends: - windows_x64 - browser_wasm_win - wasi_wasm_win - - wasi_multithread_wasm_win - Browser_wasm_linux_x64_naot_llvm - wasi_wasm_linux_x64_naot_llvm + - wasi_multithread_wasm_win jobParameters: timeoutInMinutes: 300 buildArgs: -s clr.aot+libs -c debug -rc $(_BuildConfig) From dcd5787f9f1a6c59a6abce72baf30fc04ee9bc16 Mon Sep 17 00:00:00 2001 From: yowl Date: Sat, 10 May 2025 08:07:02 -0500 Subject: [PATCH 32/59] yml --- eng/pipelines/common/platform-matrix.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eng/pipelines/common/platform-matrix.yml b/eng/pipelines/common/platform-matrix.yml index 7cbf8e002caa..36d3d7d8e9d9 100644 --- a/eng/pipelines/common/platform-matrix.yml +++ b/eng/pipelines/common/platform-matrix.yml @@ -507,7 +507,8 @@ jobs: helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} variables: ${{ parameters.variables }} osGroup: wasi - archType: wasmx + osSubgroup: multithread + archType: wasm targetRid: wasi-wasm platform: wasi_multithread_wasm_win shouldContinueOnError: ${{ parameters.shouldContinueOnError }} From 82830296900cc3cbc71c5cad999451d0a3c51c48 Mon Sep 17 00:00:00 2001 From: yowl Date: Sat, 10 May 2025 08:11:43 -0500 Subject: [PATCH 33/59] yml --- eng/pipelines/common/platform-matrix.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/eng/pipelines/common/platform-matrix.yml b/eng/pipelines/common/platform-matrix.yml index 36d3d7d8e9d9..2d3e30060298 100644 --- a/eng/pipelines/common/platform-matrix.yml +++ b/eng/pipelines/common/platform-matrix.yml @@ -510,14 +510,19 @@ jobs: osSubgroup: multithread archType: wasm targetRid: wasi-wasm - platform: wasi_multithread_wasm_win + platform: wasi_wasm_win shouldContinueOnError: ${{ parameters.shouldContinueOnError }} jobParameters: hostedOs: windows runtimeFlavor: ${{ parameters.runtimeFlavor }} stagedBuild: ${{ parameters.stagedBuild }} buildConfig: ${{ parameters.buildConfig }} - ${{ insert }}: ${{ parameters.jobParameters }} + # Turn on threads by adding to the buildArgs. + ${{ each param in parameters.jobParameters }}: + ${{ each pair in param }}: + ${{ if ne(pair.key, 'buildArgs') }}: + ${{ pair.key }}: ${{ pair.value }} + buildArgs: ${{ buildArgs }} '/p:WasmEnableThreads=true' # Browser WebAssembly Linux X64 for NAOT-LLVM # Use a different name to differentiate from upstream as we need the -sanitizer image to get build tools that are not present in the stock browser_wasm image. From 40bcb9f03be2e24ee772597afa94d47574e221d8 Mon Sep 17 00:00:00 2001 From: yowl Date: Sat, 10 May 2025 08:14:39 -0500 Subject: [PATCH 34/59] yml --- eng/pipelines/common/platform-matrix.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/eng/pipelines/common/platform-matrix.yml b/eng/pipelines/common/platform-matrix.yml index 2d3e30060298..d374478b479e 100644 --- a/eng/pipelines/common/platform-matrix.yml +++ b/eng/pipelines/common/platform-matrix.yml @@ -510,19 +510,20 @@ jobs: osSubgroup: multithread archType: wasm targetRid: wasi-wasm - platform: wasi_wasm_win + platform: wasi_multithread_wasm_win shouldContinueOnError: ${{ parameters.shouldContinueOnError }} jobParameters: hostedOs: windows runtimeFlavor: ${{ parameters.runtimeFlavor }} stagedBuild: ${{ parameters.stagedBuild }} buildConfig: ${{ parameters.buildConfig }} + ${{ insert }}: ${{ parameters.jobParameters }} # Turn on threads by adding to the buildArgs. - ${{ each param in parameters.jobParameters }}: - ${{ each pair in param }}: - ${{ if ne(pair.key, 'buildArgs') }}: - ${{ pair.key }}: ${{ pair.value }} - buildArgs: ${{ buildArgs }} '/p:WasmEnableThreads=true' + # ${{ each param in parameters.jobParameters }}: + # ${{ each pair in param }}: + # ${{ if ne(pair.key, 'buildArgs') }}: + # ${{ pair.key }}: ${{ pair.value }} + # buildArgs: ${{ buildArgs }} '/p:WasmEnableThreads=true' # Browser WebAssembly Linux X64 for NAOT-LLVM # Use a different name to differentiate from upstream as we need the -sanitizer image to get build tools that are not present in the stock browser_wasm image. From 301631767c154351bdb76185349d22421758ea4b Mon Sep 17 00:00:00 2001 From: yowl Date: Sat, 10 May 2025 08:19:31 -0500 Subject: [PATCH 35/59] yml --- eng/pipelines/common/platform-matrix.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/eng/pipelines/common/platform-matrix.yml b/eng/pipelines/common/platform-matrix.yml index d374478b479e..d8a3fae9b0d0 100644 --- a/eng/pipelines/common/platform-matrix.yml +++ b/eng/pipelines/common/platform-matrix.yml @@ -517,13 +517,12 @@ jobs: runtimeFlavor: ${{ parameters.runtimeFlavor }} stagedBuild: ${{ parameters.stagedBuild }} buildConfig: ${{ parameters.buildConfig }} - ${{ insert }}: ${{ parameters.jobParameters }} # Turn on threads by adding to the buildArgs. - # ${{ each param in parameters.jobParameters }}: - # ${{ each pair in param }}: - # ${{ if ne(pair.key, 'buildArgs') }}: - # ${{ pair.key }}: ${{ pair.value }} - # buildArgs: ${{ buildArgs }} '/p:WasmEnableThreads=true' + ${{ each param in parameters.jobParameters }}: + ${{ each pair in param }}: + ${{ if ne(pair.key, 'buildArgs') }}: + ${{ pair.key }}: ${{ pair.value }} + #buildArgs: ${{ buildArgs }} '/p:WasmEnableThreads=true' # Browser WebAssembly Linux X64 for NAOT-LLVM # Use a different name to differentiate from upstream as we need the -sanitizer image to get build tools that are not present in the stock browser_wasm image. From cde6d6ab90fab948aeea3854da95a95f79370525 Mon Sep 17 00:00:00 2001 From: yowl Date: Sat, 10 May 2025 08:43:18 -0500 Subject: [PATCH 36/59] yml --- eng/pipelines/common/platform-matrix.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/pipelines/common/platform-matrix.yml b/eng/pipelines/common/platform-matrix.yml index d8a3fae9b0d0..2be2563c9a6a 100644 --- a/eng/pipelines/common/platform-matrix.yml +++ b/eng/pipelines/common/platform-matrix.yml @@ -520,8 +520,8 @@ jobs: # Turn on threads by adding to the buildArgs. ${{ each param in parameters.jobParameters }}: ${{ each pair in param }}: - ${{ if ne(pair.key, 'buildArgs') }}: - ${{ pair.key }}: ${{ pair.value }} + ${{ if ne(pair.name, 'buildArgs') }}: + ${{ pair.name }}: ${{ pair.value }} #buildArgs: ${{ buildArgs }} '/p:WasmEnableThreads=true' # Browser WebAssembly Linux X64 for NAOT-LLVM From e6fa0657a5789ee4d3251ca40cd9c18919057e3b Mon Sep 17 00:00:00 2001 From: yowl Date: Sat, 10 May 2025 08:51:58 -0500 Subject: [PATCH 37/59] yml --- eng/pipelines/common/platform-matrix.yml | 26 +----------------------- eng/pipelines/runtimelab.yml | 19 ++++++++++++++++- 2 files changed, 19 insertions(+), 26 deletions(-) diff --git a/eng/pipelines/common/platform-matrix.yml b/eng/pipelines/common/platform-matrix.yml index 2be2563c9a6a..99749f688249 100644 --- a/eng/pipelines/common/platform-matrix.yml +++ b/eng/pipelines/common/platform-matrix.yml @@ -482,7 +482,7 @@ jobs: # WASI WebAssembly windows -- ${{ if containsValue(parameters.platforms, 'wasi_wasm_win') }}: +- ${{ if or(containsValue(parameters.platforms, 'wasi_wasm_win'), containsValue(parameters.platforms, 'wasi_multithread_wasm_win')) }}: - template: xplat-setup.yml parameters: jobTemplate: ${{ parameters.jobTemplate }} @@ -500,30 +500,6 @@ jobs: buildConfig: ${{ parameters.buildConfig }} ${{ insert }}: ${{ parameters.jobParameters }} -- ${{ if containsValue(parameters.platforms, 'wasi_multithread_wasm_win') }}: - - template: xplat-setup.yml - parameters: - jobTemplate: ${{ parameters.jobTemplate }} - helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} - variables: ${{ parameters.variables }} - osGroup: wasi - osSubgroup: multithread - archType: wasm - targetRid: wasi-wasm - platform: wasi_multithread_wasm_win - shouldContinueOnError: ${{ parameters.shouldContinueOnError }} - jobParameters: - hostedOs: windows - runtimeFlavor: ${{ parameters.runtimeFlavor }} - stagedBuild: ${{ parameters.stagedBuild }} - buildConfig: ${{ parameters.buildConfig }} - # Turn on threads by adding to the buildArgs. - ${{ each param in parameters.jobParameters }}: - ${{ each pair in param }}: - ${{ if ne(pair.name, 'buildArgs') }}: - ${{ pair.name }}: ${{ pair.value }} - #buildArgs: ${{ buildArgs }} '/p:WasmEnableThreads=true' - # Browser WebAssembly Linux X64 for NAOT-LLVM # Use a different name to differentiate from upstream as we need the -sanitizer image to get build tools that are not present in the stock browser_wasm image. diff --git a/eng/pipelines/runtimelab.yml b/eng/pipelines/runtimelab.yml index 32d307cb6257..bebcb8276af8 100644 --- a/eng/pipelines/runtimelab.yml +++ b/eng/pipelines/runtimelab.yml @@ -63,7 +63,6 @@ extends: - wasi_wasm_win - Browser_wasm_linux_x64_naot_llvm - wasi_wasm_linux_x64_naot_llvm - - wasi_multithread_wasm_win jobParameters: timeoutInMinutes: 300 buildArgs: -s clr.aot+libs -c debug -rc $(_BuildConfig) @@ -72,6 +71,24 @@ extends: parameters: librariesConfiguration: Debug + # + # Build and test Wasm Debug multithreaded libraries and Debug runtime + # + - template: /eng/pipelines/common/platform-matrix.yml + parameters: + jobTemplate: /eng/pipelines/common/global-build-job.yml + helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml + buildConfig: debug + platforms: + - wasi_multithread_wasm_win + jobParameters: + timeoutInMinutes: 300 + buildArgs: -s clr.aot+libs -c debug -rc $(_BuildConfig) '/p:WasmEnableThreads=true' + postBuildSteps: + - template: /eng/pipelines/runtimelab/runtimelab-post-build-steps.yml + parameters: + librariesConfiguration: Debug + # # Build and test with Debug libraries and Checked runtime # From a584bcb5bd42bd761254e82057df7b54da35d68e Mon Sep 17 00:00:00 2001 From: yowl Date: Sat, 10 May 2025 09:02:59 -0500 Subject: [PATCH 38/59] yml --- eng/pipelines/runtimelab.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/runtimelab.yml b/eng/pipelines/runtimelab.yml index bebcb8276af8..1dd785e7766a 100644 --- a/eng/pipelines/runtimelab.yml +++ b/eng/pipelines/runtimelab.yml @@ -83,7 +83,7 @@ extends: - wasi_multithread_wasm_win jobParameters: timeoutInMinutes: 300 - buildArgs: -s clr.aot+libs -c debug -rc $(_BuildConfig) '/p:WasmEnableThreads=true' + buildArgs: -s clr.aot+libs -c debug -rc $(_BuildConfig) postBuildSteps: - template: /eng/pipelines/runtimelab/runtimelab-post-build-steps.yml parameters: From b250b2578c8c141fc796163b47c4791743efb7da Mon Sep 17 00:00:00 2001 From: yowl Date: Sat, 10 May 2025 09:04:20 -0500 Subject: [PATCH 39/59] yml --- eng/pipelines/runtimelab.yml | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/eng/pipelines/runtimelab.yml b/eng/pipelines/runtimelab.yml index 1dd785e7766a..a70f12b3637f 100644 --- a/eng/pipelines/runtimelab.yml +++ b/eng/pipelines/runtimelab.yml @@ -74,20 +74,20 @@ extends: # # Build and test Wasm Debug multithreaded libraries and Debug runtime # - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/common/global-build-job.yml - helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml - buildConfig: debug - platforms: - - wasi_multithread_wasm_win - jobParameters: - timeoutInMinutes: 300 - buildArgs: -s clr.aot+libs -c debug -rc $(_BuildConfig) - postBuildSteps: - - template: /eng/pipelines/runtimelab/runtimelab-post-build-steps.yml - parameters: - librariesConfiguration: Debug + # - template: /eng/pipelines/common/platform-matrix.yml + # parameters: + # jobTemplate: /eng/pipelines/common/global-build-job.yml + # helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml + # buildConfig: debug + # platforms: + # - wasi_multithread_wasm_win + # jobParameters: + # timeoutInMinutes: 300 + # buildArgs: -s clr.aot+libs -c debug -rc $(_BuildConfig) '/p:WasmEnableThreads=true' + # postBuildSteps: + # - template: /eng/pipelines/runtimelab/runtimelab-post-build-steps.yml + # parameters: + # librariesConfiguration: Debug # # Build and test with Debug libraries and Checked runtime From c18e7d7004b2e041b9971c1d795aac007ab503c9 Mon Sep 17 00:00:00 2001 From: yowl Date: Sat, 10 May 2025 09:05:03 -0500 Subject: [PATCH 40/59] yml --- eng/pipelines/common/platform-matrix.yml | 21 +++++++++++++++++- eng/pipelines/runtimelab.yml | 28 ++++++++++++------------ 2 files changed, 34 insertions(+), 15 deletions(-) diff --git a/eng/pipelines/common/platform-matrix.yml b/eng/pipelines/common/platform-matrix.yml index 99749f688249..d5dc623502bb 100644 --- a/eng/pipelines/common/platform-matrix.yml +++ b/eng/pipelines/common/platform-matrix.yml @@ -482,7 +482,7 @@ jobs: # WASI WebAssembly windows -- ${{ if or(containsValue(parameters.platforms, 'wasi_wasm_win'), containsValue(parameters.platforms, 'wasi_multithread_wasm_win')) }}: +- ${{ if or(containsValue(parameters.platforms, 'wasi_wasm_win') }}: - template: xplat-setup.yml parameters: jobTemplate: ${{ parameters.jobTemplate }} @@ -500,6 +500,25 @@ jobs: buildConfig: ${{ parameters.buildConfig }} ${{ insert }}: ${{ parameters.jobParameters }} +- ${{ if containsValue(parameters.platforms, 'wasi_multithread_wasm_win') }}: + - template: xplat-setup.yml + parameters: + jobTemplate: ${{ parameters.jobTemplate }} + helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} + variables: ${{ parameters.variables }} + osGroup: wasi + osSubgroup: multithread + archType: wasm + targetRid: wasi-wasm + platform: wasi_multithread_wasm_win + shouldContinueOnError: ${{ parameters.shouldContinueOnError }} + jobParameters: + hostedOs: windows + runtimeFlavor: ${{ parameters.runtimeFlavor }} + stagedBuild: ${{ parameters.stagedBuild }} + buildConfig: ${{ parameters.buildConfig }} + buildArgs: ${{ buildArgs }} '/p:WasmEnableThreads=true' + # Browser WebAssembly Linux X64 for NAOT-LLVM # Use a different name to differentiate from upstream as we need the -sanitizer image to get build tools that are not present in the stock browser_wasm image. diff --git a/eng/pipelines/runtimelab.yml b/eng/pipelines/runtimelab.yml index a70f12b3637f..bebcb8276af8 100644 --- a/eng/pipelines/runtimelab.yml +++ b/eng/pipelines/runtimelab.yml @@ -74,20 +74,20 @@ extends: # # Build and test Wasm Debug multithreaded libraries and Debug runtime # - # - template: /eng/pipelines/common/platform-matrix.yml - # parameters: - # jobTemplate: /eng/pipelines/common/global-build-job.yml - # helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml - # buildConfig: debug - # platforms: - # - wasi_multithread_wasm_win - # jobParameters: - # timeoutInMinutes: 300 - # buildArgs: -s clr.aot+libs -c debug -rc $(_BuildConfig) '/p:WasmEnableThreads=true' - # postBuildSteps: - # - template: /eng/pipelines/runtimelab/runtimelab-post-build-steps.yml - # parameters: - # librariesConfiguration: Debug + - template: /eng/pipelines/common/platform-matrix.yml + parameters: + jobTemplate: /eng/pipelines/common/global-build-job.yml + helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml + buildConfig: debug + platforms: + - wasi_multithread_wasm_win + jobParameters: + timeoutInMinutes: 300 + buildArgs: -s clr.aot+libs -c debug -rc $(_BuildConfig) '/p:WasmEnableThreads=true' + postBuildSteps: + - template: /eng/pipelines/runtimelab/runtimelab-post-build-steps.yml + parameters: + librariesConfiguration: Debug # # Build and test with Debug libraries and Checked runtime From d2f384126704a32ca5541ad52013060bc897e950 Mon Sep 17 00:00:00 2001 From: yowl Date: Sat, 10 May 2025 09:06:19 -0500 Subject: [PATCH 41/59] yml --- eng/pipelines/runtimelab.yml | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/eng/pipelines/runtimelab.yml b/eng/pipelines/runtimelab.yml index bebcb8276af8..a70f12b3637f 100644 --- a/eng/pipelines/runtimelab.yml +++ b/eng/pipelines/runtimelab.yml @@ -74,20 +74,20 @@ extends: # # Build and test Wasm Debug multithreaded libraries and Debug runtime # - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/common/global-build-job.yml - helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml - buildConfig: debug - platforms: - - wasi_multithread_wasm_win - jobParameters: - timeoutInMinutes: 300 - buildArgs: -s clr.aot+libs -c debug -rc $(_BuildConfig) '/p:WasmEnableThreads=true' - postBuildSteps: - - template: /eng/pipelines/runtimelab/runtimelab-post-build-steps.yml - parameters: - librariesConfiguration: Debug + # - template: /eng/pipelines/common/platform-matrix.yml + # parameters: + # jobTemplate: /eng/pipelines/common/global-build-job.yml + # helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml + # buildConfig: debug + # platforms: + # - wasi_multithread_wasm_win + # jobParameters: + # timeoutInMinutes: 300 + # buildArgs: -s clr.aot+libs -c debug -rc $(_BuildConfig) '/p:WasmEnableThreads=true' + # postBuildSteps: + # - template: /eng/pipelines/runtimelab/runtimelab-post-build-steps.yml + # parameters: + # librariesConfiguration: Debug # # Build and test with Debug libraries and Checked runtime From adbb8b7232b4c0889d305f452d845ba73e438a94 Mon Sep 17 00:00:00 2001 From: yowl Date: Sat, 10 May 2025 09:07:42 -0500 Subject: [PATCH 42/59] yml --- eng/pipelines/common/platform-matrix.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/common/platform-matrix.yml b/eng/pipelines/common/platform-matrix.yml index d5dc623502bb..10fc6e1eaeab 100644 --- a/eng/pipelines/common/platform-matrix.yml +++ b/eng/pipelines/common/platform-matrix.yml @@ -482,7 +482,7 @@ jobs: # WASI WebAssembly windows -- ${{ if or(containsValue(parameters.platforms, 'wasi_wasm_win') }}: +- ${{ if containsValue(parameters.platforms, 'wasi_wasm_win') }}: - template: xplat-setup.yml parameters: jobTemplate: ${{ parameters.jobTemplate }} From 2241d28d45b62045d95869497e7e5f00ac38e0f0 Mon Sep 17 00:00:00 2001 From: yowl Date: Sat, 10 May 2025 09:08:35 -0500 Subject: [PATCH 43/59] yml --- eng/pipelines/runtimelab.yml | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/eng/pipelines/runtimelab.yml b/eng/pipelines/runtimelab.yml index a70f12b3637f..bebcb8276af8 100644 --- a/eng/pipelines/runtimelab.yml +++ b/eng/pipelines/runtimelab.yml @@ -74,20 +74,20 @@ extends: # # Build and test Wasm Debug multithreaded libraries and Debug runtime # - # - template: /eng/pipelines/common/platform-matrix.yml - # parameters: - # jobTemplate: /eng/pipelines/common/global-build-job.yml - # helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml - # buildConfig: debug - # platforms: - # - wasi_multithread_wasm_win - # jobParameters: - # timeoutInMinutes: 300 - # buildArgs: -s clr.aot+libs -c debug -rc $(_BuildConfig) '/p:WasmEnableThreads=true' - # postBuildSteps: - # - template: /eng/pipelines/runtimelab/runtimelab-post-build-steps.yml - # parameters: - # librariesConfiguration: Debug + - template: /eng/pipelines/common/platform-matrix.yml + parameters: + jobTemplate: /eng/pipelines/common/global-build-job.yml + helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml + buildConfig: debug + platforms: + - wasi_multithread_wasm_win + jobParameters: + timeoutInMinutes: 300 + buildArgs: -s clr.aot+libs -c debug -rc $(_BuildConfig) '/p:WasmEnableThreads=true' + postBuildSteps: + - template: /eng/pipelines/runtimelab/runtimelab-post-build-steps.yml + parameters: + librariesConfiguration: Debug # # Build and test with Debug libraries and Checked runtime From a8067207f4f9fd58ba03284999d93404dbba2901 Mon Sep 17 00:00:00 2001 From: yowl Date: Sat, 10 May 2025 09:10:33 -0500 Subject: [PATCH 44/59] yml --- eng/pipelines/runtimelab.yml | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/eng/pipelines/runtimelab.yml b/eng/pipelines/runtimelab.yml index bebcb8276af8..a70f12b3637f 100644 --- a/eng/pipelines/runtimelab.yml +++ b/eng/pipelines/runtimelab.yml @@ -74,20 +74,20 @@ extends: # # Build and test Wasm Debug multithreaded libraries and Debug runtime # - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/common/global-build-job.yml - helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml - buildConfig: debug - platforms: - - wasi_multithread_wasm_win - jobParameters: - timeoutInMinutes: 300 - buildArgs: -s clr.aot+libs -c debug -rc $(_BuildConfig) '/p:WasmEnableThreads=true' - postBuildSteps: - - template: /eng/pipelines/runtimelab/runtimelab-post-build-steps.yml - parameters: - librariesConfiguration: Debug + # - template: /eng/pipelines/common/platform-matrix.yml + # parameters: + # jobTemplate: /eng/pipelines/common/global-build-job.yml + # helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml + # buildConfig: debug + # platforms: + # - wasi_multithread_wasm_win + # jobParameters: + # timeoutInMinutes: 300 + # buildArgs: -s clr.aot+libs -c debug -rc $(_BuildConfig) '/p:WasmEnableThreads=true' + # postBuildSteps: + # - template: /eng/pipelines/runtimelab/runtimelab-post-build-steps.yml + # parameters: + # librariesConfiguration: Debug # # Build and test with Debug libraries and Checked runtime From d9ce1aa8642c9a8d8c1a206807609e8550bcf2eb Mon Sep 17 00:00:00 2001 From: yowl Date: Sat, 10 May 2025 09:20:33 -0500 Subject: [PATCH 45/59] yml --- eng/pipelines/common/platform-matrix.yml | 2 +- eng/pipelines/runtimelab.yml | 28 ++++++++++++------------ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/eng/pipelines/common/platform-matrix.yml b/eng/pipelines/common/platform-matrix.yml index 10fc6e1eaeab..36d3d7d8e9d9 100644 --- a/eng/pipelines/common/platform-matrix.yml +++ b/eng/pipelines/common/platform-matrix.yml @@ -517,7 +517,7 @@ jobs: runtimeFlavor: ${{ parameters.runtimeFlavor }} stagedBuild: ${{ parameters.stagedBuild }} buildConfig: ${{ parameters.buildConfig }} - buildArgs: ${{ buildArgs }} '/p:WasmEnableThreads=true' + ${{ insert }}: ${{ parameters.jobParameters }} # Browser WebAssembly Linux X64 for NAOT-LLVM # Use a different name to differentiate from upstream as we need the -sanitizer image to get build tools that are not present in the stock browser_wasm image. diff --git a/eng/pipelines/runtimelab.yml b/eng/pipelines/runtimelab.yml index a70f12b3637f..bebcb8276af8 100644 --- a/eng/pipelines/runtimelab.yml +++ b/eng/pipelines/runtimelab.yml @@ -74,20 +74,20 @@ extends: # # Build and test Wasm Debug multithreaded libraries and Debug runtime # - # - template: /eng/pipelines/common/platform-matrix.yml - # parameters: - # jobTemplate: /eng/pipelines/common/global-build-job.yml - # helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml - # buildConfig: debug - # platforms: - # - wasi_multithread_wasm_win - # jobParameters: - # timeoutInMinutes: 300 - # buildArgs: -s clr.aot+libs -c debug -rc $(_BuildConfig) '/p:WasmEnableThreads=true' - # postBuildSteps: - # - template: /eng/pipelines/runtimelab/runtimelab-post-build-steps.yml - # parameters: - # librariesConfiguration: Debug + - template: /eng/pipelines/common/platform-matrix.yml + parameters: + jobTemplate: /eng/pipelines/common/global-build-job.yml + helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml + buildConfig: debug + platforms: + - wasi_multithread_wasm_win + jobParameters: + timeoutInMinutes: 300 + buildArgs: -s clr.aot+libs -c debug -rc $(_BuildConfig) '/p:WasmEnableThreads=true' + postBuildSteps: + - template: /eng/pipelines/runtimelab/runtimelab-post-build-steps.yml + parameters: + librariesConfiguration: Debug # # Build and test with Debug libraries and Checked runtime From 2322668a3650e572235f939a5c191adcb1c77bd1 Mon Sep 17 00:00:00 2001 From: yowl Date: Sun, 11 May 2025 10:06:22 -0500 Subject: [PATCH 46/59] yml --- eng/pipelines/runtimelab/runtimelab-post-build-steps.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/eng/pipelines/runtimelab/runtimelab-post-build-steps.yml b/eng/pipelines/runtimelab/runtimelab-post-build-steps.yml index fd00f4681ddd..b9ab7e0f3723 100644 --- a/eng/pipelines/runtimelab/runtimelab-post-build-steps.yml +++ b/eng/pipelines/runtimelab/runtimelab-post-build-steps.yml @@ -37,6 +37,10 @@ steps: - script: | $(Build.SourcesDirectory)/src/tests/build$(scriptExt) nativeaot $(buildConfigUpper) ${{ parameters.archType }} $(crossArg) $(_officialBuildParameter) ci wasi tree nativeaot /p:LibrariesConfiguration=${{ parameters.librariesConfiguration }} displayName: Build WebAssembly tests + - ${{ elseif eq(parameters.platform, 'wasi_multithread_wasm_win') }}: + - script: | + $(Build.SourcesDirectory)/src/tests/build$(scriptExt) nativeaot $(buildConfigUpper) ${{ parameters.archType }} $(crossArg) $(_officialBuildParameter) ci wasi tree nativeaot /p:LibrariesConfiguration=${{ parameters.librariesConfiguration }} + displayName: Build WebAssembly Mutlithread tests - ${{ elseif eq(parameters.platform, 'Browser_wasm_linux_x64_naot_llvm') }}: - script: | source $(Build.SourcesDirectory)/wasm-tools/emsdk/emsdk_env.sh From 94dd7e8adc1ffeab2e5a2b3d32aef478ee6f3edc Mon Sep 17 00:00:00 2001 From: yowl Date: Sun, 11 May 2025 17:20:06 -0500 Subject: [PATCH 47/59] yml --- eng/pipelines/runtimelab/runtimelab-post-build-steps.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/runtimelab/runtimelab-post-build-steps.yml b/eng/pipelines/runtimelab/runtimelab-post-build-steps.yml index b9ab7e0f3723..561da028cbcb 100644 --- a/eng/pipelines/runtimelab/runtimelab-post-build-steps.yml +++ b/eng/pipelines/runtimelab/runtimelab-post-build-steps.yml @@ -58,7 +58,7 @@ steps: - script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) nativeaot $(buildConfigUpper) ${{ parameters.archType }} $(crossArg) $(_officialBuildParameter) ci 'tree nativeaot' /p:LibrariesConfiguration=${{ parameters.librariesConfiguration }} displayName: Build tests - - ${{ if in(parameters.platform, 'browser_wasm_win', 'wasi_wasm_win') }}: + - ${{ if in(parameters.platform, 'browser_wasm_win', 'wasi_wasm_win', 'wasi_multithread_wasm_win') }}: - script: | call $(Build.SourcesDirectory)\wasm-tools\emsdk\emsdk_env $(Build.SourcesDirectory)/src/tests/run$(scriptExt) runnativeaottests $(buildConfigUpper) ${{ parameters.archType }} ${{ parameters.osGroup }} From fada9d5b42eb95b0a94c19e4d514aebb05302ff4 Mon Sep 17 00:00:00 2001 From: yowl Date: Mon, 19 May 2025 21:55:07 -0500 Subject: [PATCH 48/59] disable failing tests --- .../runtimelab-post-build-steps.yml | 5 +- src/coreclr/nativeaot/CMakeLists.txt | 4 + .../nativeaot/Runtime/unix/PalRedhawkUnix.cpp | 2 + .../nativeaot/Runtime/wasm/PalRedhawkWasm.cpp | 176 ++++++++++++++++++ .../nativeaot/Runtime/wasm/PalRedhawkWasm.h | 5 +- src/tests/Common/dirs.proj | 3 + src/tests/build.proj | 1 + .../SmokeTests/HelloWasm/HelloWasm.cs | 2 + .../SmokeTests/HelloWasm/HelloWasm.csproj | 1 + 9 files changed, 197 insertions(+), 2 deletions(-) diff --git a/eng/pipelines/runtimelab/runtimelab-post-build-steps.yml b/eng/pipelines/runtimelab/runtimelab-post-build-steps.yml index 561da028cbcb..e424aca50228 100644 --- a/eng/pipelines/runtimelab/runtimelab-post-build-steps.yml +++ b/eng/pipelines/runtimelab/runtimelab-post-build-steps.yml @@ -58,11 +58,14 @@ steps: - script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) nativeaot $(buildConfigUpper) ${{ parameters.archType }} $(crossArg) $(_officialBuildParameter) ci 'tree nativeaot' /p:LibrariesConfiguration=${{ parameters.librariesConfiguration }} displayName: Build tests - - ${{ if in(parameters.platform, 'browser_wasm_win', 'wasi_wasm_win', 'wasi_multithread_wasm_win') }}: + - ${{ if in(parameters.platform, 'browser_wasm_win', 'wasi_wasm_win') }}: - script: | call $(Build.SourcesDirectory)\wasm-tools\emsdk\emsdk_env $(Build.SourcesDirectory)/src/tests/run$(scriptExt) runnativeaottests $(buildConfigUpper) ${{ parameters.archType }} ${{ parameters.osGroup }} displayName: Run WebAssembly tests in single file mode + - ${{ elseif eq(parameters.platform, 'wasi_multithread_wasm_win') }}: + - script: $(Build.SourcesDirectory)/src/tests/run$(scriptExt) runnativeaottests $(buildConfigUpper) ${{ parameters.archType }} ${{ parameters.osGroup }} msbuild /p:FeatureWasmManagedThreads=true + displayName: Run WebAssembly multithread tests in single file mode - ${{ elseif eq(parameters.osGroup, 'windows') }}: - script: $(Build.SourcesDirectory)/src/tests/run$(scriptExt) runnativeaottests $(buildConfigUpper) ${{ parameters.archType }} ${{ parameters.osGroup }} displayName: Run tests in single file mode diff --git a/src/coreclr/nativeaot/CMakeLists.txt b/src/coreclr/nativeaot/CMakeLists.txt index aff6c47180c9..77e51e417bcb 100644 --- a/src/coreclr/nativeaot/CMakeLists.txt +++ b/src/coreclr/nativeaot/CMakeLists.txt @@ -30,6 +30,10 @@ endif (CLR_CMAKE_HOST_UNIX) if(CLR_CMAKE_TARGET_OS STREQUAL wasi) add_definitions(-DTARGET_UNIX) + + if(CLR_CMAKE_TARGET_OS_SUBGROUP STREQUAL multithread) + add_definitions(-DFEATURE_WASM_MANAGED_THREADS) + endif(CLR_CMAKE_TARGET_OS_SUBGROUP STREQUAL multithread) endif(CLR_CMAKE_TARGET_OS STREQUAL wasi) if(CLR_CMAKE_TARGET_ANDROID) diff --git a/src/coreclr/nativeaot/Runtime/unix/PalRedhawkUnix.cpp b/src/coreclr/nativeaot/Runtime/unix/PalRedhawkUnix.cpp index 5456ed029459..3448494fbce8 100644 --- a/src/coreclr/nativeaot/Runtime/unix/PalRedhawkUnix.cpp +++ b/src/coreclr/nativeaot/Runtime/unix/PalRedhawkUnix.cpp @@ -1151,6 +1151,8 @@ REDHAWK_PALEXPORT bool PalGetMaximumStackBounds(_Out_ void** ppStackLowOut, _Out { #if defined(HOST_WASM) && !defined(FEATURE_WASM_MANAGED_THREADS) PalGetMaximumStackBounds_SingleThreadedWasm(&pStackLowOut, &pStackHighOut); +#elif defined(HOST_WASM) && defined(FEATURE_WASM_MANAGED_THREADS) + PalGetMaximumStackBounds_MultiThreadedWasm(&pStackLowOut, &pStackHighOut); #elif defined(__APPLE__) // This is a Mac specific method pStackHighOut = pthread_get_stackaddr_np(pthread_self()); diff --git a/src/coreclr/nativeaot/Runtime/wasm/PalRedhawkWasm.cpp b/src/coreclr/nativeaot/Runtime/wasm/PalRedhawkWasm.cpp index a210ddaa4245..fdc68eca0f4d 100644 --- a/src/coreclr/nativeaot/Runtime/wasm/PalRedhawkWasm.cpp +++ b/src/coreclr/nativeaot/Runtime/wasm/PalRedhawkWasm.cpp @@ -191,6 +191,182 @@ extern "C" int __cxa_thread_atexit(Dtor dtor, void* obj, void*) #endif // TARGET_WASI #endif // !FEATURE_WASM_MANAGED_THREADS +// TODO-LLVM: For now, a copy of the single threaded implementation. +#ifdef FEATURE_WASM_MANAGED_THREADS +int __cxa_thread_atexit(void (*func)(), void *obj, void *dso_symbol) +{} + +// +// Note that we return the native stack bounds here, not shadow stack ones. Currently this functionality is mainly +// used for RuntimeHelpers.TryEnsureSufficientExecutionStack, and we do use the native stack in codegen, so this +// is an acceptable approximation. +// +extern "C" unsigned char __stack_low; +extern "C" unsigned char __stack_high; +void PalGetMaximumStackBounds_MultiThreadedWasm(void** ppStackLowOut, void** ppStackHighOut) +{ + // See https://github.com/emscripten-core/emscripten/pull/18057 and https://reviews.llvm.org/D135910. + unsigned char* pStackLow = &__stack_low; + unsigned char* pStackHigh = &__stack_high; + + // Sanity check that we have the expected memory layout. + ASSERT((pStackHigh - pStackLow) >= 64 * 1024); + if (pStackLow >= pStackHigh) + { + PalPrintFatalError("\nFatal error. Unexpected stack layout.\n"); + RhFailFast(); + } + + *ppStackLowOut = pStackLow; + *ppStackHighOut = pStackHigh; +} + +#ifdef TARGET_WASI +// No-op stubs that assume a single-threaded environment. +int pthread_mutex_init(pthread_mutex_t *, const pthread_mutexattr_t *) +{ + return 0; +} + +int pthread_mutexattr_init(pthread_mutexattr_t *) +{ + return 0; +} + +int pthread_mutexattr_settype(pthread_mutexattr_t *, int) +{ + return 0; +} + +int pthread_mutex_destroy(pthread_mutex_t *) +{ + return 0; +} + +int pthread_mutexattr_destroy(pthread_mutexattr_t *) +{ + return 0; +} + +int pthread_cond_init(pthread_cond_t *, const pthread_condattr_t *) +{ + return 0; +} + +int pthread_cond_destroy(pthread_cond_t *) +{ + return 0; +} + +int pthread_cond_wait(pthread_cond_t *, pthread_mutex_t *) +{ + return 0; +} + +int pthread_cond_timedwait(pthread_cond_t *, pthread_mutex_t *, const struct timespec *) +{ + return 0; +} + +int pthread_condattr_init(pthread_condattr_t *) +{ + return 0; +} + +int pthread_mutex_lock(pthread_mutex_t *) +{ + return 0; +} + +int pthread_mutex_unlock(pthread_mutex_t *) +{ + return 0; +} + +pthread_t pthread_self(void) +{ + return (pthread_t)0; +} + +int pthread_equal(pthread_t, pthread_t) +{ + return 1; // only one thread +} + +int pthread_attr_init(pthread_attr_t *) +{ + return 0; +} + +int pthread_attr_destroy(pthread_attr_t *) +{ + return 0; +} + +int pthread_condattr_destroy(pthread_condattr_t *) +{ + return 0; +} + +int pthread_cond_broadcast(pthread_cond_t *) +{ + return 0; +} + +int pthread_attr_setdetachstate(pthread_attr_t *, int) +{ + return 0; +} + +using Dtor = void(*)(void*); + +// Due to a bug in the toolchain, we have to provide an implementation of thread-local destruction. +// Since this is the single-threaded case, we simply delegate to the static destruction mechanism. +// Reference: https://github.com/llvm/llvm-project/blob/main/libcxxabi/src/cxa_thread_atexit.cpp. +// +extern "C" int __cxa_thread_atexit(Dtor dtor, void* obj, void*) +{ + struct DtorList + { + Dtor dtor; + void* obj; + DtorList* next; + }; + + struct DtorsManager + { + DtorList* m_dtors = nullptr; + + ~DtorsManager() + { + while (DtorList* head = m_dtors) + { + m_dtors = head->next; + head->dtor(head->obj); + free(head); + } + } + }; + + // The linked list of "thread-local" destructors to run. + static DtorsManager s_dtorsManager; + + DtorList* head = static_cast(malloc(sizeof(DtorList))); + if (head == nullptr) + { + return -1; + } + + head->dtor = dtor; + head->obj = obj; + head->next = s_dtorsManager.m_dtors; + s_dtorsManager.m_dtors = head; + + return 0; +} +#endif // TARGET_WASI +#endif // FEATURE_WASM_MANAGED_THREADS + // Recall that WASM's model is extremely simple: we have one linear memory, which can only be grown, in chunks // of 64K pages. Thus, "mmap"/"munmap" fundamentally cannot be faithfully recreated and the Unix emulators we // layer on top of (Emscripten/WASI libc) reflect this by not supporting the scenario. Fortunately, the current diff --git a/src/coreclr/nativeaot/Runtime/wasm/PalRedhawkWasm.h b/src/coreclr/nativeaot/Runtime/wasm/PalRedhawkWasm.h index 3030a582b58a..ff75454e6aba 100644 --- a/src/coreclr/nativeaot/Runtime/wasm/PalRedhawkWasm.h +++ b/src/coreclr/nativeaot/Runtime/wasm/PalRedhawkWasm.h @@ -1,6 +1,9 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -#ifndef FEATURE_WASM_MANAGED_THREADS +#ifdef FEATURE_WASM_MANAGED_THREADS +int __cxa_thread_atexit(void (*func)(), void *obj, void *dso_symbol); +void PalGetMaximumStackBounds_MultiThreadedWasm(void** ppStackLowOut, void** ppStackHighOut); +#else void PalGetMaximumStackBounds_SingleThreadedWasm(void** ppStackLowOut, void** ppStackHighOut); #endif // !FEATURE_WASM_MANAGED_THREADS diff --git a/src/tests/Common/dirs.proj b/src/tests/Common/dirs.proj index 6e1283eeb4e9..adea40af0647 100644 --- a/src/tests/Common/dirs.proj +++ b/src/tests/Common/dirs.proj @@ -29,6 +29,9 @@ + + + diff --git a/src/tests/build.proj b/src/tests/build.proj index 66652353a200..68e411a122f7 100644 --- a/src/tests/build.proj +++ b/src/tests/build.proj @@ -490,6 +490,7 @@ $(GroupBuildCmd) "/p:MonoForceInterpreter=true" $(GroupBuildCmd) "/p:RunAOTCompilation=true" $(GroupBuildCmd) "/p:DevTeamProvisioning=$(DevTeamProvisioning)" + $(GroupBuildCmd) "/p:FeatureWasmManagedThreads=$(FeatureWasmManagedThreads)" diff --git a/src/tests/nativeaot/SmokeTests/HelloWasm/HelloWasm.cs b/src/tests/nativeaot/SmokeTests/HelloWasm/HelloWasm.cs index 0d8dd70eccf4..2c856609e13e 100644 --- a/src/tests/nativeaot/SmokeTests/HelloWasm/HelloWasm.cs +++ b/src/tests/nativeaot/SmokeTests/HelloWasm/HelloWasm.cs @@ -40,7 +40,9 @@ private static unsafe int Main(string[] args) TestMetaData(); TestGC(); +#if !NO_EXPLICIT_FINALIZER TestFinalization(); +#endif Add(1, 2); PrintLine("Hello from C#!"); diff --git a/src/tests/nativeaot/SmokeTests/HelloWasm/HelloWasm.csproj b/src/tests/nativeaot/SmokeTests/HelloWasm/HelloWasm.csproj index df4345c5e749..ee681a5b67f3 100644 --- a/src/tests/nativeaot/SmokeTests/HelloWasm/HelloWasm.csproj +++ b/src/tests/nativeaot/SmokeTests/HelloWasm/HelloWasm.csproj @@ -10,6 +10,7 @@ true false true + $(DefineConstants);NO_EXPLICIT_FINALIZER From 1fc774ff9935e4c611200ee578b999a8de8cc33c Mon Sep 17 00:00:00 2001 From: yowl Date: Tue, 20 May 2025 17:38:41 -0500 Subject: [PATCH 49/59] disable failing tests --- eng/pipelines/runtimelab/runtimelab-post-build-steps.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/pipelines/runtimelab/runtimelab-post-build-steps.yml b/eng/pipelines/runtimelab/runtimelab-post-build-steps.yml index e424aca50228..cddb8790cb9f 100644 --- a/eng/pipelines/runtimelab/runtimelab-post-build-steps.yml +++ b/eng/pipelines/runtimelab/runtimelab-post-build-steps.yml @@ -39,7 +39,7 @@ steps: displayName: Build WebAssembly tests - ${{ elseif eq(parameters.platform, 'wasi_multithread_wasm_win') }}: - script: | - $(Build.SourcesDirectory)/src/tests/build$(scriptExt) nativeaot $(buildConfigUpper) ${{ parameters.archType }} $(crossArg) $(_officialBuildParameter) ci wasi tree nativeaot /p:LibrariesConfiguration=${{ parameters.librariesConfiguration }} + $(Build.SourcesDirectory)/src/tests/build$(scriptExt) nativeaot $(buildConfigUpper) ${{ parameters.archType }} $(crossArg) $(_officialBuildParameter) ci wasi tree nativeaot /p:LibrariesConfiguration=${{ parameters.librariesConfiguration }} msbuild /p:FeatureWasmManagedThreads=true displayName: Build WebAssembly Mutlithread tests - ${{ elseif eq(parameters.platform, 'Browser_wasm_linux_x64_naot_llvm') }}: - script: | @@ -64,7 +64,7 @@ steps: $(Build.SourcesDirectory)/src/tests/run$(scriptExt) runnativeaottests $(buildConfigUpper) ${{ parameters.archType }} ${{ parameters.osGroup }} displayName: Run WebAssembly tests in single file mode - ${{ elseif eq(parameters.platform, 'wasi_multithread_wasm_win') }}: - - script: $(Build.SourcesDirectory)/src/tests/run$(scriptExt) runnativeaottests $(buildConfigUpper) ${{ parameters.archType }} ${{ parameters.osGroup }} msbuild /p:FeatureWasmManagedThreads=true + - script: $(Build.SourcesDirectory)/src/tests/run$(scriptExt) runnativeaottests $(buildConfigUpper) ${{ parameters.archType }} ${{ parameters.osGroup }} displayName: Run WebAssembly multithread tests in single file mode - ${{ elseif eq(parameters.osGroup, 'windows') }}: - script: $(Build.SourcesDirectory)/src/tests/run$(scriptExt) runnativeaottests $(buildConfigUpper) ${{ parameters.archType }} ${{ parameters.osGroup }} From df2c5e38fc66bb083e38f9b49891921437f4494d Mon Sep 17 00:00:00 2001 From: yowl Date: Thu, 22 May 2025 17:46:07 -0500 Subject: [PATCH 50/59] disable failing tests --- eng/pipelines/runtimelab/runtimelab-post-build-steps.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/runtimelab/runtimelab-post-build-steps.yml b/eng/pipelines/runtimelab/runtimelab-post-build-steps.yml index cddb8790cb9f..8aa146788302 100644 --- a/eng/pipelines/runtimelab/runtimelab-post-build-steps.yml +++ b/eng/pipelines/runtimelab/runtimelab-post-build-steps.yml @@ -39,7 +39,7 @@ steps: displayName: Build WebAssembly tests - ${{ elseif eq(parameters.platform, 'wasi_multithread_wasm_win') }}: - script: | - $(Build.SourcesDirectory)/src/tests/build$(scriptExt) nativeaot $(buildConfigUpper) ${{ parameters.archType }} $(crossArg) $(_officialBuildParameter) ci wasi tree nativeaot /p:LibrariesConfiguration=${{ parameters.librariesConfiguration }} msbuild /p:FeatureWasmManagedThreads=true + $(Build.SourcesDirectory)/src/tests/build$(scriptExt) nativeaot $(buildConfigUpper) ${{ parameters.archType }} $(crossArg) $(_officialBuildParameter) ci wasi tree nativeaot /p:LibrariesConfiguration=${{ parameters.librariesConfiguration }} /p:FeatureWasmManagedThreads=true displayName: Build WebAssembly Mutlithread tests - ${{ elseif eq(parameters.platform, 'Browser_wasm_linux_x64_naot_llvm') }}: - script: | From 911f2e002b3e413119db20f93c30c72bc71c2568 Mon Sep 17 00:00:00 2001 From: yowl Date: Thu, 22 May 2025 20:42:44 -0500 Subject: [PATCH 51/59] yml --- eng/pipelines/runtimelab.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/runtimelab.yml b/eng/pipelines/runtimelab.yml index bebcb8276af8..ba30c1bf50ca 100644 --- a/eng/pipelines/runtimelab.yml +++ b/eng/pipelines/runtimelab.yml @@ -83,7 +83,7 @@ extends: - wasi_multithread_wasm_win jobParameters: timeoutInMinutes: 300 - buildArgs: -s clr.aot+libs -c debug -rc $(_BuildConfig) '/p:WasmEnableThreads=true' + buildArgs: -s clr.aot+libs -c debug -rc $(_BuildConfig) -cmakeargs -DCLR_CMAKE_TARGET_OS_SUBGROUP=multithread '/p:WasmEnableThreads=true' postBuildSteps: - template: /eng/pipelines/runtimelab/runtimelab-post-build-steps.yml parameters: From bf512aaa8274eec52869deabee16ea7f9916faad Mon Sep 17 00:00:00 2001 From: yowl Date: Sat, 24 May 2025 16:53:37 -0500 Subject: [PATCH 52/59] remove trace-source --- eng/native/gen-buildsys.cmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/native/gen-buildsys.cmd b/eng/native/gen-buildsys.cmd index 23d9861bdb41..8d2d75f4e99f 100644 --- a/eng/native/gen-buildsys.cmd +++ b/eng/native/gen-buildsys.cmd @@ -102,7 +102,7 @@ if not "%__ConfigureOnly%" == "1" ( if /i "%__UseEmcmake%" == "1" ( call "!EMSDK!/emsdk_env" > nul 2>&1 && emcmake "%CMakePath%" %__ExtraCmakeParams% --no-warn-unused-cli -G "%__CmakeGenerator%" -B %__IntermediatesDir% -S %__SourceDir% ) else ( - "%CMakePath%" --trace-source=zlib-ng.cmake %__ExtraCmakeParams% --no-warn-unused-cli -G "%__CmakeGenerator%" -B %__IntermediatesDir% -S %__SourceDir% + "%CMakePath%" %__ExtraCmakeParams% --no-warn-unused-cli -G "%__CmakeGenerator%" -B %__IntermediatesDir% -S %__SourceDir% ) if "%errorlevel%" == "0" ( From d336a2aebedbda7d49877663853f940ed70f10a2 Mon Sep 17 00:00:00 2001 From: yowl Date: Sat, 24 May 2025 18:22:38 -0500 Subject: [PATCH 53/59] add browser package --- eng/pipelines/common/platform-matrix.yml | 19 +++++++++++++++++ .../libraries/helix-queues-setup.yml | 2 +- eng/pipelines/runtimelab.yml | 2 +- .../runtimelab-post-build-steps.yml | 8 +++++-- .../src/System.Private.CoreLib.csproj | 2 ++ .../PortableThreadPool.NativeAot.Browser.cs | 19 +++++++++++++++++ .../Threading/ThreadPool.NativeAot.Browser.cs | 11 ++++++++++ .../Browser/Interop.Runtime.NativeAOT.cs | 21 +++++++++++++++++++ src/native/external/zlib-ng.cmake | 7 +++++-- 9 files changed, 85 insertions(+), 6 deletions(-) create mode 100644 src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/PortableThreadPool.NativeAot.Browser.cs create mode 100644 src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/ThreadPool.NativeAot.Browser.cs diff --git a/eng/pipelines/common/platform-matrix.yml b/eng/pipelines/common/platform-matrix.yml index 36d3d7d8e9d9..d427599f2e33 100644 --- a/eng/pipelines/common/platform-matrix.yml +++ b/eng/pipelines/common/platform-matrix.yml @@ -519,6 +519,25 @@ jobs: buildConfig: ${{ parameters.buildConfig }} ${{ insert }}: ${{ parameters.jobParameters }} +- ${{ if containsValue(parameters.platforms, 'browser_multithread_wasm_win') }}: + - template: xplat-setup.yml + parameters: + jobTemplate: ${{ parameters.jobTemplate }} + helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} + variables: ${{ parameters.variables }} + osGroup: browser + osSubgroup: multithread + archType: wasm + targetRid: browser-wasm + platform: browser_multithread_wasm_win + shouldContinueOnError: ${{ parameters.shouldContinueOnError }} + jobParameters: + hostedOs: windows + runtimeFlavor: ${{ parameters.runtimeFlavor }} + stagedBuild: ${{ parameters.stagedBuild }} + buildConfig: ${{ parameters.buildConfig }} + ${{ insert }}: ${{ parameters.jobParameters }} + # Browser WebAssembly Linux X64 for NAOT-LLVM # Use a different name to differentiate from upstream as we need the -sanitizer image to get build tools that are not present in the stock browser_wasm image. diff --git a/eng/pipelines/libraries/helix-queues-setup.yml b/eng/pipelines/libraries/helix-queues-setup.yml index 3bf8ad250179..49c46621806b 100644 --- a/eng/pipelines/libraries/helix-queues-setup.yml +++ b/eng/pipelines/libraries/helix-queues-setup.yml @@ -175,7 +175,7 @@ jobs: - (Ubuntu.2204.Amd64)Ubuntu.2204.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-22.04-helix-webassembly # Browser WebAssembly windows - - ${{ if in(parameters.platform, 'browser_wasm_win', 'wasi_wasm_win', 'wasi_multithread_wasm_win') }}: + - ${{ if in(parameters.platform, 'browser_wasm_win', 'wasi_wasm_win', 'browser_multithread_wasm_win', 'wasi_multithread_wasm_win') }}: - (Windows.Amd64.Server2022.Open)windows.amd64.server2022.open@mcr.microsoft.com/dotnet-buildtools/prereqs:windowsservercore-ltsc2022-helix-webassembly - (Windows.Server2025.Amd64.Open)windows.server2025.amd64.open@mcr.microsoft.com/dotnet-buildtools/prereqs:windowsservercore-ltsc2025-helix-webassembly-amd64 diff --git a/eng/pipelines/runtimelab.yml b/eng/pipelines/runtimelab.yml index ba30c1bf50ca..e07909b023a9 100644 --- a/eng/pipelines/runtimelab.yml +++ b/eng/pipelines/runtimelab.yml @@ -80,6 +80,7 @@ extends: helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml buildConfig: debug platforms: + - browser_multithread_wasm_win - wasi_multithread_wasm_win jobParameters: timeoutInMinutes: 300 @@ -121,7 +122,6 @@ extends: - windows_x64 - Browser_wasm_win - wasi_wasm_win -# - wasi_multithread_wasm_win - wasi_wasm_linux_x64_naot_llvm - Browser_wasm_linux_x64_naot_llvm jobParameters: diff --git a/eng/pipelines/runtimelab/runtimelab-post-build-steps.yml b/eng/pipelines/runtimelab/runtimelab-post-build-steps.yml index 8aa146788302..b9199ba75607 100644 --- a/eng/pipelines/runtimelab/runtimelab-post-build-steps.yml +++ b/eng/pipelines/runtimelab/runtimelab-post-build-steps.yml @@ -37,10 +37,14 @@ steps: - script: | $(Build.SourcesDirectory)/src/tests/build$(scriptExt) nativeaot $(buildConfigUpper) ${{ parameters.archType }} $(crossArg) $(_officialBuildParameter) ci wasi tree nativeaot /p:LibrariesConfiguration=${{ parameters.librariesConfiguration }} displayName: Build WebAssembly tests + - ${{ elseif eq(parameters.platform, 'browser_multithread_wasm_win') }}: + - script: | + $(Build.SourcesDirectory)/src/tests/build$(scriptExt) nativeaot $(buildConfigUpper) ${{ parameters.archType }} $(crossArg) $(_officialBuildParameter) ci browser tree nativeaot /p:LibrariesConfiguration=${{ parameters.librariesConfiguration }} /p:FeatureWasmManagedThreads=true + displayName: Build WebAssembly browser Mutlithread tests - ${{ elseif eq(parameters.platform, 'wasi_multithread_wasm_win') }}: - script: | $(Build.SourcesDirectory)/src/tests/build$(scriptExt) nativeaot $(buildConfigUpper) ${{ parameters.archType }} $(crossArg) $(_officialBuildParameter) ci wasi tree nativeaot /p:LibrariesConfiguration=${{ parameters.librariesConfiguration }} /p:FeatureWasmManagedThreads=true - displayName: Build WebAssembly Mutlithread tests + displayName: Build WebAssembly wasi Mutlithread tests - ${{ elseif eq(parameters.platform, 'Browser_wasm_linux_x64_naot_llvm') }}: - script: | source $(Build.SourcesDirectory)/wasm-tools/emsdk/emsdk_env.sh @@ -63,7 +67,7 @@ steps: call $(Build.SourcesDirectory)\wasm-tools\emsdk\emsdk_env $(Build.SourcesDirectory)/src/tests/run$(scriptExt) runnativeaottests $(buildConfigUpper) ${{ parameters.archType }} ${{ parameters.osGroup }} displayName: Run WebAssembly tests in single file mode - - ${{ elseif eq(parameters.platform, 'wasi_multithread_wasm_win') }}: + - ${{ elseif in(parameters.platform, 'browser_multithread_wasm_win', 'wasi_multithread_wasm_win') }}: - script: $(Build.SourcesDirectory)/src/tests/run$(scriptExt) runnativeaottests $(buildConfigUpper) ${{ parameters.archType }} ${{ parameters.osGroup }} displayName: Run WebAssembly multithread tests in single file mode - ${{ elseif eq(parameters.osGroup, 'windows') }}: diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System.Private.CoreLib.csproj b/src/coreclr/nativeaot/System.Private.CoreLib/src/System.Private.CoreLib.csproj index 9358aa219640..b758b1618151 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System.Private.CoreLib.csproj +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System.Private.CoreLib.csproj @@ -351,6 +351,8 @@ + + diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/PortableThreadPool.NativeAot.Browser.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/PortableThreadPool.NativeAot.Browser.cs new file mode 100644 index 000000000000..cc3f606fe627 --- /dev/null +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/PortableThreadPool.NativeAot.Browser.cs @@ -0,0 +1,19 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace System.Threading; + +internal sealed partial class PortableThreadPool +{ + private static partial class WorkerThread + { + private static bool IsIOPending => false; + } + + private struct CpuUtilizationReader + { +#pragma warning disable CA1822 + public double CurrentUtilization => 0.0; // FIXME: can we do better +#pragma warning restore CA1822 + } +} diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/ThreadPool.NativeAot.Browser.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/ThreadPool.NativeAot.Browser.cs new file mode 100644 index 000000000000..ca2656955006 --- /dev/null +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/ThreadPool.NativeAot.Browser.cs @@ -0,0 +1,11 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace System.Threading; + +public static partial class ThreadPool +{ + // Indicates whether the thread pool should yield the thread from the dispatch loop to the runtime periodically so that + // the runtime may use the thread for processing other work + internal static bool YieldFromDispatchLoop => true; +} diff --git a/src/libraries/Common/src/Interop/Browser/Interop.Runtime.NativeAOT.cs b/src/libraries/Common/src/Interop/Browser/Interop.Runtime.NativeAOT.cs index 3d2fdaae538d..cb1f96ea465b 100644 --- a/src/libraries/Common/src/Interop/Browser/Interop.Runtime.NativeAOT.cs +++ b/src/libraries/Common/src/Interop/Browser/Interop.Runtime.NativeAOT.cs @@ -28,6 +28,27 @@ internal static unsafe partial class Runtime [LibraryImport(JSLibrary, EntryPoint = "mono_wasm_cancel_promise", StringMarshalling = StringMarshalling.Utf16)] public static unsafe partial void CancelPromise(IntPtr gcHandle); +#if FEATURE_WASM_MANAGED_THREADS + [LibraryImport(JSLibrary, EntryPoint = "mono_wasm_invoke_js_function_send")] + public static unsafe partial void InvokeJSFunctionSend(nint targetNativeTID, nint functionHandle, nint data); + [LibraryImport(JSLibrary, EntryPoint = "mono_wasm_install_js_worker_interop_wrapper")] + public static unsafe partial void InstallWebWorkerInterop(nint proxyContextGCHandle, void* beforeSyncJSImport, void* afterSyncJSImport, void* pumpHandler); + [LibraryImport(JSLibrary, EntryPoint = "mono_wasm_cancel_promise_post")] + public static unsafe partial void CancelPromisePost(nint targetNativeTID, nint taskHolderGCHandle); + [LibraryImport(JSLibrary, EntryPoint = "mono_wasm_invoke_jsimport_MT")] + public static unsafe partial void InvokeJSImportSync(nint signature, nint args); + [LibraryImport(JSLibrary, EntryPoint = "mono_wasm_invoke_jsimport_sync_send")] + public static unsafe partial void InvokeJSImportSyncSend(nint targetNativeTID, nint signature, nint args); + [LibraryImport(JSLibrary, EntryPoint = "mono_wasm_invoke_jsimport_async_post")] + public static unsafe partial void InvokeJSImportAsyncPost(nint targetNativeTID, nint signature, nint args); + [LibraryImport(JSLibrary, EntryPoint = "mono_wasm_resolve_or_reject_promise_post")] + public static unsafe partial void ResolveOrRejectPromisePost(nint targetNativeTID, nint data); + [LibraryImport(JSLibrary, EntryPoint = "mono_wasm_release_cs_owned_object_post")] + internal static unsafe partial void ReleaseCSOwnedObjectPost(nint targetNativeTID, nint jsHandle); + [LibraryImport(JSLibrary, EntryPoint = "mono_wasm_uninstall_js_worker_interop")] + public static unsafe partial void UninstallWebWorkerInterop(); +#endif + #region Not used by NativeAOT public static IntPtr RegisterGCRoot(void* start, int bytesSize, IntPtr name) => throw new NotImplementedException(); public static void DeregisterGCRoot(IntPtr handle) => throw new NotImplementedException(); diff --git a/src/native/external/zlib-ng.cmake b/src/native/external/zlib-ng.cmake index 0049a1041804..99f6d6ba4f9b 100644 --- a/src/native/external/zlib-ng.cmake +++ b/src/native/external/zlib-ng.cmake @@ -26,10 +26,13 @@ if (CLR_CMAKE_TARGET_BROWSER OR CLR_CMAKE_TARGET_WASI) # zlib-ng uses atomics, so we need to enable threads when requested for browser/wasi, otherwise the wasm target won't have thread support. if (CMAKE_USE_PTHREADS) - #add_compile_options(-pthread) - #add_linker_flag(-pthread) + if (CLR_CMAKE_TARGET_BROWSER) + add_compile_options(-pthread) + add_linker_flag(-pthread) + else() add_compile_options(-D_WASI_EMULATED_PTHREAD ) add_linker_flag(-Wl,-lwasi-emulated-pthread) + endif() endif() endif() From c566eeb9794daa111807ab9449a28c3cd9eda899 Mon Sep 17 00:00:00 2001 From: yowl Date: Sat, 24 May 2025 21:27:00 -0500 Subject: [PATCH 54/59] add browser package --- src/coreclr/nativeaot/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/coreclr/nativeaot/CMakeLists.txt b/src/coreclr/nativeaot/CMakeLists.txt index 77e51e417bcb..45023e0963b7 100644 --- a/src/coreclr/nativeaot/CMakeLists.txt +++ b/src/coreclr/nativeaot/CMakeLists.txt @@ -36,6 +36,12 @@ if(CLR_CMAKE_TARGET_OS STREQUAL wasi) endif(CLR_CMAKE_TARGET_OS_SUBGROUP STREQUAL multithread) endif(CLR_CMAKE_TARGET_OS STREQUAL wasi) +if((CLR_CMAKE_TARGET_OS STREQUAL wasi OR CLR_CMAKE_TARGET_OS STREQUAL browser`) + AND CLR_CMAKE_TARGET_OS_SUBGROUP STREQUAL multithread) + add_definitions(-DFEATURE_WASM_MANAGED_THREADS) +endif((CLR_CMAKE_TARGET_OS STREQUAL wasi OR CLR_CMAKE_TARGET_OS STREQUAL browser`) + AND CLR_CMAKE_TARGET_OS_SUBGROUP STREQUAL multithread) + if(CLR_CMAKE_TARGET_ANDROID) add_definitions(-DFEATURE_EMULATED_TLS) endif() From 76851911f6f1feabd948625476976167dfbdcb64 Mon Sep 17 00:00:00 2001 From: yowl Date: Sun, 25 May 2025 14:02:03 -0500 Subject: [PATCH 55/59] add browser package --- src/coreclr/nativeaot/CMakeLists.txt | 4 ++-- .../src/System.Runtime.InteropServices.JavaScript.csproj | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/coreclr/nativeaot/CMakeLists.txt b/src/coreclr/nativeaot/CMakeLists.txt index 45023e0963b7..9353c22f1c7d 100644 --- a/src/coreclr/nativeaot/CMakeLists.txt +++ b/src/coreclr/nativeaot/CMakeLists.txt @@ -36,10 +36,10 @@ if(CLR_CMAKE_TARGET_OS STREQUAL wasi) endif(CLR_CMAKE_TARGET_OS_SUBGROUP STREQUAL multithread) endif(CLR_CMAKE_TARGET_OS STREQUAL wasi) -if((CLR_CMAKE_TARGET_OS STREQUAL wasi OR CLR_CMAKE_TARGET_OS STREQUAL browser`) +if((CLR_CMAKE_TARGET_OS STREQUAL wasi OR CLR_CMAKE_TARGET_OS STREQUAL browser) AND CLR_CMAKE_TARGET_OS_SUBGROUP STREQUAL multithread) add_definitions(-DFEATURE_WASM_MANAGED_THREADS) -endif((CLR_CMAKE_TARGET_OS STREQUAL wasi OR CLR_CMAKE_TARGET_OS STREQUAL browser`) +endif((CLR_CMAKE_TARGET_OS STREQUAL wasi OR CLR_CMAKE_TARGET_OS STREQUAL browser) AND CLR_CMAKE_TARGET_OS_SUBGROUP STREQUAL multithread) if(CLR_CMAKE_TARGET_ANDROID) diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/src/System.Runtime.InteropServices.JavaScript.csproj b/src/libraries/System.Runtime.InteropServices.JavaScript/src/System.Runtime.InteropServices.JavaScript.csproj index f26a1dbf1bdc..42b47e6e78e7 100644 --- a/src/libraries/System.Runtime.InteropServices.JavaScript/src/System.Runtime.InteropServices.JavaScript.csproj +++ b/src/libraries/System.Runtime.InteropServices.JavaScript/src/System.Runtime.InteropServices.JavaScript.csproj @@ -76,6 +76,11 @@ + + + + + From 3733abe3dbca15434cab951e20491be221c36787 Mon Sep 17 00:00:00 2001 From: yowl Date: Fri, 6 Jun 2025 22:20:59 -0500 Subject: [PATCH 56/59] browser build and tests --- eng/native/configurecompiler.cmake | 4 ++++ .../BuildIntegration/Microsoft.NETCore.Native.targets | 2 ++ src/coreclr/nativeaot/CMakeLists.txt | 8 ++------ src/coreclr/nativeaot/Runtime/wasm/PalRedhawkWasm.cpp | 4 +++- src/mono/browser/runtime/loader/polyfills.ts | 2 +- src/tests/Common/dirs.proj | 4 ++++ src/tests/build.proj | 1 + 7 files changed, 17 insertions(+), 8 deletions(-) diff --git a/eng/native/configurecompiler.cmake b/eng/native/configurecompiler.cmake index b4aaa7fedbf5..d99e6c4bacf5 100644 --- a/eng/native/configurecompiler.cmake +++ b/eng/native/configurecompiler.cmake @@ -148,6 +148,10 @@ elseif (CLR_CMAKE_HOST_UNIX) add_compile_options(-Wno-alloca) add_compile_options(-Wno-implicit-int-float-conversion) endif() + + if (CLR_CMAKE_TARGET_OS_SUBGROUP STREQUAL multithread AND CLR_CMAKE_HOST_BROWSER) + add_compile_options(-pthread) + endif(CLR_CMAKE_TARGET_OS_SUBGROUP STREQUAL multithread AND CLR_CMAKE_HOST_BROWSER) endif(MSVC) if (CLR_CMAKE_ENABLE_SANITIZERS) diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets index 91bf830300bb..c49c231b6c3f 100644 --- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets +++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets @@ -438,6 +438,7 @@ The .NET Foundation licenses this file to you under the MIT license. $(CompileWasmArgs) -g3 $(CompileWasmArgs) -mnontrapping-fptoint $(CompileWasmArgs) -fwasm-exceptions + $(CompileWasmArgs) -pthread -matomics -mbulk-memory @@ -608,6 +609,7 @@ The .NET Foundation licenses this file to you under the MIT license. + diff --git a/src/coreclr/nativeaot/CMakeLists.txt b/src/coreclr/nativeaot/CMakeLists.txt index 9353c22f1c7d..babf87150dde 100644 --- a/src/coreclr/nativeaot/CMakeLists.txt +++ b/src/coreclr/nativeaot/CMakeLists.txt @@ -30,16 +30,12 @@ endif (CLR_CMAKE_HOST_UNIX) if(CLR_CMAKE_TARGET_OS STREQUAL wasi) add_definitions(-DTARGET_UNIX) - - if(CLR_CMAKE_TARGET_OS_SUBGROUP STREQUAL multithread) - add_definitions(-DFEATURE_WASM_MANAGED_THREADS) - endif(CLR_CMAKE_TARGET_OS_SUBGROUP STREQUAL multithread) endif(CLR_CMAKE_TARGET_OS STREQUAL wasi) -if((CLR_CMAKE_TARGET_OS STREQUAL wasi OR CLR_CMAKE_TARGET_OS STREQUAL browser) +if((CLR_CMAKE_TARGET_OS STREQUAL wasi OR CLR_CMAKE_TARGET_OS STREQUAL emscripten) AND CLR_CMAKE_TARGET_OS_SUBGROUP STREQUAL multithread) add_definitions(-DFEATURE_WASM_MANAGED_THREADS) -endif((CLR_CMAKE_TARGET_OS STREQUAL wasi OR CLR_CMAKE_TARGET_OS STREQUAL browser) +endif((CLR_CMAKE_TARGET_OS STREQUAL wasi OR CLR_CMAKE_TARGET_OS STREQUAL emscripten) AND CLR_CMAKE_TARGET_OS_SUBGROUP STREQUAL multithread) if(CLR_CMAKE_TARGET_ANDROID) diff --git a/src/coreclr/nativeaot/Runtime/wasm/PalRedhawkWasm.cpp b/src/coreclr/nativeaot/Runtime/wasm/PalRedhawkWasm.cpp index fdc68eca0f4d..efcc1402ad36 100644 --- a/src/coreclr/nativeaot/Runtime/wasm/PalRedhawkWasm.cpp +++ b/src/coreclr/nativeaot/Runtime/wasm/PalRedhawkWasm.cpp @@ -194,7 +194,9 @@ extern "C" int __cxa_thread_atexit(Dtor dtor, void* obj, void*) // TODO-LLVM: For now, a copy of the single threaded implementation. #ifdef FEATURE_WASM_MANAGED_THREADS int __cxa_thread_atexit(void (*func)(), void *obj, void *dso_symbol) -{} +{ + return 0; +} // // Note that we return the native stack bounds here, not shadow stack ones. Currently this functionality is mainly diff --git a/src/mono/browser/runtime/loader/polyfills.ts b/src/mono/browser/runtime/loader/polyfills.ts index 181323b0fe0a..382d6da00d53 100644 --- a/src/mono/browser/runtime/loader/polyfills.ts +++ b/src/mono/browser/runtime/loader/polyfills.ts @@ -22,7 +22,7 @@ export function verifyEnvironment () { mono_assert(ENVIRONMENT_IS_SHELL || typeof globalThis.URL === "function", "This browser/engine doesn't support URL API. Please use a modern version. See also https://aka.ms/dotnet-wasm-features"); mono_assert(typeof globalThis.BigInt64Array === "function", "This browser/engine doesn't support BigInt64Array API. Please use a modern version. See also https://aka.ms/dotnet-wasm-features"); if (WasmEnableThreads) { - mono_assert(!ENVIRONMENT_IS_SHELL && !ENVIRONMENT_IS_NODE, "This build of dotnet is multi-threaded, it doesn't support shell environments like V8 or NodeJS. See also https://aka.ms/dotnet-wasm-features"); + //mono_assert(!ENVIRONMENT_IS_SHELL && !ENVIRONMENT_IS_NODE, "This build of dotnet is multi-threaded, it doesn't support shell environments like V8 or NodeJS. See also https://aka.ms/dotnet-wasm-features"); mono_assert(globalThis.SharedArrayBuffer !== undefined, "SharedArrayBuffer is not enabled on this page. Please use a modern browser and set Cross-Origin-Opener-Policy and Cross-Origin-Embedder-Policy http headers. See also https://aka.ms/dotnet-wasm-features"); mono_assert(typeof globalThis.EventTarget === "function", "This browser/engine doesn't support EventTarget API. Please use a modern version. See also https://aka.ms/dotnet-wasm-features"); } diff --git a/src/tests/Common/dirs.proj b/src/tests/Common/dirs.proj index adea40af0647..c78b43641a6f 100644 --- a/src/tests/Common/dirs.proj +++ b/src/tests/Common/dirs.proj @@ -32,6 +32,10 @@ + + + + diff --git a/src/tests/build.proj b/src/tests/build.proj index 68e411a122f7..990150bdb5f0 100644 --- a/src/tests/build.proj +++ b/src/tests/build.proj @@ -491,6 +491,7 @@ $(GroupBuildCmd) "/p:RunAOTCompilation=true" $(GroupBuildCmd) "/p:DevTeamProvisioning=$(DevTeamProvisioning)" $(GroupBuildCmd) "/p:FeatureWasmManagedThreads=$(FeatureWasmManagedThreads)" + $(GroupBuildCmd) "/p:WasmEnableThreads=$(WasmEnableThreads)" From 007d21fd4be3b5dd1d4e643dc67a3aaf63bd076e Mon Sep 17 00:00:00 2001 From: yowl Date: Sat, 7 Jun 2025 21:28:56 +0100 Subject: [PATCH 57/59] browser build and tests --- eng/pipelines/runtimelab/runtimelab-post-build-steps.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/runtimelab/runtimelab-post-build-steps.yml b/eng/pipelines/runtimelab/runtimelab-post-build-steps.yml index b9199ba75607..e3083dd56a16 100644 --- a/eng/pipelines/runtimelab/runtimelab-post-build-steps.yml +++ b/eng/pipelines/runtimelab/runtimelab-post-build-steps.yml @@ -39,7 +39,7 @@ steps: displayName: Build WebAssembly tests - ${{ elseif eq(parameters.platform, 'browser_multithread_wasm_win') }}: - script: | - $(Build.SourcesDirectory)/src/tests/build$(scriptExt) nativeaot $(buildConfigUpper) ${{ parameters.archType }} $(crossArg) $(_officialBuildParameter) ci browser tree nativeaot /p:LibrariesConfiguration=${{ parameters.librariesConfiguration }} /p:FeatureWasmManagedThreads=true + $(Build.SourcesDirectory)/src/tests/build$(scriptExt) nativeaot $(buildConfigUpper) ${{ parameters.archType }} $(crossArg) $(_officialBuildParameter) ci browser tree nativeaot /p:LibrariesConfiguration=${{ parameters.librariesConfiguration }} /p:FeatureWasmManagedThreads=true /p:WasmEnableThreads=true displayName: Build WebAssembly browser Mutlithread tests - ${{ elseif eq(parameters.platform, 'wasi_multithread_wasm_win') }}: - script: | From 9406c36f05e5968340cfe2625c943c658fd0b2bc Mon Sep 17 00:00:00 2001 From: yowl Date: Sun, 8 Jun 2025 12:35:23 +0100 Subject: [PATCH 58/59] run libs tests? --- eng/pipelines/runtimelab/runtimelab-post-build-steps.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/eng/pipelines/runtimelab/runtimelab-post-build-steps.yml b/eng/pipelines/runtimelab/runtimelab-post-build-steps.yml index e3083dd56a16..3777d3d103d9 100644 --- a/eng/pipelines/runtimelab/runtimelab-post-build-steps.yml +++ b/eng/pipelines/runtimelab/runtimelab-post-build-steps.yml @@ -78,8 +78,12 @@ steps: displayName: Run tests in single file mode - ${{ if eq(parameters.archType, 'wasm') }}: - - script: | - $(Build.SourcesDirectory)/build$(scriptExt) libs.tests -test -a ${{ parameters.archType }} -os ${{ parameters.osGroup }} -lc ${{ parameters.librariesConfiguration }} -rc $(buildConfigUpper) /p:TestNativeAot=true /p:RunSmokeTestsOnly=true + - ${{ if in(parameters.platform, 'browser_multithread_wasm_win', 'wasi_multithread_wasm_win') }}: + - script: | + $(Build.SourcesDirectory)/build$(scriptExt) libs.tests -test -a ${{ parameters.archType }} -os ${{ parameters.osGroup }} -lc ${{ parameters.librariesConfiguration }} -rc $(buildConfigUpper) /p:TestNativeAot=true /p:RunSmokeTestsOnly=true /p:FeatureWasmManagedThreads=true /p:WasmEnableThreads=true + - ${{ else }}: + - script: | + $(Build.SourcesDirectory)/build$(scriptExt) libs.tests -test -a ${{ parameters.archType }} -os ${{ parameters.osGroup }} -lc ${{ parameters.librariesConfiguration }} -rc $(buildConfigUpper) /p:TestNativeAot=true /p:RunSmokeTestsOnly=true displayName: Build and run WebAssembly libraries tests # Upload unsigned artifacts From c45c81607c60ec3216813a9b180787be99454c2b Mon Sep 17 00:00:00 2001 From: yowl Date: Mon, 9 Jun 2025 19:25:24 +0100 Subject: [PATCH 59/59] run libs tests? --- eng/pipelines/runtimelab/runtimelab-post-build-steps.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/eng/pipelines/runtimelab/runtimelab-post-build-steps.yml b/eng/pipelines/runtimelab/runtimelab-post-build-steps.yml index 3777d3d103d9..93532453c7cf 100644 --- a/eng/pipelines/runtimelab/runtimelab-post-build-steps.yml +++ b/eng/pipelines/runtimelab/runtimelab-post-build-steps.yml @@ -80,11 +80,12 @@ steps: - ${{ if eq(parameters.archType, 'wasm') }}: - ${{ if in(parameters.platform, 'browser_multithread_wasm_win', 'wasi_multithread_wasm_win') }}: - script: | - $(Build.SourcesDirectory)/build$(scriptExt) libs.tests -test -a ${{ parameters.archType }} -os ${{ parameters.osGroup }} -lc ${{ parameters.librariesConfiguration }} -rc $(buildConfigUpper) /p:TestNativeAot=true /p:RunSmokeTestsOnly=true /p:FeatureWasmManagedThreads=true /p:WasmEnableThreads=true + $(Build.SourcesDirectory)/build$(scriptExt) libs.tests -test -a ${{ parameters.archType }} -os ${{ parameters.osGroup }} -lc ${{ parameters.librariesConfiguration }} -rc $(buildConfigUpper) /p:TestNativeAot=true /p:RunSmokeTestsOnly=true /p:FeatureWasmManagedThreads=true /p:WasmEnableThreads=true + displayName: Build and run WebAssembly libraries tests - ${{ else }}: - script: | - $(Build.SourcesDirectory)/build$(scriptExt) libs.tests -test -a ${{ parameters.archType }} -os ${{ parameters.osGroup }} -lc ${{ parameters.librariesConfiguration }} -rc $(buildConfigUpper) /p:TestNativeAot=true /p:RunSmokeTestsOnly=true - displayName: Build and run WebAssembly libraries tests + $(Build.SourcesDirectory)/build$(scriptExt) libs.tests -test -a ${{ parameters.archType }} -os ${{ parameters.osGroup }} -lc ${{ parameters.librariesConfiguration }} -rc $(buildConfigUpper) /p:TestNativeAot=true /p:RunSmokeTestsOnly=true + displayName: Build and run WebAssembly libraries tests # Upload unsigned artifacts - ${{ if eq(parameters.uploadIntermediateArtifacts, true) }}: