-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Summary
On arm-32-linux with arm_fp16 enabled, certain JIT-compiled tests crash with SIGILL (illegal instruction). Investigation revealed that a jump table emitted by LLVM's JIT is misaligned by 2 bytes, causing jumps to land in the middle of an instruction.
Affected tests
correctness_float16_tcorrectness_vector_reductions
These fail consistently on arm-32-linux with arm_fp16 across all LLVM versions (20, 21, 22, main) when running armhf binaries on an aarch64 host.
Root cause
LLVM's RTDyld (or ORC) emits a jump table that is only 2-byte aligned instead of 4-byte aligned when targeting arm-32 with arm_fp16. ARM 32-bit instructions must be 4-byte aligned. When the jump target is misaligned, the CPU executes garbage bytes and raises SIGILL.
The problem does not occur without the arm_fp16 feature enabled.
Reproduction
Run the affected tests on an aarch64 host with arm-32 cross-compilation and fp16:
cmake -G Ninja -S . -B build \
-DCMAKE_TOOLCHAIN_FILE=cmake/toolchain.linux-arm32.cmake \
-DHalide_TARGET=arm-32-linux-arm_fp16 \
...
ctest --test-dir build -R "correctness_float16_t|correctness_vector_reductions"
Next steps
- Investigate whether this is a bug in LLVM's RTDyld or ORC JIT linker for ARM 32-bit
- File upstream LLVM bug if confirmed
- Consider whether Halide can work around the alignment issue
🤖 Generated with Claude Code