Conversation
cuda_add_library() comes from the deprecated FindCUDA module, which this file never loads -- it only calls find_package(CUDAToolkit) on line 21. CMake therefore aborts at configure time with: Unknown CMake command "cuda_add_library". Replace it with the plain add_library() form. CUDA is already listed in project(... LANGUAGES CXX CUDA), so csrc/indexing/main.cu is still compiled by nvcc without FindCUDA. Not adding find_package(CUDA) instead: FindCUDA is deprecated since CMake 3.10 and defines nothing under CMP0146=NEW, where the error returns.
|
|
||
| # Enable kernel code indexing with CMake-based IDEs | ||
| cuda_add_library(deep_ep_indexing_cuda STATIC csrc/indexing/main.cu) | ||
| add_library(deep_ep_indexing_cuda STATIC csrc/indexing/main.cu) |
There was a problem hiding this comment.
🔵 suggestion: 修复本身正确:project() 已启用 CUDA 语言,add_library 会让 nvcc 编译 main.cu。一个非阻塞的可选建议:add_subdirectory(csrc) 已在第 46 行执行,此处可直接复用 add_deep_ep_library(deep_ep_indexing_cuda csrc/indexing/main.cu),让 indexing 目标与 csrc/kernels/CMakeLists.txt 中真实内核目标的编译参数一致(C++17 / CUDA_SEPARABLE_COMPILATION ON / 链接 nvshmem_device),IDE 语义分析环境会更贴近实际。注意原 cuda_add_library 会读取第 8 行的全局 CUDA_SEPARABLE_COMPILATION ON,而原生 add_library 不会,所以该目标现在不带 -rdc=true;我已确认 main.cu 包含的 impls/*.cuh 中所有 __global__ 均为模板且未实例化,不会产生设备代码,因此当前改法不会引入 unresolved extern 问题。可与描述中提到的其他 FindCUDA 遗留(CUDA_NVCC_FLAGS、CUDA_TOOLKIT_ROOT_DIR)一并放到后续 PR。
🤖 v5
🤖 ds-review-bot Code Reviewv6项目已启用 CUDA 语言,改用 add_library 可移除对 FindCUDA 宏的依赖,未发现本次变更新引入的缺陷。关联 DeepGEMM MR 采用相同修复,不涉及跨仓接口变化。当前环境缺少 CMake 和 nvcc,未执行配置或编译验证。 v5✅ 可以合并。 本 MR 仅改动 风险排查: 跨仓契约核对(deepseek-ai/DeepGEMM #437):对端 diff 与本 MR 完全同构( 可选建议(非阻塞):可改用已在 v4LGTM. The patch is a minimal, correct one-line fix. Files reviewed: 1 |
CMakeLists.txtline 52 callscuda_add_library(), a macro that only exists afterfind_package(CUDA). The file never does that — it only callsfind_package(CUDAToolkit)on line 21 — so configure aborts with:Reproduction
On CMake 4.4.3, with no CUDA toolkit and no torch required:
Fix
CUDAis already listed inproject(... LANGUAGES CXX CUDA), socsrc/indexing/main.cuis still compiled by nvcc withoutFindCUDA. No runtime behavior changes — this only makes the IDE-indexing target configurable.I did not add
find_package(CUDA)instead: it is deprecated since CMake 3.10, and underCMP0146=NEWit defines nothing, so the error comes straight back.Verification
Same reduced case with the one-line change:
Out of scope
The same
FindCUDA-era leftovers appear elsewhere in the file and are no-ops on the native CUDA-language path:CUDA_SEPARABLE_COMPILATIONandCUDA_NVCC_FLAGS(lines 8-15), andCUDA_TOOLKIT_ROOT_DIR(lines 41-42), which is empty here so those include/link dirs resolve relative. I left them alone to keep this to one line — happy to send that as a separate PR.Base branch
Targeting
main:CMakeLists.txtdoes not exist onhybrid-ep, andmainis where build/packaging fixes have landed before (#351, #627, #640).For transparency: the same one-line defect also exists in
deepseek-ai/DeepGEMM'sCMakeLists.txt, and I opened deepseek-ai/DeepGEMM#437 for it there.cc @LyricZhao — you added this file in
b306af06.