Skip to content

SIMD Support Seems Broken #86

@ertza

Description

@ertza

Description

When compiling and running an OpenCV-based face detection and cropping function inside hyperlight-wasm, the output image is malformed, despite the function executing without error. The same WASM when compiled and executed under wasmtime produces the correct output. Both output files attached at the end.

Reproduction Context

  • Commit: bd4423a
  • Input: 512x512 RGB image lena.jpg
  • Output: 100x100 RGB face crop
  • Toolchain:
    • C++ OpenCV application (face detection via Haarcascade), compiled to WASM using Emscripten
  • Compiler + Runtimes tested:
    • wasmtime (correct image output)
    • hyperlight-wasm (malformed output)

SIMD Instruction Comparison

The following instruction counts were extracted from both compiled WASMs:

Runtime SSE SSE2 SSE3 SSSE3 SSE4.1 SSE4.2 AVX AVX2 AVX-512 Total SIMD
Wasmtime 4,798 24,118 0 114 4,631 148 4,391 17,654 0 55,854
Hyperlight 6,638 93,573 0 0 0 0 0 0 0 100,211

Observations

  • The image output buffer length and dimensions are correct (100 x 100 x 3 = 30000 bytes).
  • The exact same WASM module produces correct output under wasmtime.
  • The issue disappears when OpenCV is compiled with SIMD disabled entirely, indicating the failure is tied to SIMD instruction execution or code generation.

Expected Behavior

Hyperlight should produce correct image output when the binary is built with SIMD enabled.

Actual Behavior

Image output is corrupted or malformed under hyperlight-wasm, also no SIMD instructions beyond SSE2 appear in the compiled binary.

Image Outputs

Hyperlight-wasm

image1

Wasmtime

image2

Metadata

Metadata

Assignees

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions