Skip to content

[Bug]: SIGILL: Illegal Instruction Error in USearch HNSW Index Initialization #23305

@XuPeng-SH

Description

@XuPeng-SH

Is there an existing issue for the same bug?

  • I have checked the existing issues.

Branch Name

main

Commit ID

latest

Other Environment Information

- Hardware parameters:
- OS type:
- Others:

Actual Behavior

MatrixOne crashes with SIGILL: illegal instruction error when initializing HNSW vector index using the USearch library. The crash occurs during CGO execution when calling usearch.NewIndex()

2025-12-18 06:36:27.957	SIGILL: illegal instruction
2025-12-18 06:36:27.957	PC=0x7f559dcb6f83 m=8 sigcode=2
2025-12-18 06:36:27.957	signal arrived during cgo execution
2025-12-18 06:36:27.957	instruction bytes: 0x62 0xf1 0xff 0x8 0x7b 0xc3 0x49 0x89 0x5c 0x24 0x10 0x4d 0x89 0x6c 0x24 0x18

goroutine 14256 gp=0xc0110bda40 m=8 mp=0xc000900008 [syscall]:
runtime.cgocall(0x44bbad6, 0xc00fb5d5e0)
	/usr/local/go/src/runtime/cgocall.go:167 +0x4b fp=0xc00fb5d5b8 sp=0xc00fb5d580 pc=0x485c0b
github.com/unum-cloud/usearch/golang._Cfunc_usearch_init(0xc01a153100, 0xc01ad41120)
	_cgo_gotypes.go:415 +0x47 fp=0xc00fb5d5e0 sp=0xc00fb5d5b8 pc=0x18251a7
github.com/unum-cloud/usearch/golang.NewIndex.func1(...)
	/go/pkg/mod/github.com/unum-cloud/usearch/golang@v0.0.0-20251010193336-541e882da5a9/lib.go:257
github.com/unum-cloud/usearch/golang.NewIndex({0x0, 0x2, 0x80, 0x30, 0x40, 0x40, 0x0})
	/go/pkg/mod/github.com/unum-cloud/usearch/golang@v0.0.0-20251010193336-541e882da5a9/lib.go:257 +0x245 fp=0xc00fb5d660 sp=0xc00fb5d5e0 pc=0x18262e5
github.com/matrixorigin/matrixone/pkg/vectorindex/hnsw.(*HnswModel[...]).initIndex(0x62ca6e0, {{0x58b0992, 0x4}, {0x0, 0x0}, {0x0, 0x2, 0x80, 0x30, 0x40, ...}, ...})
	/go/src/github.com/matrixorigin/matrixone/pkg/vectorindex/hnsw/model.go:83 +0x72 fp=0xc00fb5d6e0 sp=0xc00fb5d660 pc=0x3ac4572

Expected Behavior

The issue is caused by a CPU instruction set mismatch between build-time and runtime environments:

  1. Build Environment: The build process in thirdparties/Makefile detects AVX512FP16 support on the build machine using lscpu | grep avx512fp16
  2. Automatic SIMSIMD Enable: When AVX512FP16 is detected, the build automatically enables USEARCH_USE_SIMSIMD=1 in CMake flags
  3. AVX-512 Compilation: This causes USearch to be compiled with AVX-512 SIMD optimizations (via SimSIMD library)
  4. Runtime Mismatch: The binary is then deployed to a Kubernetes pod running on a CPU that doesn't support AVX-512 instructions
  5. SIGILL Crash: When the code tries to execute AVX-512 instructions (instruction bytes starting with 0x62), the CPU raises SIGILL because it doesn't support these instructions

Steps to Reproduce

https://github.com/matrixorigin/matrixone/actions/runs/20327700065/job/58397450423

Additional information

The crash happens when:

  • Initializing HNSW vector index via hnsw.NewHnswModelForBuild() or hnsw.setupModel()
  • The usearch library calls usearch.NewIndex() which triggers CGO to initialize the native library
  • The native library contains AVX-512 instructions that are not supported on the runtime CPU

Metadata

Metadata

Assignees

Labels

kind/bugSomething isn't workingseverity/s0Extreme impact: Cause the application to break down and seriously affect the use

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions