Skip to content

Commit f182ff1

Browse files
mcollinaUzlopak
andauthored
Disable SIMD for PPC64 architecture, add UNDICI_NO_WASM_SIMD env to facilitate testing (#4530)
* Disable SIMD for PPC64 architecture, add UNDICI_NO_WASM_SIMD env to facilitate testing Signed-off-by: Matteo Collina <[email protected]> * fixup Signed-off-by: Matteo Collina <[email protected]> * fixup Signed-off-by: Matteo Collina <[email protected]> * fixup Signed-off-by: Matteo Collina <[email protected]> * Update lib/dispatcher/client-h1.js Co-authored-by: Aras Abbasi <[email protected]> * Apply suggestions from code review --------- Signed-off-by: Matteo Collina <[email protected]> Co-authored-by: Aras Abbasi <[email protected]>
1 parent 95d835c commit f182ff1

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

lib/dispatcher/client-h1.js

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,26 @@ function lazyllhttp () {
6464
const llhttpWasmData = process.env.JEST_WORKER_ID ? require('../llhttp/llhttp-wasm.js') : undefined
6565

6666
let mod
67-
try {
68-
mod = new WebAssembly.Module(require('../llhttp/llhttp_simd-wasm.js'))
69-
} catch {
70-
/* istanbul ignore next */
7167

68+
// We disable wasm SIMD on ppc64 as it seems to be broken on Power 9 architectures.
69+
let useWasmSIMD = process.arch !== 'ppc64'
70+
// The Env Variable UNDICI_NO_WASM_SIMD allows explicitly overriding the default behavior
71+
if (process.env.UNDICI_NO_WASM_SIMD === '1') {
72+
useWasmSIMD = true
73+
} else if (process.env.UNDICI_NO_WASM_SIMD === '0') {
74+
useWasmSIMD = false
75+
}
76+
77+
if (useWasmSIMD) {
78+
try {
79+
mod = new WebAssembly.Module(require('../llhttp/llhttp_simd-wasm.js'))
80+
/* istanbul ignore next */
81+
} catch {
82+
}
83+
}
84+
85+
/* istanbul ignore next */
86+
if (!mod) {
7287
// We could check if the error was caused by the simd option not
7388
// being enabled, but the occurring of this other error
7489
// * https://github.com/emscripten-core/emscripten/issues/11495

0 commit comments

Comments
 (0)