Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 0 additions & 35 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -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
114 changes: 114 additions & 0 deletions 3rdparty/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
1 change: 0 additions & 1 deletion 3rdparty/DeepGEMM
Submodule DeepGEMM deleted from 9fa596
1 change: 0 additions & 1 deletion 3rdparty/NVTX
Submodule NVTX deleted from a1ceb0
1 change: 0 additions & 1 deletion 3rdparty/cppzmq
Submodule cppzmq deleted from c94c20
1 change: 0 additions & 1 deletion 3rdparty/cutlass
Submodule cutlass deleted from f3fde5
1 change: 0 additions & 1 deletion 3rdparty/cxxopts
Submodule cxxopts deleted from eb7873
1 change: 0 additions & 1 deletion 3rdparty/flash-mla
Submodule flash-mla deleted from 140875
1 change: 0 additions & 1 deletion 3rdparty/json
Submodule json deleted from 55f936
1 change: 0 additions & 1 deletion 3rdparty/nanobind
Submodule nanobind deleted from a0ed25
1 change: 0 additions & 1 deletion 3rdparty/pybind11
Submodule pybind11 deleted from f99ffd
1 change: 0 additions & 1 deletion 3rdparty/ucxx
Submodule ucxx deleted from 16eaa5
1 change: 0 additions & 1 deletion 3rdparty/xgrammar
Submodule xgrammar deleted from e4e816
4 changes: 2 additions & 2 deletions benchmarks/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
51 changes: 30 additions & 21 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -261,18 +277,10 @@ include_directories(
${CUDAToolkit_INCLUDE_DIRS}/cccl
${CUDNN_ROOT_DIR}/include
$<TARGET_PROPERTY:TensorRT::NvInfer,INTERFACE_INCLUDE_DIRECTORIES>
${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")
Expand Down Expand Up @@ -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()
Expand All @@ -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
Expand Down
8 changes: 0 additions & 8 deletions cpp/kernels/xqa/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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()

Expand Down
4 changes: 0 additions & 4 deletions cpp/micro_benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
11 changes: 6 additions & 5 deletions cpp/tensorrt_llm/batch_manager/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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}
Expand Down
11 changes: 1 addition & 10 deletions cpp/tensorrt_llm/deep_ep/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)

Expand Down Expand Up @@ -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})

Expand Down
2 changes: 1 addition & 1 deletion cpp/tensorrt_llm/deep_gemm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading