fix: const-correctness in ggml-bitnet-mad.cpp + missing chrono includes (fixes #334)#422
Open
redhole-org wants to merge 1 commit intomicrosoft:mainfrom
Open
fix: const-correctness in ggml-bitnet-mad.cpp + missing chrono includes (fixes #334)#422redhole-org wants to merge 1 commit intomicrosoft:mainfrom
redhole-org wants to merge 1 commit intomicrosoft:mainfrom
Conversation
`y` is declared as `const int8_t *` (line 794) but `y_col` on line 811 drops the const qualifier by assigning to `int8_t *`. This is a const-correctness violation that compiles as a hard error on Clang with strict settings (e.g. ClangCL on Windows). Additionally, the llama.cpp submodule has missing `#include <chrono>` in `common/log.cpp` and `common/common.cpp` — both use `std::chrono::system_clock` but rely on transitive includes that only work on GCC/Apple Clang, not ClangCL. That fix should be applied to the llama.cpp submodule (Eddie-Wang1120/llama.cpp branch merge-dev).
|
Thanks, it helps but we need to update some more files with #include as mentioned here: #334 |
Author
|
@ilhangrn Good catch — you're right that #334 is a related build issue. I've updated this PR to cover both:
The chrono fix can't be committed directly here since those files live in the We validate both fixes in our CI across all three platforms (macOS ARM64, Linux x64, Windows x64): https://github.com/redhole-org/bitnet-builds/actions |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two build fixes for ClangCL (Windows) and strict compilers:
1. const-correctness in ggml-bitnet-mad.cpp (this commit)
Line 811 assigns
const int8_t* ytoint8_t* y_col, dropping the const qualifier. ClangCL and GCC with -Werror reject this.Fix:
int8_t * y_col = y->const int8_t * y_col = y2. Missing
#include <chrono>in llama.cpp submodule (fixes #334)Two files in the llama.cpp submodule use
std::chronowithout including<chrono>. This compiles on GCC/MSVC (transitive includes) but fails on ClangCL.Files needing fix:
3rdparty/llama.cpp/common/common.cpp(line 445:std::chrono::system_clock)3rdparty/llama.cpp/common/log.cpp(line 28:std::chrono::system_clock)Fix: Add
#include <chrono>to both files. Since these are in the llama.cpp submodule (Eddie-Wang1120/llama.cpp), the fix needs to be applied there and the submodule ref updated. The diff for each file is trivial — just add#include <chrono>with the other standard library includes.Verification
Both fixes are validated in CI across macOS ARM64, Linux x64, and Windows x64:
https://github.com/redhole-org/bitnet-builds/actions