@@ -79,12 +79,13 @@ def load_dep_info():
79
79
dir_path = os .path .join (str (get_root_dir ()), "py" )
80
80
81
81
PRE_CXX11_ABI = False
82
- JETPACK_VERSION = None
82
+ IS_JETPACK = False
83
83
PY_ONLY = False
84
84
NO_TS = False
85
85
LEGACY = False
86
86
RELEASE = False
87
87
CI_BUILD = False
88
+ IS_SBSA = False
88
89
89
90
if "--fx-only" in sys .argv :
90
91
PY_ONLY = True
@@ -121,6 +122,9 @@ def load_dep_info():
121
122
if (gpu_arch_version := os .environ .get ("CU_VERSION" )) is None :
122
123
gpu_arch_version = f"cu{ __cuda_version__ .replace ('.' ,'' )} "
123
124
125
+ if (jetpack := os .environ .get ("JETPACK_BUILD" )) is None :
126
+ if jetpack == "1" :
127
+ IS_JETPACK = True
124
128
125
129
if RELEASE :
126
130
__version__ = os .environ .get ("BUILD_VERSION" )
@@ -136,40 +140,12 @@ def load_dep_info():
136
140
if ci_env_var == "1" :
137
141
CI_BUILD = True
138
142
139
- if "--use-pre-cxx11-abi" in sys .argv :
140
- sys .argv .remove ("--use-pre-cxx11-abi" )
141
- PRE_CXX11_ABI = True
142
-
143
- if (pre_cxx11_abi_env_var := os .environ .get ("USE_PRE_CXX11_ABI" )) is not None :
144
- if pre_cxx11_abi_env_var == "1" :
145
- PRE_CXX11_ABI = True
146
-
147
143
if platform .uname ().processor == "aarch64" :
148
- if "--jetpack-version" in sys .argv :
149
- version_idx = sys .argv .index ("--jetpack-version" ) + 1
150
- version = sys .argv [version_idx ]
151
- sys .argv .remove (version )
152
- sys .argv .remove ("--jetpack-version" )
153
- if version == "4.5" :
154
- JETPACK_VERSION = "4.5"
155
- elif version == "4.6" :
156
- JETPACK_VERSION = "4.6"
157
- elif version == "5.0" :
158
- JETPACK_VERSION = "5.0"
159
- elif version == "6.1" :
160
- JETPACK_VERSION = "6.1"
161
-
162
- if not JETPACK_VERSION :
163
- warnings .warn (
164
- "Assuming jetpack version to be 6.1, if not use the --jetpack-version option"
165
- )
166
- JETPACK_VERSION = "6.1"
167
-
168
- if PRE_CXX11_ABI :
169
- warnings .warn (
170
- "Jetson platform detected. Please remove --use-pre-cxx11-abi flag if you are using it."
171
- )
172
-
144
+ if "--jetpack" in sys .argv :
145
+ sys .argv .remove ("--jetpack" )
146
+ IS_JETPACK = True
147
+ else :
148
+ IS_SBSA = True
173
149
174
150
BAZEL_EXE = None
175
151
if not PY_ONLY :
@@ -204,30 +180,13 @@ def build_libtorchtrt_cxx11_abi(
204
180
if target_python :
205
181
cmd .append ("--config=python" )
206
182
207
- if pre_cxx11_abi :
208
- cmd .append ("--config=pre_cxx11_abi" )
209
- print ("using PRE CXX11 ABI build" )
210
- else :
211
- cmd .append ("--config=cxx11_abi" )
212
- print ("using CXX11 ABI build" )
213
-
214
183
if IS_WINDOWS :
215
184
cmd .append ("--config=windows" )
216
185
else :
217
186
cmd .append ("--config=linux" )
218
187
219
- if JETPACK_VERSION == "4.5" :
220
- cmd .append ("--platforms=//toolchains:jetpack_4.5" )
221
- print ("Jetpack version: 4.5" )
222
- elif JETPACK_VERSION == "4.6" :
223
- cmd .append ("--platforms=//toolchains:jetpack_4.6" )
224
- print ("Jetpack version: 4.6" )
225
- elif JETPACK_VERSION == "5.0" :
226
- cmd .append ("--platforms=//toolchains:jetpack_5.0" )
227
- print ("Jetpack version: 5.0" )
228
- elif JETPACK_VERSION == "6.1" :
229
- cmd .append ("--platforms=//toolchains:jetpack_6.1" )
230
- print ("Jetpack version: 6.1" )
188
+ if IS_JETPACK :
189
+ cmd .append ("--config=jetpack" )
231
190
232
191
if CI_BUILD :
233
192
cmd .append ("--platforms=//toolchains:ci_rhel_x86_64_linux" )
@@ -497,17 +456,52 @@ def run(self):
497
456
package_data = {}
498
457
499
458
if not (PY_ONLY or NO_TS ):
500
- tensorrt_linux_external_dir = (
459
+ tensorrt_windows_external_dir = (
460
+ lambda : subprocess .check_output (
461
+ [BAZEL_EXE , "query" , "@tensorrt_win//:nvinfer" , "--output" , "location" ]
462
+ )
463
+ .decode ("ascii" )
464
+ .strip ()
465
+ .split ("/BUILD.bazel" )[0 ]
466
+ )
467
+
468
+ tensorrt_x86_64_external_dir = (
501
469
lambda : subprocess .check_output (
502
470
[BAZEL_EXE , "query" , "@tensorrt//:nvinfer" , "--output" , "location" ]
503
471
)
504
472
.decode ("ascii" )
505
473
.strip ()
506
474
.split ("/BUILD.bazel" )[0 ]
507
475
)
476
+
477
+ tensorrt_sbsa_external_dir = (
478
+ lambda : subprocess .check_output (
479
+ [BAZEL_EXE , "query" , "@tensorrt_sbsa//:nvinfer" , "--output" , "location" ]
480
+ )
481
+ .decode ("ascii" )
482
+ .strip ()
483
+ .split ("/BUILD.bazel" )[0 ]
484
+ )
485
+
486
+ tensorrt_jetpack_external_dir = (
487
+ lambda : subprocess .check_output (
488
+ [BAZEL_EXE , "query" , "@tensorrt_l4t//:nvinfer" , "--output" , "location" ]
489
+ )
490
+ .decode ("ascii" )
491
+ .strip ()
492
+ .split ("/BUILD.bazel" )[0 ]
493
+ )
494
+
495
+ if IS_SBSA :
496
+ tensorrt_linux_external_dir = tensorrt_sbsa_external_dir ()
497
+ elif IS_JETPACK :
498
+ tensorrt_linux_external_dir = tensorrt_jetpack_external_dir ()
499
+ else :
500
+ tensorrt_linux_external_dir = tensorrt_x86_64_external_dir ()
501
+
508
502
tensorrt_windows_external_dir = (
509
503
lambda : subprocess .check_output (
510
- [BAZEL_EXE , "query" , "@tensorrt_win //:nvinfer" , "--output" , "location" ]
504
+ [BAZEL_EXE , "query" , "@tensorrt_windows //:nvinfer" , "--output" , "location" ]
511
505
)
512
506
.decode ("ascii" )
513
507
.strip ()
0 commit comments