wasi-sdk: clang++ shipped with the wasi-sdk errors with LLVM ERROR: out of memory - clang++ shipped with emscripten is ok
Using the clang++ shipped with wask-sdk, which reports as 16.0.0:
E:\tmp\consolelocal>%WASI_SDK_PATH%\bin\clang++.exe --version
clang version 16.0.0
Target: wasm32-unknown-wasi
Thread model: posix
InstalledDir: e:/github/wasi-sdk/bin
it fails on windows with some input (a 25MB .bc
file) with
E:\tmp\consolelocal>%WASI_SDK_PATH%\bin\clang++.exe -fvisibility=default -mllvm -combiner-global-alias-analysis=false -mllvm -disable-lsr --sysroot=E:\GitHub\wasi-sdk\share\wasi-sysroot -c -g3 obj\Debug\net8.0\wasi-wasm\native\consoleclrjit.bc -o obj\Debug\net8.0\wasi-wasm\native\consoleclrjit.o -pthread --sysroot=%WASI_SDK_PATH%/share/wasi-sysroot -target wasm32-wasi-threads
warning: overriding the module target triple with wasm32-unknown-wasi-threads [-Woverride-module]
LLVM ERROR: out of memory
Allocation failed
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: e:\\github\\wasi-sdk\\bin\\clang++.exe -fvisibility=default -mllvm -combiner-global-alias-analysis=false -mllvm -disable-lsr --sysroot=E:\\GitHub\\wasi-sdk\\share\\wasi-sysroot -c -g3 obj\\Debug\\net8.0\\wasi-wasm\\native\\consoleclrjit.bc -o obj\\Debug\\net8.0\\wasi-wasm\\native\\consoleclrjit.o -pthread --sysroot=e:\\github\\wasi-sdk/share/wasi-sysroot -target wasm32-wasi-threads
1. Code generation
2. Running pass 'Function Pass Manager' on module 'obj\Debug\net8.0\wasi-wasm\native\consoleclrjit.bc'.
3. Running pass 'WebAssembly Instruction Selection' on function '@S_P_CoreLib_System_Globalization_UmAlQuraCalendar__InitDateMapping'
Exception Code: 0xC000001D
#0 0x0088fb73
#1 0x75b9e332
clang++: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 16.0.0
Target: wasm32-unknown-wasi-threads
Thread model: posix
InstalledDir: e:/github/wasi-sdk/bin
clang++: note: diagnostic msg: Error generating preprocessed source(s) - no preprocessable inputs.
With emscripten’s clang++ (also 16.0.0, but maybe a different commit):
E:\tmp\consolelocal>%EMSDK%\upstream\bin\clang++.exe --version
clang version 16.0.0 (https://github.com/llvm/llvm-project 8b587113b746f31b63fd6473083df78cef30a72e)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: E:\GitHub\emsdk\upstream\bin
This passes:
E:\tmp\consolelocal>%EMSDK%\upstream\bin\clang++.exe -fvisibility=default -mllvm -combiner-global-alias-analysis=false -mllvm -disable-lsr --sysroot=E:\GitHub\wasi-sdk\share\wasi-sysroot -c -g3 obj\Debug\net8.0\wasi-wasm\native\consoleclrjit.bc -o obj\Debug\net8.0\wasi-wasm\native\consoleclrjit.o -pthread --sysroot=%WASI_SDK_PATH%/share/wasi-sysroot -target wasm32-wasi-threads
warning: overriding the module target triple with wasm32-unknown-wasi-threads [-Woverride-module]
1 warning generated.
The LLVM for the function that is failing is attached, but it might not be that relevant, maybe its just run out of memory in general, this function appears 74% down the input. Also attached the complete .bc
input.
S_P_CoreLib_System_Globalization_UmAlQuraCalendar__InitDateMapping.txt consoleclrjit.zip
About this issue
- Original URL
- State: open
- Created a year ago
- Comments: 20 (4 by maintainers)
Yes, I confirm that
clang
fixes the issueSure:
wasi-sdk doesn’t use tip-of-tree llvm, so the next major llvm update would be when llvm 17 is released (which could be a while).