Skip to content

Commit

Permalink
fix rpaths in trtllm-backend
Browse files Browse the repository at this point in the history
  • Loading branch information
yorickvP committed Apr 15, 2024
1 parent 57b92cf commit 00a1983
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion nix/tensorrt-llm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ stdenv.mkDerivation (o: {
mkdir -p $out/cpp/build/tensorrt_llm/plugins
pushd tensorrt_llm
cp ./libtensorrt_llm.so $out/cpp/build/tensorrt_llm/
patchelf --add-needed 'libcudnn.so.8' $out/cpp/build/tensorrt_llm/libtensorrt_llm.so
patchelf --add-needed 'libcudnn.so.8' --add-rpath ${cudaPackages.cudnn.lib}/lib $out/cpp/build/tensorrt_llm/libtensorrt_llm.so
cp ./plugins/libnvinfer_plugin_tensorrt_llm.so* $out/cpp/build/tensorrt_llm/plugins/
for f in $out/cpp/build/tensorrt_llm/plugins/*.so*; do
if [ ! -L "$f" ]; then
Expand Down
12 changes: 11 additions & 1 deletion nix/trtllm-backend.nix
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,19 @@ oldGccStdenv.mkDerivation rec {
"-DTRT_INCLUDE_DIR=${tensorrt-src}/include"
"-DTRTLLM_DIR=${tensorrt-llm}"
];
postInstall = ''
mkdir -p $out/backends/tensorrtllm
cp libtriton_*.so triton_tensorrtllm_worker $out/backends/tensorrtllm
rm -r /build/source/inflight_batcher_llm/build/_deps/repo-core-build
rm -r /build/source/inflight_batcher_llm/build/libtriton_tensorrtllm_common.so
'';
# buildInputs = [ tensorrt-llm ];
postFixup = ''
patchelf $out/backends/tensorrtllm/libtriton_tensorrtllm.so \
--add-rpath ${trt_lib_dir}:${tensorrt-llm}/cpp/build/tensorrt_llm:${tensorrt-llm}/cpp/build/tensorrt_llm/plugins
--add-rpath '$ORIGIN:${trt_lib_dir}:${tensorrt-llm}/cpp/build/tensorrt_llm:${tensorrt-llm}/cpp/build/tensorrt_llm/plugins:${cudaPackages.cudnn.lib}/lib'
patchelf $out/backends/tensorrtllm/libtriton_tensorrtllm_common.so \
--add-rpath '$ORIGIN:${trt_lib_dir}:${tensorrt-llm}/cpp/build/tensorrt_llm:${tensorrt-llm}/cpp/build/tensorrt_llm/plugins:${cudaPackages.cudnn.lib}/lib'
patchelf $out/backends/tensorrtllm/triton_tensorrtllm_worker \
--add-rpath '$ORIGIN:${trt_lib_dir}:${tensorrt-llm}/cpp/build/tensorrt_llm:${tensorrt-llm}/cpp/build/tensorrt_llm/plugins:${cudaPackages.cudnn.lib}/lib'
'';
}

0 comments on commit 00a1983

Please sign in to comment.