Skip to content

Commit 2810be7

Browse files
authored
[TRTLLM-9211][infra] Minor fixes to 3rdparty/CMakelists (#9365)
This change addresses the nitpick comments from coderabbit on the previous pull request !8986. None of the changes appear to be critical as the build is healthy without them, but they should provide some protection against future breakages if we change CMake version or or modify other build logic. This change consists of the following: 1. Add GIT_SUBMODULE_RECURSE ON to FetchContent_Declare calls for deepgemm and flashmla to ensure submodules are initialized in cmake versions where it is not the default. 2. Modify error messages in deep_gemm and flash_mla CMakeLists to indicate that submodule initialization failed if the expected submodule directories are not present. 3. Remove the NVTX include directories if the build is configured with NVTX_DISABLE off, to avoid potential confusions if NVTX is included on the compile commands when disabled. 4. Fix a minor CMake syntax issue in cpp/CMakeLists.txt where a message() call was missing parentheses around a string. Signed-off-by: Josh Bialkowski <[email protected]> Co-authored-by: Josh Bialkowski <[email protected]>
1 parent af72d93 commit 2810be7

File tree

4 files changed

+20
-11
lines changed

4 files changed

+20
-11
lines changed

3rdparty/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ FetchContent_Declare(
4040
deepgemm
4141
GIT_REPOSITORY https://github.com/ruoqianguo/DeepGEMM
4242
GIT_TAG 9fa5965e265e27995f539e0dd73a06351a8a9eaf
43+
GIT_SUBMODULES_RECURSE
44+
ON
4345
SOURCE_SUBDIR
4446
dont-add-this-project-with-add-subdirectory)
4547

@@ -53,6 +55,8 @@ FetchContent_Declare(
5355
flashmla
5456
GIT_REPOSITORY https://github.com/deepseek-ai/FlashMLA.git
5557
GIT_TAG 1408756a88e52a25196b759eaf8db89d2b51b5a1
58+
GIT_SUBMODULES_RECURSE
59+
ON
5660
SOURCE_SUBDIR
5761
dont-add-this-project-with-add-subdirectory)
5862

cpp/CMakeLists.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,14 +270,18 @@ if(BUILD_DEEP_GEMM)
270270
FetchContent_MakeAvailable(deepgemm)
271271
endif()
272272

273+
if(NOT NVTX_DISABLE)
274+
set(maybe_nvtx_includedir ${CMAKE_BINARY_DIR}/_deps/nvtx-src/include)
275+
endif()
276+
273277
# include as system to suppress warnings
274278
include_directories(
275279
SYSTEM
276280
${CUDAToolkit_INCLUDE_DIRS}
277281
${CUDAToolkit_INCLUDE_DIRS}/cccl
278282
${CUDNN_ROOT_DIR}/include
279283
$<TARGET_PROPERTY:TensorRT::NvInfer,INTERFACE_INCLUDE_DIRECTORIES>
280-
${CMAKE_BINARY_DIR}/_deps/nvtx-src/include
284+
${maybe_nvtx_includedir}
281285
${CMAKE_BINARY_DIR}/_deps/cutlass-src/include
282286
${CMAKE_BINARY_DIR}/_deps/cutlass-src/tools/util/include
283287
${CMAKE_BINARY_DIR}/_deps/json-src/include)
@@ -494,7 +498,7 @@ print(os.path.dirname(torch.__file__),end='');"
494498
endif()
495499
list(APPEND CMAKE_PREFIX_PATH ${TORCH_DIR})
496500
set(USE_SYSTEM_NVTX ON)
497-
set(nvtx3_dir ${3RDPARTY_DIR}/NVTX/include)
501+
set(nvtx3_dir ${CMAKE_BINARY_DIR}/_deps/nvtx-src/include)
498502
set(CMAKE_CUDA_ARCHITECTURES_BACKUP ${CMAKE_CUDA_ARCHITECTURES})
499503
find_package(Torch REQUIRED)
500504
set(CMAKE_CUDA_ARCHITECTURES ${CMAKE_CUDA_ARCHITECTURES_BACKUP})
@@ -571,7 +575,7 @@ if(ENABLE_UCX)
571575
OUTPUT_VARIABLE UCXX_BUILD_OUTPUT
572576
RESULT_VARIABLE UCXX_BUILD_RESULT)
573577
if(UCXX_BUILD_RESULT)
574-
message("ucxx build:" ${UCXX_BUILD_OUTPUT})
578+
message("ucxx build: ${UCXX_BUILD_OUTPUT}")
575579
message(FATAL_ERROR "ucxx build failed")
576580
endif()
577581
find_package(ucxx REQUIRED PATHS ${CMAKE_BINARY_DIR}/ucxx/build

cpp/tensorrt_llm/deep_gemm/CMakeLists.txt

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,11 @@ endif()
1111
set(DEEP_GEMM_SOURCE_DIR ${CMAKE_BINARY_DIR}/_deps/deepgemm-src)
1212
get_filename_component(DEEP_GEMM_SOURCE_DIR ${DEEP_GEMM_SOURCE_DIR} ABSOLUTE)
1313

14-
if(NOT EXISTS ${DEEP_GEMM_SOURCE_DIR})
15-
message(
16-
FATAL_ERROR
17-
"DeepGEMM submodule not found at ${DEEP_GEMM_SOURCE_DIR}. Please run: git submodule update --init --recursive"
18-
)
19-
endif()
20-
2114
# Check if submodules are initialized
2215
if(NOT EXISTS ${DEEP_GEMM_SOURCE_DIR}/third-party/cutlass/include)
2316
message(
2417
FATAL_ERROR
25-
"DeepGEMM submodules not initialized. Please run: git submodule update --init --recursive"
18+
"DeepGEMM submodules not initialized. Something went wrong with FetchContent.\n"
2619
)
2720
endif()
2821

cpp/tensorrt_llm/flash_mla/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ endif()
1111
set(FLASH_MLA_SOURCE_DIR ${CMAKE_BINARY_DIR}/_deps/flashmla-src)
1212
get_filename_component(FLASH_MLA_SOURCE_DIR ${FLASH_MLA_SOURCE_DIR} ABSOLUTE)
1313

14+
# Check if submodules are initialized
15+
if(NOT EXISTS ${FLASH_MLA_SOURCE_DIR}/csrc/cutlass/include)
16+
message(
17+
FATAL_ERROR
18+
"FlashMLA submodules not initialized. Something went wrong with FetchContent"
19+
)
20+
endif()
21+
1422
# Compiler compatibility for SM100 inline assembly
1523
# =================================================
1624
# FlashMLA SM100 contains PTX inline assembly that Clang++ on ARM64 incorrectly

0 commit comments

Comments
 (0)