Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into sam2-image
Browse files Browse the repository at this point in the history
  • Loading branch information
parthchadha committed Nov 25, 2024
2 parents 14b53ca + c8ee99f commit 6324c61
Show file tree
Hide file tree
Showing 194 changed files with 6,149 additions and 2,524 deletions.
212 changes: 193 additions & 19 deletions .github/workflows/mlir-tensorrt-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,18 @@ on:
- main
types: [synchronize, opened, reopened, ready_for_review]
paths: ["mlir-tensorrt/**"]
push:
branches:
- main
paths: ["mlir-tensorrt/**"]

env:
DEFAULT_IMAGE: ghcr.io/nvidia/tensorrt-incubator/mlir-tensorrt:cuda12.5-ubuntu-llvm17
REGISTRY: ghcr.io

jobs:
mlir-tensorrt-tests:
if: github.event.pull_request.draft == false
mlir-tensorrt-test-pr:
if: github.event_name == 'pull_request' && github.event.pull_request.draft == false
# `ubuntu-latest` is a CPU runner.
# If selected, tests requiring GPU are not run.
runs-on: ubuntu-latest
Expand Down Expand Up @@ -128,9 +132,183 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
run: |
export CCACHE_BASEDIR="$PWD"
export CCACHE_DIR="$PWD/ccache"
export CCACHE_COMPILERCHECK=content
export CCACHE_DIR="/ccache"
export CCACHE_MAXSIZE=10G
ccache --zero-stats || true
ccache --show-stats || true
cd mlir-tensorrt
cat > build_and_test.sh <<EOF
#!/bin/bash
set -e
python3 -m pip install -r python/requirements-dev.txt
cmake -B ./build -S . -G Ninja \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DMLIR_TRT_PACKAGE_CACHE_DIR=/.cache.cpm \
-DMLIR_TRT_ENABLE_ASSERTIONS=ON \
-DMLIR_TRT_DOWNLOAD_TENSORRT_VERSION=10.5 \
-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ \
-DMLIR_TRT_USE_LINKER=lld \
-DMLIR_EXECUTOR_ENABLE_GPU_INTEGRATION_TESTS=OFF
ninja -C build all
ninja -C build check-mlir-executor
ninja -C build check-mlir-tensorrt-dialect
ninja -C build check-mlir-tensorrt
cd ..
ccache --show-stats || true
EOF
bash build_and_test.sh
# Run LIT tests with TensorRT 10 & ASAN
- name: Run MLIR-TensorRT lit tests with TensorRT 10, ASAN enabled
uses: addnab/docker-run-action@v3
with:
image: ${{ env.DEFAULT_IMAGE }}
options: -v ${{ github.workspace }}/mlir-tensorrt:/mlir-tensorrt -v ${{ github.workspace }}/ccache:/ccache -v ${{ github.workspace }}/.ccache.cpm:/.ccache.cpm
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
run: |
export CCACHE_DIR="/ccache"
export CCACHE_MAXSIZE=10G
ccache --zero-stats || true
ccache --show-stats || true
cd mlir-tensorrt
cat > build_and_test.sh <<EOF
#!/bin/bash
set -e
python3 -m pip install -r python/requirements-dev.txt
cmake -B ./build -S . -G Ninja \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DMLIR_TRT_PACKAGE_CACHE_DIR=/.cache.cpm \
-DMLIR_TRT_ENABLE_ASSERTIONS=ON \
-DMLIR_TRT_DOWNLOAD_TENSORRT_VERSION=10.5 \
-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ \
-DMLIR_TRT_USE_LINKER=lld \
-DMLIR_EXECUTOR_ENABLE_GPU_INTEGRATION_TESTS=OFF \
-DENABLE_ASAN=ON
ninja -C build all
ninja -C build check-mlir-executor
ninja -C build check-mlir-tensorrt-dialect
ninja -C build check-mlir-tensorrt
cd ..
ccache --show-stats || true
EOF
bash build_and_test.sh
# Run LIT tests with TensorRT 8
- name: Run MLIR-TensorRT lit tests with TensorRT 8
uses: addnab/docker-run-action@v3
with:
image: ${{ env.DEFAULT_IMAGE }}
options: -v ${{ github.workspace }}/mlir-tensorrt:/mlir-tensorrt -v ${{ github.workspace }}/ccache:/ccache -v ${{ github.workspace }}/.ccache.cpm:/.ccache.cpm
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
run: |
export CCACHE_DIR="/ccache"
export CCACHE_MAXSIZE=10G
ccache --zero-stats || true
ccache --show-stats || true
cd mlir-tensorrt
cat > build_and_test.sh <<EOF
#!/bin/bash
set -e
python3 -m pip install -r python/requirements-dev.txt
cmake -B ./build -S . -G Ninja \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DMLIR_TRT_PACKAGE_CACHE_DIR=/.cache.cpm \
-DMLIR_TRT_ENABLE_ASSERTIONS=ON \
-DMLIR_TRT_DOWNLOAD_TENSORRT_VERSION=8.6.1.6 \
-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ \
-DMLIR_TRT_USE_LINKER=lld \
-DMLIR_EXECUTOR_ENABLE_GPU_INTEGRATION_TESTS=OFF
ninja -C build all
ninja -C build check-mlir-executor
ninja -C build check-mlir-tensorrt-dialect
ninja -C build check-mlir-tensorrt
cd ..
ccache --show-stats || true
EOF
bash build_and_test.sh
mlir-tensorrt-test-main:
if: github.event_name == 'push'
# `ubuntu-latest` is a CPU runner.
# If selected, tests requiring GPU are not run.
runs-on: ubuntu-latest

steps:
# Free some disk space, otherwise we get OOM error.
- name: Free disk space
run: |
sudo rm -rf \
/usr/share/dotnet "$AGENT_TOOLSDIRECTORY" /usr/local/lib/android /opt/ghc \
/usr/local/share/powershell /usr/share/swift /usr/local/.ghcup \
/usr/lib/jvm
sudo apt-get purge microsoft-edge-stable || true
sudo apt-get purge google-cloud-cli || true
sudo apt-get purge dotnet-sdk-* || true
sudo apt-get purge google-chrome-stable || true
sudo apt-get autoremove -y
sudo apt-get autoclean -y
# Value of `github.workspace` is /home/runner/work/{repo_name}/{repo-name}
# i.e. /home/runner/work/TensorRT-Incubator/TensorRT-Incubator in our case.
# After this action, repo is cloned inside above path.
- uses: actions/checkout@v4
with:
fetch-depth: 5

# Create cache folders
- name: Create cache folder
run: |
mkdir -p ${{ github.workspace }}/ccache
mkdir -p ${{ github.workspace }}/.ccache.cpm
# Create cache action
- name: Create cache action
id: core-build-cache
uses: actions/cache@v4
with:
key: ${{ runner.os }}-mlir-tensorrt-core-build
path: |
${{ github.workspace }}/ccache
${{ github.workspace }}/.ccache.cpm
# Run LIT tests with TensorRT 10
- name: Run MLIR-TensorRT lit tests with TensorRT 10
uses: addnab/docker-run-action@v3
with:
image: ${{ env.DEFAULT_IMAGE }}
options: -v ${{ github.workspace }}/mlir-tensorrt:/mlir-tensorrt -v ${{ github.workspace }}/ccache:/ccache -v ${{ github.workspace }}/.ccache.cpm:/.ccache.cpm
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
run: |
export CCACHE_DIR="/ccache"
export CCACHE_MAXSIZE=10G
ccache --zero-stats || true
ccache --show-stats || true
Expand All @@ -144,9 +322,9 @@ jobs:
cmake -B ./build -S . -G Ninja \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DMLIR_TRT_PACKAGE_CACHE_DIR=${PWD}/.cache.cpm \
-DMLIR_TRT_PACKAGE_CACHE_DIR=/.cache.cpm \
-DMLIR_TRT_ENABLE_ASSERTIONS=ON \
-DMLIR_TRT_DOWNLOAD_TENSORRT_VERSION=10.2 \
-DMLIR_TRT_DOWNLOAD_TENSORRT_VERSION=10.5 \
-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ \
-DMLIR_TRT_USE_LINKER=lld \
-DMLIR_EXECUTOR_ENABLE_GPU_INTEGRATION_TESTS=OFF
Expand All @@ -173,9 +351,7 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
run: |
export CCACHE_BASEDIR="$PWD"
export CCACHE_DIR="$PWD/ccache"
export CCACHE_COMPILERCHECK=content
export CCACHE_DIR="/ccache"
export CCACHE_MAXSIZE=10G
ccache --zero-stats || true
ccache --show-stats || true
Expand All @@ -189,9 +365,9 @@ jobs:
cmake -B ./build -S . -G Ninja \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DMLIR_TRT_PACKAGE_CACHE_DIR=${PWD}/.cache.cpm \
-DMLIR_TRT_PACKAGE_CACHE_DIR=/.cache.cpm \
-DMLIR_TRT_ENABLE_ASSERTIONS=ON \
-DMLIR_TRT_DOWNLOAD_TENSORRT_VERSION=10.2 \
-DMLIR_TRT_DOWNLOAD_TENSORRT_VERSION=10.5 \
-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ \
-DMLIR_TRT_USE_LINKER=lld \
-DMLIR_EXECUTOR_ENABLE_GPU_INTEGRATION_TESTS=OFF \
Expand All @@ -209,8 +385,8 @@ jobs:
bash build_and_test.sh
# Run LIT tests with TensorRT 9
- name: Run MLIR-TensorRT lit tests with TensorRT 9
# Run LIT tests with TensorRT 8
- name: Run MLIR-TensorRT lit tests with TensorRT 8
uses: addnab/docker-run-action@v3
with:
image: ${{ env.DEFAULT_IMAGE }}
Expand All @@ -219,9 +395,7 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
run: |
export CCACHE_BASEDIR="$PWD"
export CCACHE_DIR="$PWD/ccache"
export CCACHE_COMPILERCHECK=content
export CCACHE_DIR="/ccache"
export CCACHE_MAXSIZE=10G
ccache --zero-stats || true
ccache --show-stats || true
Expand All @@ -235,9 +409,9 @@ jobs:
cmake -B ./build -S . -G Ninja \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DMLIR_TRT_PACKAGE_CACHE_DIR=${PWD}/.cache.cpm \
-DMLIR_TRT_PACKAGE_CACHE_DIR=/.cache.cpm \
-DMLIR_TRT_ENABLE_ASSERTIONS=ON \
-DMLIR_TRT_DOWNLOAD_TENSORRT_VERSION=9.2.0.5 \
-DMLIR_TRT_DOWNLOAD_TENSORRT_VERSION=8.6.1.6 \
-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ \
-DMLIR_TRT_USE_LINKER=lld \
-DMLIR_EXECUTOR_ENABLE_GPU_INTEGRATION_TESTS=OFF
Expand Down
2 changes: 1 addition & 1 deletion mlir-tensorrt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ mtrt_option(MLIR_TRT_ENABLE_EXECUTOR "Build the Executor dialect and MLIR-Tensor
mtrt_option(MLIR_TRT_ENABLE_NCCL "Enable the NCCL runtime module" ON)

set(MLIR_TRT_TENSORRT_DIR "" CACHE STRING "Path to TensorRT install directory")
set(MLIR_TRT_DOWNLOAD_TENSORRT_VERSION "10.2" CACHE STRING
set(MLIR_TRT_DOWNLOAD_TENSORRT_VERSION "10.5" CACHE STRING
"Version of TensorRT to download and use. It overrides MLIR_TRT_TENSORRT_DIR.")
set(MLIR_TRT_PACKAGE_CACHE_DIR "" CACHE STRING "Directory where to cache downloaded C++ packages")
set(MLIR_TRT_USE_LINKER "" CACHE STRING "Specify a linker to use (e.g. LLD); this is just an alias for LLVM_USE_LINKER")
Expand Down
2 changes: 1 addition & 1 deletion mlir-tensorrt/Version.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
set(MLIR_TENSORRT_VERSION_MAJOR "0")
set(MLIR_TENSORRT_VERSION_MINOR "1")
set(MLIR_TENSORRT_VERSION_PATCH "36")
set(MLIR_TENSORRT_VERSION_PATCH "37")
set(MLIR_TENSORRT_VERSION
"${MLIR_TENSORRT_VERSION_MAJOR}.${MLIR_TENSORRT_VERSION_MINOR}.${MLIR_TENSORRT_VERSION_PATCH}")

38 changes: 34 additions & 4 deletions mlir-tensorrt/build_tools/cmake/Dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,15 @@ function(download_tensorrt)
if(ARG_VERSION VERSION_EQUAL "10.2")
set(ARG_VERSION "10.2.0.19")
endif()
# Canonicalize "10.5" version by setting it to the latest public TRT 10.5 version.
if(ARG_VERSION VERSION_EQUAL "10.5")
set(ARG_VERSION "10.5.0.18")
endif()

set(downloadable_versions
"9.0.1.4" "9.1.0.4" "9.2.0.5"
"8.6.1.6" "9.0.1.4" "9.1.0.4" "9.2.0.5"
"10.0.0.6" "10.1.0.27"
"10.2.0.19"
"10.2.0.19" "10.5.0.18"
)

if(NOT ARG_VERSION IN_LIST downloadable_versions)
Expand All @@ -100,6 +104,28 @@ function(download_tensorrt)

set(TRT_VERSION "${ARG_VERSION}")

# Handle TensorRT 8 versions. These are publicly accessible download links.
if(ARG_VERSION VERSION_LESS 9.0.0 AND ARG_VERSION VERSION_GREATER 8.0.0)
string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" trt_short_version ${ARG_VERSION})
set(CUDA_VERSION "12.0")
set(OS "linux")
EXECUTE_PROCESS(COMMAND uname -m
COMMAND tr -d '\n'
OUTPUT_VARIABLE ARCH)
if(ARCH STREQUAL "arm64")
set(ARCH "aarch64")
set(OS "Ubuntu-20.04")
elseif(ARCH STREQUAL "amd64")
set(ARCH "x86_64")
set(OS "Linux")
elseif(ARCH STREQUAL "aarch64")
set(OS "Ubuntu-20.04")
elseif(NOT (ARCH STREQUAL "x86_64"))
message(FATAL_ERROR "Direct download not available for architecture: ${ARCH}")
endif()
set(_url "https://developer.nvidia.com/downloads/compute/machine-learning/tensorrt/secure/${trt_short_version}/tars/TensorRT-${TRT_VERSION}.${OS}.${ARCH}-gnu.cuda-${CUDA_VERSION}.tar.gz")
endif()

# Handle TensorRT 9 versions. These are publicly accessible download links.
if(ARG_VERSION VERSION_LESS 10.0.0 AND ARG_VERSION VERSION_GREATER 9.0.0)
string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" trt_short_version ${ARG_VERSION})
Expand Down Expand Up @@ -137,19 +163,23 @@ function(download_tensorrt)
set(_url "https://developer.nvidia.com/downloads/compute/machine-learning/tensorrt/10.2.0/tars/TensorRT-10.2.0.19.Linux.x86_64-gnu.cuda-12.5.tar.gz")
endif()

if(ARG_VERSION VERSION_EQUAL 10.5.0.18)
set(_url "https://developer.nvidia.com/downloads/compute/machine-learning/tensorrt/10.5.0/tars/TensorRT-10.5.0.18.Linux.x86_64-gnu.cuda-12.6.tar.gz")
endif()

if(NOT _url)
message(FATAL_ERROR "Could not determine TensorRT download URL")
endif()

message(STATUS "TensorRT Download URL: ${_url}")

CPMAddPackage(
NAME TensorRT9
NAME TensorRT
VERSION "${TRT_VERSION}"
URL ${_url}
DOWNLOAD_ONLY
)
set("${ARG_OUT_VAR}" "${TensorRT9_SOURCE_DIR}" PARENT_SCOPE)
set("${ARG_OUT_VAR}" "${TensorRT_SOURCE_DIR}" PARENT_SCOPE)
endfunction()

#-------------------------------------------------------------------------------------
Expand Down
Loading

0 comments on commit 6324c61

Please sign in to comment.