Conversation
| @@ -29,4 +29,4 @@ pybind11_add_module(_C csrc/python_api.cpp) | |||
| target_link_libraries(_C PRIVATE ${TORCH_LIBRARIES} torch_python) | |||
There was a problem hiding this comment.
🔵 suggestion: Non-blocking follow-up (out of scope for this MR, as noted in the description): CUDA_SEPARABLE_COMPILATION and CUDA_NVCC_FLAGS (lines 7-10) are FindCUDA variables and are no-ops on the native CUDA language path. Modern equivalents: set_target_properties(deep_gemm_indexing_cuda PROPERTIES CUDA_SEPARABLE_COMPILATION ON) and target_compile_options(deep_gemm_indexing_cuda PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:-DENABLE_FAST_DEBUG -O3 --ptxas-options=--verbose,--register-usage-level=10,--warn-on-local-memory-usage>) (or CMAKE_CUDA_FLAGS).
🤖 v5
| @@ -29,4 +29,4 @@ pybind11_add_module(_C csrc/python_api.cpp) | |||
| target_link_libraries(_C PRIVATE ${TORCH_LIBRARIES} torch_python) | |||
There was a problem hiding this comment.
🔵 suggestion: Non-blocking follow-up: CUDA_TOOLKIT_ROOT_DIR (lines 24-25) is also a FindCUDA variable and will be empty here, so the cccl include dir and lib64/lib64/stubs link dirs resolve to relative paths. find_package(CUDAToolkit) provides CUDAToolkit_INCLUDE_DIRS, CUDAToolkit_LIBRARY_DIR, and CUDAToolkit_LIBRARY_ROOT instead. Suggest handling together with the lines 7-10 cleanup in a separate PR.
🤖 v5
| @@ -29,4 +29,4 @@ pybind11_add_module(_C csrc/python_api.cpp) | |||
| target_link_libraries(_C PRIVATE ${TORCH_LIBRARIES} torch_python) | |||
There was a problem hiding this comment.
🔵 suggestion: Not blocking for this MR, but CUDA_SEPARABLE_COMPILATION (line 7) and CUDA_NVCC_FLAGS (lines 8-10) are also FindCUDA-era variables and remain no-ops for the same reason the original cuda_add_library() call failed. Consider a follow-up PR replacing them with the modern equivalents: the CUDA_SEPARABLE_COMPILATION target property and target_compile_options(...
🤖 v4
🤖 ds-review-bot Code Reviewv6项目已启用 CUDA 语言,使用原生 add_library 创建包含 .cu 文件的静态库是正确做法,无需依赖旧版 FindCUDA 宏。未发现本次变更新增的问题;当前环境未安装 CMake,未执行配置验证。 v5This MR replaces v4The change fixes a fatal configure-time error in CMakeLists.txt. The file called cuda_add_library(), a macro provided only by the deprecated FindCUDA module, while never loading that module (it only uses find_package(CUDAToolkit)). CMake therefore aborted with 'Unknown CMake command "cuda_add_library"', so the CLion indexing support this file exists for never worked. Replacing it with plain add_library() is the correct modern-CMake fix: CUDA is already enabled via project(... LANGUAGES CXX CUDA), so the .cu source is still compiled by nvcc, and the change stays consistent with the rest of the file (CMAKE_CUDA_STANDARD, CUDAToolkit). The MR is minimal, well-scoped, and does not reintroduce find_package(CUDA), which would be deprecated and would break again under CMP0146=NEW. I verified there are no remaining cuda_add_library calls in the repository, so the fix is complete and safe to merge. Files reviewed: 1 |
cuda_add_library() comes from the deprecated FindCUDA module, which this file never loads -- it only calls find_package(CUDAToolkit) on line 16. CMake therefore aborts at configure time with: Unknown CMake command "cuda_add_library". The call has been in the file since it was added in 5bda272 ("Add CMake support for CLion indexing"), so the indexing support this file exists for has never worked. Replace it with the plain add_library() form. CUDA is already listed in project(... LANGUAGES CXX CUDA), so the .cu source still goes through nvcc without FindCUDA, and this matches the modern CMake usage in the rest of the file. Not adding find_package(CUDA) instead: FindCUDA is deprecated since CMake 3.10 and defines nothing under CMP0146=NEW, where the error comes back.
018080a to
b4dd001
Compare
CMakeLists.txtcannot configure: line 32 (nv_dev) / line 34 (main) callscuda_add_library(), which is a macro from the deprecatedFindCUDAmodule — but the file never loads that module; it only callsfind_package(CUDAToolkit)on line 16. CMake aborts with:That is fatal at configure time, so the CLion indexing support this file was added for has never worked —
cuda_add_libraryis present in the file as far back as5bda2724("Add CMake support for CLion indexing"), andfind_package(CUDA)appears in no revision of it.Reproduction
On CMake 4.4.3 a reduced case is enough — no CUDA toolkit and no torch required:
Root cause
FindCUDAdefines the command only afterfind_package(CUDA), which appears in no revision of this file:The rest of the file is already on the modern path (
project(... LANGUAGES CXX CUDA)line 3,CMAKE_CUDA_STANDARDline 22,find_package(CUDAToolkit)line 16), soFindCUDAis simply never pulled in.Fix
Plain
add_library()is the right form:CUDAis already listed inproject(... LANGUAGES ...), so the.cusource still goes through nvcc withoutFindCUDA.I deliberately did not add
find_package(CUDA).FindCUDAhas been deprecated since CMake 3.10, and withCMP0146set toNEW(or oncecmake_minimum_requiredreaches 3.27)find_package(CUDA)defines nothing and the error comes straight back:It would also contradict the
CUDAToolkitusage on line 16.Verification
Same reduced case with the one-line change:
Note
Lines 7-10 (
CUDA_SEPARABLE_COMPILATION,CUDA_NVCC_FLAGS) areFindCUDAvariables too and are currently no-ops for the same reason. I left them out to keep this to one line — happy to send that as a separate PR if you want it.Base branch
Targeting
main(the default branch).nv_devcarries the same broken line but is 108 commits ahead ofmain, so this one-line change was rebased ontomainrather than moved across; the identical change applies tonv_devif you would rather take it there.