@@ -78,10 +78,10 @@ else()
7878 message (WARNING "TRITON_PYTORCH_ENABLE_TORCHTRT is on, but TRITON_PYTORCH_LIB_PATHS does not contain Torch-TRT package" )
7979 endif ()
8080
81- # Look for installed Torchvision package in lib paths
82- find_library ( LIBTORCHVISION libtorchvision.so libtorchvision.so.1 PATHS ${TRITON_PYTORCH_LIB_PATHS} )
81+ # Look for installed TorchVision package in lib paths
82+ find_library (LIBTORCHVISION libtorchvision.so libtorchvision.so.1 PATHS ${TRITON_PYTORCH_LIB_PATHS} )
8383 if (NOT ${LIBTORCHVISION} )
84- message (WARNING "TRITON_PYTORCH_ENABLE_TORCHVISION is on, but TRITON_PYTORCH_LIB_PATHS does not contain Torchvision package" )
84+ message (WARNING "TRITON_PYTORCH_ENABLE_TORCHVISION is on, but TRITON_PYTORCH_LIB_PATHS does not contain TorchVision package" )
8585 endif (NOT ${LIBTORCHVISION} )
8686endif ()
8787
@@ -104,6 +104,27 @@ if(LINUX)
104104 endif (${DISTRO_ID_LIKE} MATCHES "rhel|centos" )
105105endif (LINUX)
106106
107+ message (TRACE "CMAKE_HOST_SYSTEM_PROCESSOR: ${CMAKE_HOST_SYSTEM_PROCESSOR} " )
108+ message (TRACE "TRITON_ENABLE_GPU: ${TRITON_ENABLE_GPU} " )
109+ message (TRACE "TRITON_ENABLE_STATS: ${TRITON_ENABLE_STATS} " )
110+ message (TRACE "TRITON_ENABLE_NVTX: ${TRITON_ENABLE_NVTX} " )
111+ message (TRACE "TRITON_PYTORCH_ENABLE_TORCHTRT: ${TRITON_PYTORCH_ENABLE_TORCHTRT} " )
112+ message (TRACE "TRITON_PYTORCH_ENABLE_TORCHVISION: ${TRITON_PYTORCH_ENABLE_TORCHVISION} " )
113+ message (TRACE "TRITON_PYTORCH_NVSHMEM: ${TRITON_PYTORCH_NVSHMEM} " )
114+ message (TRACE "TRITON_PYTORCH_DOCKER_IMAGE: ${TRITON_PYTORCH_DOCKER_IMAGE} " )
115+ message (TRACE "TRITON_PYTORCH_INCLUDE_PATHS: ${TRITON_PYTORCH_INCLUDE_PATHS} " )
116+ message (TRACE "TRITON_PYTORCH_LIB_PATHS: ${TRITON_PYTORCH_LIB_PATHS} " )
117+ message (TRACE "TRITON_REPO_ORGANIZATION: ${TRITON_REPO_ORGANIZATION} " )
118+ message (TRACE "TRITON_BACKEND_REPO_TAG: ${TRITON_BACKEND_REPO_TAG} " )
119+ message (TRACE "TRITON_CORE_REPO_TAG: ${TRITON_CORE_REPO_TAG} " )
120+ message (TRACE "TRITON_COMMON_REPO_TAG: ${TRITON_COMMON_REPO_TAG} " )
121+ message (TRACE "TRITON_PYTORCH_DOCKER_BUILD: ${TRITON_PYTORCH_DOCKER_BUILD} " )
122+ message (TRACE "RHEL_BUILD: ${RHEL_BUILD} " )
123+ message (TRACE "LIB_DIR: ${LIB_DIR} " )
124+ message (TRACE "LIBTORCH_LIBS_PATH: ${LIBTORCH_LIBS_PATH} " )
125+ message (TRACE "PY_INSTALL_PATH: ${PY_INSTALL_PATH} " )
126+
127+
107128#
108129# Dependencies
109130#
@@ -161,6 +182,11 @@ set(PT_LIBS
161182 "libtorch_cuda_linalg.so"
162183 "libtorch_global_deps.so"
163184 "libjpeg.so.62"
185+ "libshm.so"
186+ "libbackend_with_compiler.so"
187+ "libaoti_custom_ops.so"
188+ "libtorch_python.so"
189+ "libcaffe2_nvrtc.so"
164190)
165191
166192if (${TRITON_PYTORCH_NVSHMEM} )
@@ -180,6 +206,7 @@ endif() # TRITON_PYTORCH_ENABLE_TORCHVISION
180206if (${TRITON_PYTORCH_ENABLE_TORCHTRT} )
181207 set (PT_LIBS
182208 ${PT_LIBS}
209+ "libtorchtrt.so"
183210 "libtorchtrt_runtime.so"
184211 )
185212endif () # TRITON_PYTORCH_ENABLE_TORCHTRT
@@ -218,6 +245,9 @@ set(TORCHVISION_LIBS
218245 $<IF:$<BOOL :${RHEL_BUILD} >,libpng16.so.16,libpng16.so>
219246)
220247
248+ message (TRACE "LIBS_ARCH: ${LIBS_ARCH} " )
249+ message (TRACE "LIBTORCH_LIBS: ${LIBTORCH_LIBS} " )
250+
221251# The patchelf commands ensure the MKL libraries are loaded correctly during runtime
222252# Without these, the framework/backend complains of missing libraries / symbols and
223253# in some cases leads to segmentation faults.
@@ -246,11 +276,16 @@ if (${TRITON_PYTORCH_DOCKER_BUILD})
246276 COMMAND docker cp pytorch_backend_ptlib:${PY_INSTALL_PATH} /torch/lib/libtorch_cuda_linalg.so libtorch_cuda_linalg.so
247277 COMMAND docker cp pytorch_backend_ptlib:${PY_INSTALL_PATH} /torch/lib/libtorch_global_deps.so libtorch_global_deps.so
248278 COMMAND docker cp pytorch_backend_ptlib:${PY_INSTALL_PATH} /torch/lib/libcaffe2_nvrtc.so libcaffe2_nvrtc.so
279+ COMMAND docker cp pytorch_backend_ptlib:${PY_INSTALL_PATH} /torch/lib/libshm.so libshm.so
280+ COMMAND docker cp pytorch_backend_ptlib:${PY_INSTALL_PATH} /torch/lib/libbackend_with_compiler.so libbackend_with_compiler.so
281+ COMMAND docker cp pytorch_backend_ptlib:${PY_INSTALL_PATH} /torch/lib/libaoti_custom_ops.so libaoti_custom_ops.so
282+ COMMAND docker cp pytorch_backend_ptlib:${PY_INSTALL_PATH} /torch/lib/libtorch_python.so libtorch_python.so
249283 COMMAND /bin/sh -c "if [ ${TRITON_PYTORCH_NVSHMEM} = 'ON' ]; then docker cp pytorch_backend_ptlib:${PY_INSTALL_PATH} /torch/lib/libtorch_nvshmem.so libtorch_nvshmem.so; fi"
250284 COMMAND /bin/sh -c "if [ ${TRITON_PYTORCH_ENABLE_TORCHVISION} = 'ON' ]; then if [ ${RHEL_BUILD} = 'ON' ]; then docker cp -a -L pytorch_backend_ptlib:/usr/local/lib64/libtorchvision.so libtorchvision.so; else docker cp -a -L pytorch_backend_ptlib:/usr/local/${LIB_DIR} /libtorchvision.so.1 libtorchvision.so.1; fi; fi"
251285 COMMAND /bin/sh -c "if [ ${TRITON_PYTORCH_ENABLE_TORCHVISION} = 'ON' ]; then docker cp pytorch_backend_ptlib:/opt/pytorch/vision/torchvision/csrc include/torchvision/torchvision; fi"
252- COMMAND /bin/sh -c "if [ ${TRITON_PYTORCH_ENABLE_TORCHTRT} = 'ON' ]; then docker cp pytorch_backend_ptlib:/usr/local/lib/python3.12/dist-packages/torch_tensorrt/lib/libtorchtrt_runtime.so libtorchtrt_runtime.so; fi"
253- COMMAND docker cp pytorch_backend_ptlib:${PY_INSTALL_PATH} /torch_tensorrt/bin/torchtrtc torchtrtc || echo "error ignored..." || true
286+ COMMAND /bin/sh -c "if [ ${TRITON_PYTORCH_ENABLE_TORCHTRT} = 'ON' ]; then docker cp pytorch_backend_ptlib:${PY_INSTALL_PATH} /torch_tensorrt/lib/libtorchtrt.so libtorchtrt.so; fi"
287+ COMMAND /bin/sh -c "if [ ${TRITON_PYTORCH_ENABLE_TORCHTRT} = 'ON' ]; then docker cp pytorch_backend_ptlib:${PY_INSTALL_PATH} /torch_tensorrt/lib/libtorchtrt_runtime.so libtorchtrt_runtime.so; fi"
288+ COMMAND /bin/sh -c "if [ ${TRITON_PYTORCH_ENABLE_TORCHTRT} = 'ON' ]; then docker cp pytorch_backend_ptlib:${PY_INSTALL_PATH} /torch_tensorrt/bin/torchtrtc torchtrtc; fi"
254289 COMMAND docker cp pytorch_backend_ptlib:/opt/pytorch/pytorch/LICENSE LICENSE.pytorch
255290 COMMAND docker cp pytorch_backend_ptlib:${PY_INSTALL_PATH} /torch/include include /torch
256291 COMMAND docker cp pytorch_backend_ptlib:/opt/pytorch/pytorch/torch/csrc/jit/codegen include /torch/torch/csrc/jit/.
@@ -405,6 +440,9 @@ else()
405440 ENDFOREACH (p)
406441endif () # TRITON_PYTORCH_DOCKER_BUILD
407442
443+ message (TRACE "TRITON_PYTORCH_LDFLAGS: ${TRITON_PYTORCH_LDFLAGS} " )
444+ message (TRACE "TRITON_PYTORCH_LIBS: ${TRITON_PYTORCH_LIBS} " )
445+
408446target_link_libraries (
409447 triton-pytorch-backend
410448 PRIVATE
@@ -429,6 +467,7 @@ endif() # TRITON_ENABLE_GPU
429467#
430468include (GNUInstallDirs)
431469set (INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR} /cmake/TritonPyTorchBackend)
470+ message (TRACE "INSTALL_CONFIGDIR: ${INSTALL_CONFIGDIR} " )
432471
433472install (
434473 TARGETS
@@ -445,6 +484,8 @@ if (${TRITON_PYTORCH_DOCKER_BUILD})
445484 set (PT_LIB_PATHS ${PT_LIB_PATHS} "${CMAKE_CURRENT_BINARY_DIR} /${plib} " )
446485 ENDFOREACH (plib)
447486
487+ message (TRACE "PT_LIB_PATHS: ${PT_LIB_PATHS} " )
488+
448489 install (
449490 FILES
450491 ${PT_LIB_PATHS}
@@ -489,6 +530,8 @@ else()
489530 set (PT_LIB_PATHS ${PT_LIB_PATHS} "${TRITON_PYTORCH_LIB_PATHS} /${plib} " )
490531 ENDFOREACH (plib)
491532
533+ message (TRACE "PT_LIB_PATHS: ${PT_LIB_PATHS} " )
534+
492535 install (
493536 FILES
494537 ${PT_LIB_PATHS}
0 commit comments