Files
turboquant/tests
Timmy Agent 4b2b8fc081
Some checks failed
Smoke Test / smoke (pull_request) Failing after 8s
[Security] Add safety wrapper and constant-time implementation
Issue #55 — security hardening for PolarQuant Turbo4 codec.

- Add llama-turbo-safety.h/.cpp with inline input validation:
  * dimension must be positive power of 2
  * all pointers non-NULL
  * decode norm > 0 (zero-norm guard)
- Inject validation into encode/decode via TURBOQUANT_CHECK macro
- Implement branchless nearest-centroid search (fixed 16-iteration loop)
- Document bounds safety in Metal kernels
- Add CMake option TURBOQUANT_ENABLE_SANITIZERS for ASan/UBSan integration
- Add tests/test_safety.py (smoke test wrapper)

Validation: standalone roundtrip tests pass; ASan build passes;
constant-time properties verified (fixed loop counts + branchless selection).

Closes #55
2026-04-26 00:54:37 -04:00
..
2026-04-15 14:53:45 +00:00