-
Notifications
You must be signed in to change notification settings - Fork 20
161 lines (134 loc) · 4.99 KB
/
windows-trt.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
name: Build (Windows-TRT)
on:
push:
paths:
- 'vstrt/**'
- '.github/workflows/windows-trt.yml'
workflow_call:
inputs:
tag:
description: 'which tag to upload to'
required: true
type: string
secrets:
REPO_TOKEN:
required: true
workflow_dispatch:
inputs:
tag:
description: 'which tag to upload to'
default: ''
jobs:
build-windows:
runs-on: windows-2022
defaults:
run:
shell: cmd
working-directory: vstrt
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup MSVC
uses: ilammy/msvc-dev-cmd@v1
- name: Setup Ninja
run: pip install ninja
- name: Cache CUDA
id: cache-cuda
uses: actions/cache@v4
with:
path: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA
key: ${{ runner.os }}-vstrt-cuda-12.6.2
save-always: true
- name: Setup CUDA
if: steps.cache-cuda.outputs.cache-hit != 'true'
run: |
curl -s -o cuda_installer.exe -L https://developer.download.nvidia.com/compute/cuda/12.6.2/network_installers/cuda_12.6.2_windows_network.exe
cuda_installer.exe -s nvcc_12.6 cudart_12.6 cuda_profiler_api_12.6
- name: Download TensorRT
run: |
curl -L -o trt.zip https://developer.nvidia.com/downloads/compute/machine-learning/tensorrt/10.6.0/zip/TensorRT-10.6.0.26.Windows.win10.cuda-12.6.zip
unzip trt.zip
mv TensorRT-*/ tensorrt/
- name: Download VapourSynth headers
run: |
curl -s -o vs.zip -L https://github.com/vapoursynth/vapoursynth/archive/refs/tags/R54.zip
unzip -q vs.zip
mv vapoursynth-*/ vapoursynth/
- name: Configure
run: cmake -S . -B build -G Ninja -LA
-D CMAKE_BUILD_TYPE=Release
-D CMAKE_CXX_FLAGS="/EHsc /Wall /wd4100 /wd4625 /wd4626 /wd4710 /wd4711 /wd4820 /wd4996 /wd5026 /wd5027"
-D CMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded
-D CUDAToolkit_ROOT="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.6"
-D VAPOURSYNTH_INCLUDE_DIRECTORY="%cd%\vapoursynth\include"
-D TENSORRT_HOME="%cd%\tensorrt"
-D USE_NVINFER_PLUGIN=ON
-D TENSORRT_LIBRARY_SUFFIX="_10"
- name: Build
run: cmake --build build --config Release --verbose
- name: Install
run: cmake --install build --prefix install
- name: Checkout TensorRT OSS
uses: actions/checkout@v4
with:
repository: NVIDIA/TensorRT
ref: v10.1.0
fetch-depth: 1
path: tensorrt-oss
- name: Override trtexec CMake file
run: |
cp -f -r -v tensorrt/samples ../tensorrt-oss
cp -f -r -v tensorrt/include ../tensorrt-oss
mv trtexec/CMakeLists.txt ../tensorrt-oss/samples/trtexec
mv trtexec/*.cpp ../tensorrt-oss/samples/trtexec
mv longpath.manifest ../tensorrt-oss/samples/trtexec
- name: Apply patch
run: |
mv trtexec/trtexec.patch ../tensorrt-oss
cd ../tensorrt-oss
copy samples\utils\fileLock.cpp samples\utils\fileLock-utf16le.cpp
powershell "Get-Content samples\utils\fileLock-utf16le.cpp | Out-File samples\utils\fileLock.cpp -Encoding ascii"
git apply trtexec.patch --verbose
copy samples\utils\fileLock.cpp samples\utils\fileLock-utf8.cpp
powershell "Get-Content samples\utils\fileLock-utf8.cpp | Out-File samples\utils\fileLock.cpp"
- name: Configure trtexec
run: cmake -S ../tensorrt-oss/samples/trtexec -B build_trtexec -G Ninja
-D CMAKE_BUILD_TYPE=Release
-D CMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded
-D CUDAToolkit_ROOT="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.6"
-D CMAKE_UNITY_BUILD=ON -D CMAKE_UNITY_BUILD_BATCH_SIZE=0
- name: Build trtexec
run: cmake --build build_trtexec --verbose
- name: Install trtexec
run: cmake --install build_trtexec --prefix trtexec
- name: Prepare for upload
run: |
mkdir artifact
copy install\bin\vstrt.dll artifact\
mkdir artifact\vsmlrt-cuda
copy trtexec\bin\trtexec.exe artifact\vsmlrt-cuda
- name: Describe
run: git describe --tags --long
- name: Dump dependencies
run: dumpbin /dependents artifact\vstrt.dll
- name: Upload
uses: actions/upload-artifact@v4
with:
name: VSTRT-Windows-x64
path: vstrt/artifact
- name: Compress artifact for release
if: github.event_name == 'workflow_dispatch' && github.event.inputs.tag != ''
run: |
cd artifact
7z a -t7z -mx=7 ../../VSTRT-Windows-x64.${{ github.event.inputs.tag }}.7z .
- name: Release
uses: softprops/action-gh-release@v2
if: github.event_name == 'workflow_dispatch' && github.event.inputs.tag != ''
with:
tag_name: ${{ inputs.tag }}
files: VSTRT-Windows-x64.${{ github.event.inputs.tag }}.7z
fail_on_unmatched_files: true
generate_release_notes: false
prerelease: true