[wasi] .NET 10: WasmEnableSIMD with AOT fails because WasiApp.targets has -msimd128 commented out

Aperta Adatta ai principianti
#136,693 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
csharp, wasm
Ambito
build-system

Direzione di ricerca

Inizia dal file .NET 10 WasiApp.targets in Microsoft.NET.Runtime.WebAssembly.Wasi.Sdk e confronta il relativo flag SIMD con la versione .NET 11. Esegui la riproduzione segnalata dotnet publish -c Release; il lavoro è completato quando la pubblicazione AOT riesce e produce un'app che stampa 42.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

area-Build-mono untriaged
Description

With the .NET 10 SDK 10.0.401 and the wasi-experimental workload 10.0.12, a wasi-wasm app with WasmEnableSIMD and RunAOTCompilation fails to publish. WasiApp.targets in Microsoft.NET.Runtime.WebAssembly.Wasi.Sdk 10.0.12 has the SIMD flag commented out:

<!--<_WasiClangCommonFlags Include="-msimd128"                         Condition="'$(WasmEnableSIMD)' == 'true'" />-->

so the AOT bitcode, which uses SIMD, is compiled by wasi-sdk's clang for a target without SIMD, and the LLVM backend aborts. The same line is active in the .NET 11 workload (11.0.0-rc.3.26522.148), so this looks like a fix that .NET 10 servicing is missing.

Found while building a SIMD-enabled Mono AOT baseline for the benchmarks of NetWasm, an ahead-of-time C# to WebAssembly compiler.

Reproduction Steps

macOS arm64, wasi-sdk 25.0 (the version the 10.0 targets expect), WASI_SDK_PATH set.

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net10.0</TargetFramework>
    <RuntimeIdentifier>wasi-wasm</RuntimeIdentifier>
    <RunAOTCompilation>true</RunAOTCompilation>
    <WasmSingleFileBundle>true</WasmSingleFileBundle>
    <WasmEnableSIMD>true</WasmEnableSIMD>
  </PropertyGroup>
</Project>
System.Console.WriteLine(42);
dotnet publish -c Release
Expected behavior

An AOT-compiled AppBundle/Hello.wasm that prints 42, as without WasmEnableSIMD.

Actual behavior
WasmApp.Common.targets(816,5): error : Failed to compile .../obj/Release/net10.0/wasi-wasm/wasm/for-publish/aot-instances.dll.bc -> .../aot-instances.dll.o
error : clang version 19.1.5-wasi-sdk (https://github.com/llvm/llvm-project ab4b5a2db582958af1ee308a790cfdb42bd24720)
error : Target: wasm32-unknown-wasip2
fatal error: error in backend: Do not know how to split this operator's operand!
Regression?

Not checked against earlier 10.0 servicing releases. The .NET 11 RC3 targets have the line enabled.

Known Workarounds

Add <WasiClangFlags>-msimd128</WasiClangFlags> to the project. With it the app publishes and prints 42 under Wasmtime.

Configuration
  • .NET SDK 10.0.401, wasi-experimental workload 10.0.12 (manifest 10.0.112)
  • wasi-sdk 25.0 (clang 19.1.5-wasi-sdk), macOS arm64
Other information

Uncommenting the -msimd128 line in the 10.0 WasiApp.targets, as in 11.0, should fix it.

Lingua principale
C#
Stelle
18.4k
Fork
5.8k
Merge medio
2g 16h
PR unite (30g)
621

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di dotnet/runtime

Tutte le issue di dotnet/runtime

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.