Fix codegen writing config.h into source tree - #3764
Open
alexioslyrakis-amd wants to merge 1 commit into
Open
Conversation
codegen/CMakeLists.txt generates config.h directly into the source tree (include/ck/config.h) instead of the build directory. This pollutes the source tree with a build artifact that lacks the #ifndef guards present in config.h.in, causing -Wmacro-redefined warnings when macros are also defined via -D flags on the command line. Write the generated config.h to CMAKE_CURRENT_BINARY_DIR instead, matching what the main CMakeLists.txt already does (line 530).
alexioslyrakis-amd
requested review from
JiaLuo-CAN,
Snektron,
afagaj,
andriy-ca,
aosewski,
bartekxk,
carlushuang,
cgmillette,
coderfeli,
geyyer,
illsilin,
poyenc,
qianfengz,
shumway,
tenpercent,
vidyasagar-amd and
vpietila-amd
as code owners
August 24, 2026 12:21
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
codegen/CMakeLists.txtusesconfigure_file()to generateconfig.hdirectly into the source tree (include/ck/config.h) instead of the build directory. This causes-Wmacro-redefinedwarnings because:config.hunconditionally#defines macros likeCK_ENABLE_INT8,CK_ENABLE_FP8, etc.-Dflags on the command line by CMakeinclude/is searched before the build-dirinclude/, so this guardless file wins over the properly generated oneThe main
CMakeLists.txt(line 530) already generatesconfig.hcorrectly into${CMAKE_CURRENT_BINARY_DIR}. This PR fixescodegen/CMakeLists.txtto do the same.Example warnings
These warnings repeat for every translation unit that includes
ck.hpp.Fix
Change
codegen/CMakeLists.txtto write the generatedconfig.hto${CMAKE_CURRENT_BINARY_DIR}instead of the source tree, matching the mainCMakeLists.txt.