I found a way to detect but it's not work on my computer with the latest chrome enabling simd flag:
var simd = async () => WebAssembly.validate(new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 10, 9, 1, 7, 0, 65, 0, 253, 4, 26, 11]));
await simd();
Is there another way to detect?
There is an opensource library for wasm feature detection here:
https://github.com/GoogleChromeLabs/wasm-feature-detect
The way it works is that it attempts to instantiate a wasm module with the given features, catching an error should it arise (which indicates that the feature is not supported).
Here's the SIMD module it attempts to create:
https://github.com/GoogleChromeLabs/wasm-feature-detect/blob/master/src/detectors/simd/module.wat
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With