Skip to content

Fix const-correctness in ggml_vec_dot_i2_i8_s_Nx1 (Clang 18)#577

Open
marcosmmorato-byte wants to merge 1 commit into
microsoft:mainfrom
marcosmmorato-byte:fix/const-correctness-ggml-bitnet-mad
Open

Fix const-correctness in ggml_vec_dot_i2_i8_s_Nx1 (Clang 18)#577
marcosmmorato-byte wants to merge 1 commit into
microsoft:mainfrom
marcosmmorato-byte:fix/const-correctness-ggml-bitnet-mad

Conversation

@marcosmmorato-byte

Copy link
Copy Markdown

y_col was declared as int8_t* but initialized from y, which is
const int8_t*. This fails to compile under stricter Clang versions
(e.g. Clang 18.1.8, bundled with the VS2022 Build Tools ClangCL
toolset used on Windows).

Minimal type fix, no behavior change.

y_col estaba declarado como int8_t* pero se inicializaba desde un puntero const (y), lo cual falla al compilar con Clang 18.1.8 (toolset ClangCL de VS2022 BuildTools en Windows).
@kay-ws

kay-ws commented Jun 28, 2026

Copy link
Copy Markdown

Confirming this isn't Windows-specific — the same error reproduces on Linux with Clang 19.

Environment: Debian 13, Clang 19.1.7, building through the standard python setup_env.py -md models/BitNet-b1.58-2B-4T -q i2_s flow (which sets -DCMAKE_C_COMPILER=clang). Compilation fails in ggml_vec_dot_i2_i8_s_Nx1:

src/ggml-bitnet-mad.cpp:811:18: error: cannot initialize a variable of type 'int8_t *' (aka 'signed char *') with an rvalue of type 'const int8_t *' (aka 'const signed char *')

The one-line const change in this PR fixes it; the build then completes and inference runs correctly (i2_s, bitnet-b1.58-2B-4T). So this looks needed for Clang ≥ 18 in general, not just the VS2022 ClangCL toolset.

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.

2 participants