Skip to content

Fix Windows MSVC build: hoist CB*_I8_RECIP out of __ARM_NEON guard#17

Merged
unamedkr merged 1 commit intomainfrom
fix/windows-msvc-cb-i8-recip
Apr 8, 2026
Merged

Fix Windows MSVC build: hoist CB*_I8_RECIP out of __ARM_NEON guard#17
unamedkr merged 1 commit intomainfrom
fix/windows-msvc-cb-i8-recip

Conversation

@unamedkr
Copy link
Copy Markdown
Collaborator

@unamedkr unamedkr commented Apr 8, 2026

Summary

Fixes the 8 consecutive Windows CI failures since Round 10 (commit 24136353619). All recent CI runs on main are red on windows-latest (x64) with:

src\core\tq_turbo_kv.c(365,33): error C2065: 'CB3_I8_RECIP': undeclared identifier
src\core\tq_turbo_kv.c(585,33): error C2065: 'CB_I8_RECIP': undeclared identifier
src\core\tq_turbo_kv.c(1324,33): error C2065: 'CB5_I8_RECIP': undeclared identifier

Root cause

Round 10/11 added three int8 codebook reciprocal constants inside #ifdef __ARM_NEON blocks:

#ifdef __ARM_NEON
    static int8_t s_cb3_i8[16] = {0};
    static int s_cb3_i8_init = 0;
    static const float CB3_I8_RECIP = 2.1520f / 127.0f;   // ← trapped inside guard
    ...
#endif

    for (int seq = 0; seq < seq_len; seq++) {
        ...
        float per_block_scale = CB3_I8_RECIP / inv_std;   // ← used outside guard

NEON builds happened to compile because the guard contains the declaration in the same translation unit. MSVC x64 (no __ARM_NEON) sees the use without the declaration and errors out.

Fix

Hoist all three static const float CB*_I8_RECIP declarations one line above their #ifdef __ARM_NEON openings. They're plain floats, not NEON-typed. Six insertions, three deletions, no behavior change.

Test plan

  • macOS arm64 NEON build (cmake --build build) — passes
  • Windows MSVC x64 CI — needs this PR's run
  • Linux x86_64 CI

🤖 Generated with Claude Code

Round 11 introduced three int8 codebook reciprocal constants
(CB3_I8_RECIP, CB_I8_RECIP, CB5_I8_RECIP) inside #ifdef __ARM_NEON
blocks, but the per_block_scale computation that uses them lives
*outside* the guard and runs on every platform. NEON builds happened
to compile; MSVC x64 errored with C2065 undeclared identifier on
tq_turbo_kv.c lines 365, 585, 1324.

These are plain `static const float`s, not NEON-typed — hoist them
out of the guards so all platforms see the declarations. No
behavior change.

Fixes 8 consecutive Windows CI failures since Round 10.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@unamedkr unamedkr merged commit 7abf5be into main Apr 8, 2026
3 checks passed
@unamedkr unamedkr deleted the fix/windows-msvc-cb-i8-recip branch April 8, 2026 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant