Fix: ensure bitnet-lut-kernels.h prepared before llama.cpp build#449
Open
shivansh31414 wants to merge 1 commit intomicrosoft:mainfrom
Open
Fix: ensure bitnet-lut-kernels.h prepared before llama.cpp build#449shivansh31414 wants to merge 1 commit intomicrosoft:mainfrom
shivansh31414 wants to merge 1 commit intomicrosoft:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes clean CMake configure/build failures by ensuring include/bitnet-lut-kernels.h is present before 3rdparty/llama.cpp / ggml is configured, using either a user-provided header path or a preset-kernel header selected by model + architecture.
Changes:
- Adds CMake cache variables
BITNET_PRESET_KERNEL_MODELandBITNET_LUT_KERNELS_FILEto control howbitnet-lut-kernels.his prepared. - Implements configure-time logic to copy a provided header or a preset header into
include/bitnet-lut-kernels.hbefore adding llama.cpp. - Adds a clearer fatal error when no suitable preset header can be found.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
+41
to
+50
| set(BITNET_LUT_KERNELS_DST "${CMAKE_CURRENT_SOURCE_DIR}/include/bitnet-lut-kernels.h") | ||
| if (NOT EXISTS "${BITNET_LUT_KERNELS_DST}") | ||
| file(MAKE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include") | ||
|
|
||
| if (BITNET_LUT_KERNELS_FILE) | ||
| if (NOT EXISTS "${BITNET_LUT_KERNELS_FILE}") | ||
| message(FATAL_ERROR "BITNET_LUT_KERNELS_FILE does not exist: ${BITNET_LUT_KERNELS_FILE}") | ||
| endif() | ||
| configure_file("${BITNET_LUT_KERNELS_FILE}" "${BITNET_LUT_KERNELS_DST}" COPYONLY) | ||
| message(STATUS "Prepared bitnet-lut-kernels.h from BITNET_LUT_KERNELS_FILE=${BITNET_LUT_KERNELS_FILE}") |
| add_compile_options(-fpermissive) | ||
| endif() | ||
|
|
||
| set(BITNET_LUT_KERNELS_DST "${CMAKE_CURRENT_SOURCE_DIR}/include/bitnet-lut-kernels.h") |
| set(BITNET_LUT_KERNEL_VARIANT "tl1") | ||
| elseif (GGML_BITNET_X86_TL2) | ||
| set(BITNET_LUT_KERNEL_VARIANT "tl2") | ||
| elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64|arm64)") |
Author
|
@microsoft-github-policy-service agree |
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.
Title: Fix CMake build: ensure
bitnet-lut-kernels.hprepared before llama.cppSummary
The CMake build currently fails because
include/bitnet-lut-kernels.his required at configure time but is not tracked in the source tree. This header is produced by setup scripts (setup_env.py, codegen utilities) and not by CMake itself, which breaks a cleancmake .. && makeworkflow.Problem
bitnet-lut-kernels.his missing during CMake configure.add_subdirectory(3rdparty/llama.cpp).Fix Implemented
fixes: #378
CMakeLists.txtto ensureinclude/bitnet-lut-kernels.hexists before llama.cpp is added.BITNET_PRESET_KERNEL_MODEL(default:bitnet_b1_58-3B)BITNET_LUT_KERNELS_FILE(optional explicit header path)BITNET_LUT_KERNELS_FILEis set → copy that file.preset_kernels/<model>/bitnet-lut-kernels-{tl1|tl2}.hbased on architecture.