|
24 | 24 | cmake_minimum_required(VERSION 3.17) |
25 | 25 | include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/set_ifndef.cmake) |
26 | 26 |
|
27 | | -set(TRITON_BUILD |
28 | | - OFF |
29 | | - CACHE STRING "Using Triton build process") |
30 | | - |
31 | 27 | set_ifndef(TRTLLM_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../tensorrt_llm) |
32 | 28 |
|
| 29 | +include_directories(${TRTLLM_DIR} ${TRTLLM_DIR}/cpp/include) |
| 30 | + |
33 | 31 | include(${TRTLLM_DIR}/cpp/cmake/modules/find_library_create_target.cmake) |
34 | 32 |
|
35 | 33 | project(tritontensorrtllmbackend LANGUAGES C CXX) |
@@ -122,6 +120,32 @@ add_library(triton-tensorrt-llm-backend SHARED ${BACKEND_SRCS}) |
122 | 120 | enable_language(CUDA) |
123 | 121 |
|
124 | 122 | find_package(CUDA ${CUDA_REQUIRED_VERSION} REQUIRED) |
| 123 | +find_package(Python3 COMPONENTS Interpreter Development) |
| 124 | + |
| 125 | +find_library( |
| 126 | + tensorrt_llm libtensorrt_llm.so REQUIRED |
| 127 | + PATHS ${Python3_SITEARCH}/tensorrt_llm/libs |
| 128 | + ${TRTLLM_DIR}/cpp/build/tensorrt_llm |
| 129 | + ${CMAKE_CURRENT_SOURCE_DIR}/../tensorrt_llm/cpp/build/tensorrt_llm) |
| 130 | + |
| 131 | +find_library( |
| 132 | + nvinfer_plugin_tensorrt_llm libnvinfer_plugin_tensorrt_llm.so REQUIRED |
| 133 | + PATHS |
| 134 | + ${Python3_SITEARCH}/tensorrt_llm/libs |
| 135 | + ${TRTLLM_DIR}/cpp/build/tensorrt_llm/plugins |
| 136 | + ${CMAKE_CURRENT_SOURCE_DIR}/../tensorrt_llm/cpp/build/tensorrt_llm/plugins) |
| 137 | + |
| 138 | +find_program( |
| 139 | + TRTLLM_EXECUTOR_WORKER executorWorker REQUIRED |
| 140 | + PATHS |
| 141 | + ${Python3_SITEARCH}/tensorrt_llm/bin |
| 142 | + ${TRTLLM_DIR}/cpp/build/tensorrt_llm/executor_worker |
| 143 | + ${CMAKE_CURRENT_SOURCE_DIR}/../tensorrt_llm/cpp/build/tensorrt_llm/executor_worker |
| 144 | +) |
| 145 | +install( |
| 146 | + PROGRAMS ${TRTLLM_EXECUTOR_WORKER} |
| 147 | + DESTINATION ${CMAKE_BINARY_DIR} |
| 148 | + RENAME trtllmExecutorWorker) |
125 | 149 |
|
126 | 150 | find_library( |
127 | 151 | CUDNN_LIB cudnn |
@@ -232,20 +256,6 @@ set(COMPILE_OPTIONS |
232 | 256 | target_compile_options(triton-tensorrt-llm-common PRIVATE ${COMPILE_OPTIONS}) |
233 | 257 | target_compile_options(triton-tensorrt-llm-backend PRIVATE ${COMPILE_OPTIONS}) |
234 | 258 |
|
235 | | -add_library(tensorrt_llm SHARED IMPORTED) |
236 | | -set_property( |
237 | | - TARGET tensorrt_llm |
238 | | - PROPERTY IMPORTED_LOCATION |
239 | | - "${TRTLLM_DIR}/cpp/build/tensorrt_llm/libtensorrt_llm.so") |
240 | | - |
241 | | -add_library(nvinfer_plugin_tensorrt_llm SHARED IMPORTED) |
242 | | -set_property( |
243 | | - TARGET nvinfer_plugin_tensorrt_llm |
244 | | - PROPERTY |
245 | | - IMPORTED_LOCATION |
246 | | - "${TRTLLM_DIR}/cpp/build/tensorrt_llm/plugins/libnvinfer_plugin_tensorrt_llm.so" |
247 | | -) |
248 | | - |
249 | 259 | if(TRITON_ENABLE_METRICS) |
250 | 260 | list(APPEND REPORTER_SRCS |
251 | 261 | src/custom_metrics_reporter/custom_metrics_reporter.cc) |
@@ -276,46 +286,25 @@ if(TRITON_ENABLE_METRICS) |
276 | 286 | triton-core-serverapi # from repo-core |
277 | 287 | triton-core-serverstub # from repo-core |
278 | 288 | triton-backend-utils # from repo-backend |
279 | | - tensorrt_llm) |
| 289 | + ${tensorrt_llm}) |
280 | 290 |
|
281 | 291 | target_compile_definitions(triton-tensorrt-llm-common |
282 | 292 | PRIVATE TRITON_ENABLE_METRICS=1) |
283 | 293 | target_link_libraries(triton-tensorrt-llm-common |
284 | 294 | PRIVATE triton-custom-metrics-reporter-library) |
285 | 295 | endif() |
286 | 296 |
|
287 | | -if(TRITON_BUILD) |
288 | | - |
289 | | - if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86_64") |
290 | | - execute_process( |
291 | | - WORKING_DIRECTORY ${TRTLLM_DIR} |
292 | | - COMMAND bash -x docker/common/install_pytorch.sh pypi COMMAND_ECHO STDOUT |
293 | | - COMMAND_ERROR_IS_FATAL ANY) |
294 | | - else() |
295 | | - execute_process( |
296 | | - WORKING_DIRECTORY ${TRTLLM_DIR} |
297 | | - COMMAND bash -x docker/common/install_pytorch.sh src_non_cxx11_abi |
298 | | - COMMAND_ECHO STDOUT COMMAND_ERROR_IS_FATAL ANY) |
299 | | - endif() # CMAKE_HOST_SYSTEM_PROCESSOR |
300 | | - |
301 | | - execute_process( |
302 | | - WORKING_DIRECTORY ${TRTLLM_DIR} |
303 | | - COMMAND python3 scripts/build_wheel.py --trt_root /usr/local/tensorrt |
304 | | - COMMAND_ECHO STDOUT COMMAND_ERROR_IS_FATAL ANY) |
305 | | - |
306 | | -endif() # TRITON_BUILD |
307 | | - |
308 | 297 | target_link_libraries( |
309 | 298 | triton-tensorrt-llm-common |
310 | | - PUBLIC tensorrt_llm |
| 299 | + PUBLIC ${tensorrt_llm} |
311 | 300 | triton-core-serverapi # from repo-core |
312 | 301 | triton-core-backendapi # from repo-core |
313 | 302 | triton-core-serverstub # from repo-core |
314 | 303 | triton-backend-utils # from repo-backend |
315 | 304 | ${MPI_LIBRARIES} |
316 | 305 | ${CUDA_LIBRARIES} |
317 | 306 | nvinfer |
318 | | - nvinfer_plugin_tensorrt_llm) |
| 307 | + ${nvinfer_plugin_tensorrt_llm}) |
319 | 308 |
|
320 | 309 | target_link_libraries(triton-tensorrt-llm-backend |
321 | 310 | PRIVATE triton-tensorrt-llm-common) |
@@ -356,12 +345,3 @@ if(BUILD_TESTS) |
356 | 345 | enable_testing() |
357 | 346 | add_subdirectory(tests) |
358 | 347 | endif() |
359 | | - |
360 | | -add_custom_command( |
361 | | - TARGET triton-tensorrt-llm-backend |
362 | | - POST_BUILD |
363 | | - COMMAND |
364 | | - ${CMAKE_COMMAND} -E copy |
365 | | - ${TRTLLM_DIR}/cpp/build/tensorrt_llm/executor_worker/executorWorker |
366 | | - ${CMAKE_CURRENT_BINARY_DIR}/trtllmExecutorWorker |
367 | | - COMMENT "Copying executorWorker to the build directory") |
0 commit comments