Proof of concept demonstrates that SHA-1 with dedicated AArch64 C intrinsics can be executed via Wasm intrinsics in Wasmtime at 1.3x native performanc

Search code, repositories, users, issues, pull requests...

submited by
Style Pass
2025-01-10 20:00:03

Proof of concept demonstrates that SHA-1 with dedicated AArch64 C intrinsics can be executed via Wasm intrinsics in Wasmtime at 1.3x native performance.

The experiment provides a proof-of-concept for a representative use case, namely the SHA-1 hash algorithm using the Cryptographic Extension on AArch64. The prototype demonstrates how C code written against ARM's C intrinsics API can be executed both natively and via Wasm. Wasm execution is achieved with a Wasm AArch64 intrinsics C API layer that serves as a drop-in replacement for native intrinsic header files. In addition, I have a fork of Wasmtime with support for intrinsic calls for a select group of AArch64 instructions. The end result is SHA-1 execution via Wasm with intrinsics at 1.3x native AArch64 performance.

These intrinsics are defined in arm_neon.h. The proof of concept provides an alternate wasm_arm_neon.h that the C code can be compiled against unchanged, and pure Wasm fallbacks that would work on any platform. However, when executed under the modified Wasmtime, calls to intrinsic functions such as vsha1h_u32 are recognized and compiled directly to the corresponding hardware instructions like SHA1H.

Leave a Comment