From 1379cfac3ae1c6c69c247f4afe46c295622ecdd6 Mon Sep 17 00:00:00 2001 From: cheshirekow Date: Thu, 20 Nov 2025 16:44:23 -0800 Subject: [PATCH] [TRTLLM-9197][infra] Move thirdparty stuff to it's own listfile (#8986) Signed-off-by: Josh Bialkowski <1309820+cheshirekow@users.noreply.github.com> Co-authored-by: Josh Bialkowski <1309820+cheshirekow@users.noreply.github.com> --- .gitmodules | 35 ------ 3rdparty/CMakeLists.txt | 114 ++++++++++++++++++ 3rdparty/DeepGEMM | 1 - 3rdparty/NVTX | 1 - 3rdparty/cppzmq | 1 - 3rdparty/cutlass | 1 - 3rdparty/cxxopts | 1 - 3rdparty/flash-mla | 1 - 3rdparty/json | 1 - 3rdparty/nanobind | 1 - 3rdparty/pybind11 | 1 - 3rdparty/ucxx | 1 - 3rdparty/xgrammar | 1 - benchmarks/cpp/CMakeLists.txt | 4 +- cpp/CMakeLists.txt | 51 ++++---- cpp/kernels/xqa/CMakeLists.txt | 8 -- cpp/micro_benchmarks/CMakeLists.txt | 4 - cpp/tensorrt_llm/batch_manager/CMakeLists.txt | 11 +- cpp/tensorrt_llm/deep_ep/CMakeLists.txt | 11 +- cpp/tensorrt_llm/deep_gemm/CMakeLists.txt | 2 +- .../ucx_utils/CMakeLists.txt | 2 +- cpp/tensorrt_llm/flash_mla/CMakeLists.txt | 18 +-- .../kernels/cutlass_kernels/CMakeLists.txt | 9 +- cpp/tests/CMakeLists.txt | 9 +- examples/cpp/executor/CMakeLists.txt | 7 +- .../inflight_batcher_llm/CMakeLists.txt | 3 +- 26 files changed, 171 insertions(+), 128 deletions(-) create mode 100644 3rdparty/CMakeLists.txt delete mode 160000 3rdparty/DeepGEMM delete mode 160000 3rdparty/NVTX delete mode 160000 3rdparty/cppzmq delete mode 160000 3rdparty/cutlass delete mode 160000 3rdparty/cxxopts delete mode 160000 3rdparty/flash-mla delete mode 160000 3rdparty/json delete mode 160000 3rdparty/nanobind delete mode 160000 3rdparty/pybind11 delete mode 160000 3rdparty/ucxx delete mode 160000 3rdparty/xgrammar diff --git a/.gitmodules b/.gitmodules index bb08807671..e69de29bb2 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,35 +0,0 @@ -[submodule "3rdparty/cutlass"] - path = 3rdparty/cutlass - url = https://github.com/NVIDIA/cutlass.git -[submodule "3rdparty/json"] - path = 3rdparty/json - url = https://github.com/nlohmann/json.git -[submodule "3rdparty/cxxopts"] - path = 3rdparty/cxxopts - url = https://github.com/jarro2783/cxxopts - branch = v3.1.1 -[submodule "3rdparty/NVTX"] - path = 3rdparty/NVTX - url = https://github.com/NVIDIA/NVTX.git -[submodule "3rdparty/ucxx"] - path = 3rdparty/ucxx - url = https://github.com/rapidsai/ucxx.git -[submodule "3rdparty/pybind11"] - path = 3rdparty/pybind11 - url = https://github.com/pybind/pybind11.git -[submodule "3rdparty/xgrammar"] - path = 3rdparty/xgrammar - url = https://github.com/mlc-ai/xgrammar.git -[submodule "3rdparty/nanobind"] - path = 3rdparty/nanobind - url = https://github.com/wjakob/nanobind -[submodule "3rdparty/cppzmq"] - path = 3rdparty/cppzmq - url = https://github.com/zeromq/cppzmq.git -[submodule "3rdparty/DeepGEMM"] - path = 3rdparty/DeepGEMM - url = https://github.com/ruoqianguo/DeepGEMM.git - branch = swapab_sm100 -[submodule "3rdparty/flash-mla"] - path = 3rdparty/flash-mla - url = https://github.com/deepseek-ai/FlashMLA.git diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt new file mode 100644 index 0000000000..9e83a920de --- /dev/null +++ b/3rdparty/CMakeLists.txt @@ -0,0 +1,114 @@ +include(ExternalProject) +include(FetchContent) + +if(DEFINED ENV{GITHUB_MIRROR} AND NOT "$ENV{GITHUB_MIRROR}" STREQUAL "") + set(github_base_url "$ENV{GITHUB_MIRROR}") +else() + set(github_base_url "https://github.com") +endif() + +FetchContent_Declare( + cppzmq + GIT_REPOSITORY https://github.com/zeromq/cppzmq + GIT_TAG v4.10.0 # c94c20743ed7d4aa37835a5c46567ab0790d4acc + GIT_SHALLOW TRUE + # NOTE: TensorRT-LLM only uses the headers + SOURCE_SUBDIR + dont-add-this-project-with-add-subdirectory) + +FetchContent_Declare( + cutlass + GIT_REPOSITORY https://github.com/NVIDIA/cutlass + GIT_TAG v4.2.1 # f3fde58372d33e9a5650ba7b80fc48b3b49d40c8 + GIT_SHALLOW TRUE + SOURCE_SUBDIR + dont-add-this-project-with-add-subdirectory) + +FetchContent_Declare( + cxxopts + GIT_REPOSITORY https://github.com/jarro2783/cxxopts + GIT_TAG v3.1.1 # eb787304d67ec22f7c3a184ee8b4c481d04357fd + GIT_SHALLOW TRUE) + +set(deep_ep_commit 5be51b228a7c82dbdb213ea58e77bffd12b38af8) +set_property(GLOBAL PROPERTY DEEP_EP_COMMIT "${deep_ep_commit}") +FetchContent_Declare( + deep_ep_download + URL ${github_base_url}/deepseek-ai/DeepEP/archive/${deep_ep_commit}.tar.gz) + +FetchContent_Declare( + deepgemm + GIT_REPOSITORY https://github.com/ruoqianguo/DeepGEMM + GIT_TAG 9fa5965e265e27995f539e0dd73a06351a8a9eaf + SOURCE_SUBDIR + dont-add-this-project-with-add-subdirectory) + +FetchContent_Declare( + eigen + GIT_REPOSITORY https://github.com/libeigen/eigen + GIT_TAG 3.4.0 + GIT_SHALLOW TRUE) + +FetchContent_Declare( + flashmla + GIT_REPOSITORY https://github.com/deepseek-ai/FlashMLA.git + GIT_TAG 1408756a88e52a25196b759eaf8db89d2b51b5a1 + SOURCE_SUBDIR + dont-add-this-project-with-add-subdirectory) + +FetchContent_Declare( + googlebenchmark + GIT_REPOSITORY https://github.com/google/benchmark + GIT_TAG v1.8.3 + GIT_SHALLOW TRUE) + +FetchContent_Declare( + googletest + GIT_REPOSITORY https://github.com/google/googletest + GIT_TAG v1.15.2 + GIT_SHALLOW TRUE) + +FetchContent_Declare( + json + GIT_REPOSITORY https://github.com/nlohmann/json + GIT_TAG v3.12.0 # 55f93686c01528224f448c19128836e7df245f72 + GIT_SHALLOW TRUE + SOURCE_SUBDIR + dont-add-this-project-with-add-subdirectory) + +FetchContent_Declare( + nanobind + GIT_REPOSITORY https://github.com/wjakob/nanobind + GIT_TAG a0ed2587f1089ef7657e2ed49ad6756b01c74e9f) + +FetchContent_Declare( + nvtx + GIT_REPOSITORY https://github.com/NVIDIA/NVTX + GIT_TAG v3.1.0-c-cpp # a1ceb0677f67371ed29a2b1c022794f077db5fe7 + GIT_SHALLOW TRUE + # NOTE: TensorRT-LLM only uses the headers + SOURCE_SUBDIR + dont-add-this-project-with-add-subdirectory) + +FetchContent_Declare( + pybind11 + GIT_REPOSITORY https://github.com/pybind/pybind11 + GIT_TAG f99ffd7e03001810a3e722bf48ad1a9e08415d7d) + +FetchContent_Declare( + ucxx + GIT_REPOSITORY https://github.com/rapidsai/ucxx + GIT_TAG 16eaa57c8d98c8ef54d666a2d2b11e76cfa565f5 + # NOTE: See the notes in cpp/CMakeList.txt where this project is build at + # configure time and then included via find_package + SOURCE_SUBDIR + dont-add-this-project-with-add-subdirectory) + +FetchContent_Declare( + xgrammar + GIT_REPOSITORY https://github.com/mlc-ai/xgrammar + GIT_TAG v0.1.25 # e4e816f5f0fe39f5b1601a17a4552307fa3b70ff + GIT_SHALLOW TRUE + # NOTE: TensorRT-LLM only uses the headers + SOURCE_SUBDIR + dont-add-this-project-with-add-subdirectory) diff --git a/3rdparty/DeepGEMM b/3rdparty/DeepGEMM deleted file mode 160000 index 9fa5965e26..0000000000 --- a/3rdparty/DeepGEMM +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9fa5965e265e27995f539e0dd73a06351a8a9eaf diff --git a/3rdparty/NVTX b/3rdparty/NVTX deleted file mode 160000 index a1ceb0677f..0000000000 --- a/3rdparty/NVTX +++ /dev/null @@ -1 +0,0 @@ -Subproject commit a1ceb0677f67371ed29a2b1c022794f077db5fe7 diff --git a/3rdparty/cppzmq b/3rdparty/cppzmq deleted file mode 160000 index c94c20743e..0000000000 --- a/3rdparty/cppzmq +++ /dev/null @@ -1 +0,0 @@ -Subproject commit c94c20743ed7d4aa37835a5c46567ab0790d4acc diff --git a/3rdparty/cutlass b/3rdparty/cutlass deleted file mode 160000 index f3fde58372..0000000000 --- a/3rdparty/cutlass +++ /dev/null @@ -1 +0,0 @@ -Subproject commit f3fde58372d33e9a5650ba7b80fc48b3b49d40c8 diff --git a/3rdparty/cxxopts b/3rdparty/cxxopts deleted file mode 160000 index eb787304d6..0000000000 --- a/3rdparty/cxxopts +++ /dev/null @@ -1 +0,0 @@ -Subproject commit eb787304d67ec22f7c3a184ee8b4c481d04357fd diff --git a/3rdparty/flash-mla b/3rdparty/flash-mla deleted file mode 160000 index 1408756a88..0000000000 --- a/3rdparty/flash-mla +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 1408756a88e52a25196b759eaf8db89d2b51b5a1 diff --git a/3rdparty/json b/3rdparty/json deleted file mode 160000 index 55f93686c0..0000000000 --- a/3rdparty/json +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 55f93686c01528224f448c19128836e7df245f72 diff --git a/3rdparty/nanobind b/3rdparty/nanobind deleted file mode 160000 index a0ed2587f1..0000000000 --- a/3rdparty/nanobind +++ /dev/null @@ -1 +0,0 @@ -Subproject commit a0ed2587f1089ef7657e2ed49ad6756b01c74e9f diff --git a/3rdparty/pybind11 b/3rdparty/pybind11 deleted file mode 160000 index f99ffd7e03..0000000000 --- a/3rdparty/pybind11 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit f99ffd7e03001810a3e722bf48ad1a9e08415d7d diff --git a/3rdparty/ucxx b/3rdparty/ucxx deleted file mode 160000 index 16eaa57c8d..0000000000 --- a/3rdparty/ucxx +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 16eaa57c8d98c8ef54d666a2d2b11e76cfa565f5 diff --git a/3rdparty/xgrammar b/3rdparty/xgrammar deleted file mode 160000 index e4e816f5f0..0000000000 --- a/3rdparty/xgrammar +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e4e816f5f0fe39f5b1601a17a4552307fa3b70ff diff --git a/benchmarks/cpp/CMakeLists.txt b/benchmarks/cpp/CMakeLists.txt index 0e8dca68b1..cb5ef1ee92 100644 --- a/benchmarks/cpp/CMakeLists.txt +++ b/benchmarks/cpp/CMakeLists.txt @@ -20,8 +20,8 @@ set(TOP_LEVEL_DIR "${PROJECT_SOURCE_DIR}/..") add_custom_target(benchmarks) if(NOT TARGET cxxopts::cxxopts) - set(CXXOPTS_SRC_DIR ${PROJECT_SOURCE_DIR}/../3rdparty/cxxopts) - add_subdirectory(${CXXOPTS_SRC_DIR} ${CMAKE_CURRENT_BINARY_DIR}/cxxopts) + add_subdirectory(${CMAKE_BINARY_DIR}/_deps/cxxopts-src + ${CMAKE_CURRENT_BINARY_DIR}/cxxopts) endif() function(add_benchmark test_name test_src) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index e013dbc17e..4241c760bb 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -243,15 +243,31 @@ set(TRT_LIB TensorRT::NvInfer) get_filename_component(TRT_LLM_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR} PATH) set(3RDPARTY_DIR ${TRT_LLM_ROOT_DIR}/3rdparty) +add_subdirectory(${3RDPARTY_DIR} 3rdparty) + if(BINDING_TYPE STREQUAL "pybind" OR BUILD_DEEP_EP OR BUILD_DEEP_GEMM) - add_subdirectory(${3RDPARTY_DIR}/pybind11 - ${CMAKE_CURRENT_BINARY_DIR}/pybind11) + FetchContent_MakeAvailable(pybind11) + include_directories(${CMAKE_BINARY_DIR}/_deps/pybind11-src/include) endif() if(BINDING_TYPE STREQUAL "nanobind") - add_subdirectory(${3RDPARTY_DIR}/nanobind - ${CMAKE_CURRENT_BINARY_DIR}/nanobind) + FetchContent_MakeAvailable(nanobind) + include_directories(${CMAKE_BINARY_DIR}/_deps/nanobind-src/include) +endif() + +FetchContent_MakeAvailable(cutlass cxxopts flashmla json xgrammar) + +if(ENABLE_UCX) + FetchContent_MakeAvailable(cppzmq ucxx) +endif() + +if(NOT NVTX_DISABLE) + FetchContent_MakeAvailable(nvtx) +endif() + +if(BUILD_DEEP_GEMM) + FetchContent_MakeAvailable(deepgemm) endif() # include as system to suppress warnings @@ -261,18 +277,10 @@ include_directories( ${CUDAToolkit_INCLUDE_DIRS}/cccl ${CUDNN_ROOT_DIR}/include $ - ${3RDPARTY_DIR}/cutlass/include - ${3RDPARTY_DIR}/cutlass/tools/util/include - ${3RDPARTY_DIR}/NVTX/include - ${3RDPARTY_DIR}/json/include) -if(BINDING_TYPE STREQUAL "pybind" - OR BUILD_DEEP_EP - OR BUILD_DEEP_GEMM) - include_directories(${3RDPARTY_DIR}/pybind11/include) -endif() -if(BINDING_TYPE STREQUAL "nanobind") - include_directories(${3RDPARTY_DIR}/nanobind/include) -endif() + ${CMAKE_BINARY_DIR}/_deps/nvtx-src/include + ${CMAKE_BINARY_DIR}/_deps/cutlass-src/include + ${CMAKE_BINARY_DIR}/_deps/cutlass-src/tools/util/include + ${CMAKE_BINARY_DIR}/_deps/json-src/include) if(${CUDAToolkit_VERSION} VERSION_GREATER_EQUAL "11") add_definitions("-DENABLE_BF16") @@ -538,14 +546,15 @@ if(ENABLE_UCX) if(NOT ${ucx_FOUND}) set(ENABLE_UCX 0) else() + set(ucxx_source_dir ${CMAKE_BINARY_DIR}/_deps/ucxx-src) if(DEFINED ENV{GITHUB_MIRROR} AND NOT "$ENV{GITHUB_MIRROR}" STREQUAL "") - if(EXISTS "${3RDPARTY_DIR}/ucxx/fetch_rapids.cmake") - file(READ "${3RDPARTY_DIR}/ucxx/fetch_rapids.cmake" FILE_CONTENTS) + if(EXISTS "${ucxx_source_dir}/fetch_rapids.cmake") + file(READ "${ucxx_source_dir}/fetch_rapids.cmake" FILE_CONTENTS) string( REPLACE "https://raw.githubusercontent.com/rapidsai/rapids-cmake" "$ENV{GITHUB_MIRROR}/rapidsai/rapids-cmake/raw/refs/heads" FILE_CONTENTS "${FILE_CONTENTS}") - file(WRITE "${3RDPARTY_DIR}/ucxx/fetch_rapids.cmake" "${FILE_CONTENTS}") + file(WRITE "${ucxx_source_dir}/fetch_rapids.cmake" "${FILE_CONTENTS}") message(WARNING "Replace UCXX fetch_rapids.cmake with internal mirror") endif() endif() @@ -556,13 +565,13 @@ if(ENABLE_UCX) execute_process( COMMAND ${CMAKE_COMMAND} -E env LIB_BUILD_DIR=${CMAKE_BINARY_DIR}/ucxx/build - ${3RDPARTY_DIR}/ucxx/build.sh libucxx -n + ${ucxx_source_dir}/build.sh libucxx -n --cmake-args=\"-DBUILD_SHARED_LIBS=OFF -DCMAKE_CXX_FLAGS=-D_GLIBCXX_USE_CXX11_ABI=${USE_CXX11_ABI}\" OUTPUT_VARIABLE UCXX_BUILD_OUTPUT RESULT_VARIABLE UCXX_BUILD_RESULT) if(UCXX_BUILD_RESULT) - message(${UCXX_BUILD_OUTPUT}) + message("ucxx build:" ${UCXX_BUILD_OUTPUT}) message(FATAL_ERROR "ucxx build failed") endif() find_package(ucxx REQUIRED PATHS ${CMAKE_BINARY_DIR}/ucxx/build diff --git a/cpp/kernels/xqa/CMakeLists.txt b/cpp/kernels/xqa/CMakeLists.txt index 3d3c826892..f9e53900cf 100644 --- a/cpp/kernels/xqa/CMakeLists.txt +++ b/cpp/kernels/xqa/CMakeLists.txt @@ -93,10 +93,6 @@ if(BUILD_XQA_TESTS) if(NOT GTest_FOUND) message(STATUS "System GTest not found, fetching from repository") include(FetchContent) - FetchContent_Declare( - googletest - GIT_REPOSITORY https://github.com/google/googletest.git - GIT_TAG v1.15.2) FetchContent_MakeAvailable(googletest) include(GoogleTest) endif() @@ -106,10 +102,6 @@ if(BUILD_XQA_TESTS) if(NOT Eigen3_FOUND) message(STATUS "System Eigen not found, fetching from repository") include(FetchContent) - FetchContent_Declare( - eigen - GIT_REPOSITORY https://gitlab.com/libeigen/eigen.git - GIT_TAG 3.4.0) FetchContent_MakeAvailable(eigen) endif() diff --git a/cpp/micro_benchmarks/CMakeLists.txt b/cpp/micro_benchmarks/CMakeLists.txt index dd534d75b5..f7c70f6576 100644 --- a/cpp/micro_benchmarks/CMakeLists.txt +++ b/cpp/micro_benchmarks/CMakeLists.txt @@ -22,10 +22,6 @@ set(BENCHMARK_ENABLE_TESTING set(BENCHMARK_ENABLE_INSTALL OFF CACHE INTERNAL "Disable google-benchmark install") -FetchContent_Declare( - googlebenchmark - GIT_REPOSITORY https://github.com/google/benchmark.git - GIT_TAG v1.8.3) FetchContent_MakeAvailable(googlebenchmark) add_custom_target(micro_benchmarks) diff --git a/cpp/tensorrt_llm/batch_manager/CMakeLists.txt b/cpp/tensorrt_llm/batch_manager/CMakeLists.txt index bca760dabc..5dad6906ee 100644 --- a/cpp/tensorrt_llm/batch_manager/CMakeLists.txt +++ b/cpp/tensorrt_llm/batch_manager/CMakeLists.txt @@ -60,9 +60,10 @@ set(SRCS evictionPolicy.cpp cacheTransBuffer.cpp) -file(GLOB_RECURSE XGRAMMAR_SRCS "${3RDPARTY_DIR}/xgrammar/cpp/*.cc") +set(xgrammar_source_dir ${CMAKE_BINARY_DIR}/_deps/xgrammar-src) +file(GLOB_RECURSE XGRAMMAR_SRCS "${xgrammar_source_dir}/cpp/*.cc") list(FILTER XGRAMMAR_SRCS EXCLUDE REGEX - "${3RDPARTY_DIR}/xgrammar/cpp/nanobind/.*\\.cc") + "${xgrammar_source_dir}/cpp/nanobind/.*\\.cc") list(APPEND SRCS ${XGRAMMAR_SRCS}) if(NOT WIN32) @@ -83,9 +84,9 @@ endif() add_library(${BATCH_MANAGER_STATIC_TARGET} STATIC ${SRCS}) target_include_directories( ${BATCH_MANAGER_STATIC_TARGET} - PUBLIC ${3RDPARTY_DIR}/xgrammar/3rdparty/picojson - ${3RDPARTY_DIR}/xgrammar/3rdparty/dlpack/include - ${3RDPARTY_DIR}/xgrammar/include) + PUBLIC ${xgrammar_source_dir}/3rdparty/picojson + ${xgrammar_source_dir}/3rdparty/dlpack/include + ${xgrammar_source_dir}/include) set_target_properties( ${BATCH_MANAGER_STATIC_TARGET} diff --git a/cpp/tensorrt_llm/deep_ep/CMakeLists.txt b/cpp/tensorrt_llm/deep_ep/CMakeLists.txt index db3d59e9a2..562c9e7d69 100644 --- a/cpp/tensorrt_llm/deep_ep/CMakeLists.txt +++ b/cpp/tensorrt_llm/deep_ep/CMakeLists.txt @@ -1,4 +1,4 @@ -set(DEEP_EP_COMMIT 5be51b228a7c82dbdb213ea58e77bffd12b38af8) +get_property(DEEP_EP_COMMIT GLOBAL PROPERTY DEEP_EP_COMMIT) set(NVSHMEM_URL_HASH SHA256=eb2c8fb3b7084c2db86bd9fd905387909f1dfd483e7b45f7b3c3d5fcf5374b5a) @@ -58,15 +58,6 @@ find_library(MLX5_lib NAMES mlx5 REQUIRED) # Download DeepEP include(FetchContent) -if(DEFINED ENV{GITHUB_MIRROR} AND NOT "$ENV{GITHUB_MIRROR}" STREQUAL "") - set(GITHUB_URL "$ENV{GITHUB_MIRROR}") -else() - set(GITHUB_URL "https://github.com") -endif() -set(DEEP_EP_URL - "${GITHUB_URL}/deepseek-ai/DeepEP/archive/${DEEP_EP_COMMIT}.tar.gz") -message(STATUS "deep_ep DEEP_EP_URL: ${DEEP_EP_URL}") -FetchContent_Declare(deep_ep_download URL ${DEEP_EP_URL}) FetchContent_MakeAvailable(deep_ep_download) set(DEEP_EP_SOURCE_DIR ${deep_ep_download_SOURCE_DIR}) diff --git a/cpp/tensorrt_llm/deep_gemm/CMakeLists.txt b/cpp/tensorrt_llm/deep_gemm/CMakeLists.txt index 631e5029c7..4ad78779c4 100644 --- a/cpp/tensorrt_llm/deep_gemm/CMakeLists.txt +++ b/cpp/tensorrt_llm/deep_gemm/CMakeLists.txt @@ -8,7 +8,7 @@ endif() # ============= # Use DeepGEMM submodule -set(DEEP_GEMM_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/DeepGEMM) +set(DEEP_GEMM_SOURCE_DIR ${CMAKE_BINARY_DIR}/_deps/deepgemm-src) get_filename_component(DEEP_GEMM_SOURCE_DIR ${DEEP_GEMM_SOURCE_DIR} ABSOLUTE) if(NOT EXISTS ${DEEP_GEMM_SOURCE_DIR}) diff --git a/cpp/tensorrt_llm/executor/cache_transmission/ucx_utils/CMakeLists.txt b/cpp/tensorrt_llm/executor/cache_transmission/ucx_utils/CMakeLists.txt index be518056f1..a59d85d779 100644 --- a/cpp/tensorrt_llm/executor/cache_transmission/ucx_utils/CMakeLists.txt +++ b/cpp/tensorrt_llm/executor/cache_transmission/ucx_utils/CMakeLists.txt @@ -5,7 +5,7 @@ if(ENABLE_UCX) find_package(ucxx REQUIRED) find_package(Torch REQUIRED) - include_directories(${3RDPARTY_DIR}/cppzmq) + include_directories(${CMAKE_BINARY_DIR}/_deps/cppzmq-src) # Find and link ZMQ find_package(PkgConfig REQUIRED) diff --git a/cpp/tensorrt_llm/flash_mla/CMakeLists.txt b/cpp/tensorrt_llm/flash_mla/CMakeLists.txt index 5dd78583f3..91a2f8d726 100644 --- a/cpp/tensorrt_llm/flash_mla/CMakeLists.txt +++ b/cpp/tensorrt_llm/flash_mla/CMakeLists.txt @@ -8,25 +8,9 @@ endif() # ============= # Use FlashMLA submodule -set(FLASH_MLA_SOURCE_DIR - ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/flash-mla) +set(FLASH_MLA_SOURCE_DIR ${CMAKE_BINARY_DIR}/_deps/flashmla-src) get_filename_component(FLASH_MLA_SOURCE_DIR ${FLASH_MLA_SOURCE_DIR} ABSOLUTE) -if(NOT EXISTS ${FLASH_MLA_SOURCE_DIR}) - message( - FATAL_ERROR - "FlashMLA submodule not found at ${FLASH_MLA_SOURCE_DIR}. Please run: git submodule update --init --recursive" - ) -endif() - -# Check if submodules are initialized -if(NOT EXISTS ${FLASH_MLA_SOURCE_DIR}/csrc/cutlass/include) - message( - FATAL_ERROR - "FlashMLA submodules not initialized. Please run: cd ${FLASH_MLA_SOURCE_DIR} && git submodule update --init --recursive" - ) -endif() - # Compiler compatibility for SM100 inline assembly # ================================================= # FlashMLA SM100 contains PTX inline assembly that Clang++ on ARM64 incorrectly diff --git a/cpp/tensorrt_llm/kernels/cutlass_kernels/CMakeLists.txt b/cpp/tensorrt_llm/kernels/cutlass_kernels/CMakeLists.txt index 093d7cd8e6..9c366c958c 100644 --- a/cpp/tensorrt_llm/kernels/cutlass_kernels/CMakeLists.txt +++ b/cpp/tensorrt_llm/kernels/cutlass_kernels/CMakeLists.txt @@ -27,16 +27,17 @@ if(NOT Python3_EXECUTABLE) REQUIRED) endif() +set(cutlass_source_dir ${CMAKE_BINARY_DIR}/_deps/cutlass-src) execute_process( - WORKING_DIRECTORY ${3RDPARTY_DIR}/cutlass/python/ + WORKING_DIRECTORY ${cutlass_source_dir}/python/ COMMAND ${Python3_EXECUTABLE} setup_library.py develop --user RESULT_VARIABLE _CUTLASS_LIBRARY_SUCCESS) if(NOT _CUTLASS_LIBRARY_SUCCESS EQUAL 0) message( FATAL_ERROR - "Failed to set up the CUTLASS library due to ${_CUTLASS_LIBRARY_SUCCESS}." - ) + "Failed to set up the CUTLASS library in ${cutlass_source_dir} due to" + " ${_CUTLASS_LIBRARY_SUCCESS}.") endif() set(GENERATE_KERNELS_SCRIPT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/python) @@ -218,7 +219,7 @@ if(USING_OSS_CUTLASS_LOW_LATENCY_GEMM) add_library(low_latency_gemm_src STATIC ${LOW_LATENCY_GEMM_SRC_CU}) set_cuda_architectures(low_latency_gemm_src 90) target_include_directories(low_latency_gemm_src - PRIVATE ${3RDPARTY_DIR}/cutlass/examples) + PRIVATE ${cutlass_source_dir}/examples) endif() if(USING_OSS_CUTLASS_FP4_GEMM) diff --git a/cpp/tests/CMakeLists.txt b/cpp/tests/CMakeLists.txt index e94be0c059..0a06d40ee8 100644 --- a/cpp/tests/CMakeLists.txt +++ b/cpp/tests/CMakeLists.txt @@ -16,18 +16,15 @@ # GoogleTest Preparation - Code block copied from # https://google.github.io/googletest/quickstart-cmake.html include(FetchContent) -FetchContent_Declare( - googletest - GIT_REPOSITORY https://github.com/google/googletest.git - GIT_TAG v1.15.2) FetchContent_MakeAvailable(googletest) include(GoogleTest) +set(cutlass_source_dir ${CMAKE_BINARY_DIR}/_deps/cutlass-src) include_directories( ${PROJECT_SOURCE_DIR}/tensorrt_llm/cutlass_extensions/include ${PROJECT_SOURCE_DIR}/include - ${3RDPARTY_DIR}/cutlass/include - ${3RDPARTY_DIR}/cutlass/tools/util/include + ${cutlass_source_dir}/include + ${cutlass_source_dir}/tools/util/include ${PROJECT_SOURCE_DIR}/tests/batch_manager ${PROJECT_SOURCE_DIR}/tests/utils) diff --git a/examples/cpp/executor/CMakeLists.txt b/examples/cpp/executor/CMakeLists.txt index af029c272a..b448667e8d 100644 --- a/examples/cpp/executor/CMakeLists.txt +++ b/examples/cpp/executor/CMakeLists.txt @@ -91,6 +91,9 @@ if(${CUDAToolkit_VERSION} VERSION_GREATER_EQUAL "11.8") ) endif() +add_subdirectory(${TRTLLM_DIR}/3rdparty 3rdparty) +FetchContent_MakeAvailable(cxxopts) + # tensorrt_llm shared lib add_library(tensorrt_llm SHARED IMPORTED) set_property(TARGET tensorrt_llm PROPERTY IMPORTED_LOCATION ${TRTLLM_LIB_PATH}) @@ -125,8 +128,8 @@ target_link_libraries(executorExampleLogitsProcessor # Advanced if(NOT TARGET cxxopts::cxxopts) - set(CXXOPTS_SRC_DIR ${TRTLLM_DIR}/3rdparty/cxxopts) - add_subdirectory(${CXXOPTS_SRC_DIR} ${CMAKE_CURRENT_BINARY_DIR}/cxxopts) + add_subdirectory(${CMAKE_BINARY_DIR}/_deps/cxxopts-src + ${CMAKE_CURRENT_BINARY_DIR}/cxxopts) endif() add_executable(executorExampleAdvanced executorExampleAdvanced.cpp) diff --git a/triton_backend/inflight_batcher_llm/CMakeLists.txt b/triton_backend/inflight_batcher_llm/CMakeLists.txt index 0f26015922..8987c339a4 100644 --- a/triton_backend/inflight_batcher_llm/CMakeLists.txt +++ b/triton_backend/inflight_batcher_llm/CMakeLists.txt @@ -209,6 +209,7 @@ add_definitions("-DTRT_LLM_USE_DIM64") list(APPEND COMMON_HEADER_DIRS ${TORCH_INCLUDE_DIRS}) include_directories(${COMMON_HEADER_DIRS}) +set(cutlass_source_dir ${CMAKE_BINARY_DIR}/_deps/cutlass-src) target_include_directories( triton-tensorrt-llm-backend PRIVATE ${TRTLLM_DIR}/cpp @@ -217,7 +218,7 @@ target_include_directories( ${CUDA_INCLUDE_DIRS} ${CUDNN_ROOT_DIR}/include ${NCCL_INCLUDE_DIR} - ${3RDPARTY_DIR}/cutlass/include + ${cutlass_source_dir}/include ${MPI_INCLUDE_PATH} ${COMMON_HEADER_DIR})