Skip to content

Commit bde4860

Browse files
committed
Merge branch 'main' into bose_fx2trt_converters
2 parents cf96dec + 6f7627f commit bde4860

File tree

174 files changed

+2587
-885
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

174 files changed

+2587
-885
lines changed

.circleci/config.yml

Lines changed: 146 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ commands:
263263
parameters:
264264
torch-build:
265265
type: string
266-
default: "2.0.0.dev20230219+cu117"
266+
default: "2.1.0.dev20230314+cu117"
267267
torch-build-index:
268268
type: string
269269
default: "https://download.pytorch.org/whl/nightly/cu117"
@@ -524,15 +524,47 @@ commands:
524524
- store_artifacts:
525525
path: /tmp/testlogs
526526

527-
test-fx_converters:
528-
description: "Test the fx converters"
527+
test-fx_converters_acc:
528+
description: "Test the fx acc converters"
529529
steps:
530530
- run:
531531
name: Run FX converter tests
532532
command: |
533533
cd py/torch_tensorrt/fx/test
534-
pushd converters/
535-
pytest --junitxml=/tmp/artifacts/test_results/fx/converters/test_results.xml
534+
pushd converters/acc_op/
535+
pytest --junitxml=/tmp/artifacts/test_results/fx/converters/acc_op/test_results.xml
536+
popd
537+
538+
- store_test_results:
539+
path: /tmp/artifacts
540+
- store_artifacts:
541+
path: /tmp/testlogs
542+
543+
test-fx_converters_aten:
544+
description: "Test the fx aten converters"
545+
steps:
546+
- run:
547+
name: Run FX converter tests
548+
command: |
549+
cd py/torch_tensorrt/fx/test
550+
pushd converters/aten_op/
551+
pytest --junitxml=/tmp/artifacts/test_results/fx/converters/aten_op/test_results.xml
552+
popd
553+
554+
- store_test_results:
555+
path: /tmp/artifacts
556+
- store_artifacts:
557+
path: /tmp/testlogs
558+
559+
test-fx_converters_vanilla:
560+
description: "Test the fx vanilla converters"
561+
steps:
562+
- run:
563+
name: Run FX converter tests
564+
command: |
565+
cd py/torch_tensorrt/fx/test
566+
pushd converters/vanilla/
567+
pytest --junitxml=/tmp/artifacts/test_results/fx/converters/vanilla/test_results.xml
536568
popd
537569
538570
- store_test_results:
@@ -587,7 +619,7 @@ commands:
587619
path: /tmp/testlogs
588620

589621
test-fx_tracer:
590-
description: "Test the fx tracer"
622+
description: "Test all fx tracers"
591623
steps:
592624
- run:
593625
name: Run FX tracer
@@ -602,6 +634,22 @@ commands:
602634
- store_artifacts:
603635
path: /tmp/testlogs
604636

637+
test-fx_tracer_acc:
638+
description: "Test the fx acc tracer only"
639+
steps:
640+
- run:
641+
name: Run FX tracer
642+
command: |
643+
cd py/torch_tensorrt/fx/test
644+
pushd tracer
645+
list_tracer=$(ls | grep test_acc)
646+
pytest $list_tracer --junitxml=/tmp/artifacts/test_results/fx/tracer/test_results.xml
647+
popd
648+
- store_test_results:
649+
path: /tmp/artifacts
650+
- store_artifacts:
651+
path: /tmp/testlogs
652+
605653
test-fx_quant:
606654
description: "Test the fx quant"
607655
steps:
@@ -625,7 +673,9 @@ commands:
625673
name: Run fx tests
626674
command: |
627675
mkdir -p /tmp/artifacts/test_results
628-
- test-fx_converters
676+
- test-fx_converters_acc
677+
- test-fx_converters_aten
678+
- test-fx_converters_vanilla
629679
- test-fx_passes
630680
- test-fx_tools
631681
- test-fx_trt_lower
@@ -637,6 +687,26 @@ commands:
637687
- store_artifacts:
638688
path: /tmp/testlogs
639689

690+
test-fx-no-aten:
691+
description: "Test the fx backend without aten operators"
692+
steps:
693+
- run:
694+
name: Run fx tests without aten ops
695+
command: |
696+
mkdir -p /tmp/artifacts/test_results
697+
- test-fx_converters_acc
698+
- test-fx_converters_vanilla
699+
- test-fx_passes
700+
- test-fx_tools
701+
- test-fx_trt_lower
702+
- test-fx_tracer_acc
703+
- test-fx_core
704+
- test-fx_quant
705+
- store_test_results:
706+
path: /tmp/artifacts
707+
- store_artifacts:
708+
path: /tmp/testlogs
709+
640710
# Define a job to be invoked later in a workflow.
641711
# See: https://circleci.com/docs/2.0/configuration-reference/#jobs
642712
jobs:
@@ -782,6 +852,37 @@ jobs:
782852
- dump-test-env
783853
- test-fx
784854

855+
test-py-fx-x86_64-linux-no-aten:
856+
parameters:
857+
torch-build:
858+
type: string
859+
torch-build-index:
860+
type: string
861+
trt-version-long:
862+
type: string
863+
machine:
864+
image: ubuntu-2004-cuda-11.4:202110-01
865+
resource_class: gpu.nvidia.large
866+
steps:
867+
- checkout
868+
- attach_workspace:
869+
at: /tmp/dist/
870+
- install-torch-from-index:
871+
torch-build: << parameters.torch-build >>
872+
torch-build-index: << parameters.torch-build-index >>
873+
- create-py-env:
874+
trt-version-long: << parameters.trt-version-long >>
875+
- install-cudnn
876+
# - run:
877+
# name: "Set LD_LIBRARY_PATH path to include the installed CUDNN"
878+
# command: export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/:$LD_LIBRARY_PATH
879+
- run:
880+
name: "Install torch-tensorrt"
881+
command: pip3 install --pre /tmp/dist/x86_64-linux/*cp39-cp39*.whl
882+
# We install torch after torch-trt because pip automatically enforces the version constraint otherwise
883+
- dump-test-env
884+
- test-fx-no-aten
885+
785886
package-x86_64-linux:
786887
parameters:
787888
enabled:
@@ -1070,10 +1171,16 @@ parameters:
10701171
# Nightly platform config
10711172
torch-build:
10721173
type: string
1073-
default: "2.0.0.dev20230219+cu117"
1174+
default: "2.1.0.dev20230314+cu117"
10741175
torch-build-index:
10751176
type: string
10761177
default: "https://download.pytorch.org/whl/nightly/cu117"
1178+
torch-build-legacy:
1179+
type: string
1180+
default: "1.13.1+cu117"
1181+
torch-build-index-legacy:
1182+
type: string
1183+
default: "https://download.pytorch.org/whl/cu117"
10771184
cudnn-version:
10781185
type: string
10791186
default: "8.5.0.96"
@@ -1127,6 +1234,7 @@ workflows:
11271234
- release/**/*
11281235
jobs:
11291236
- build-x86_64-linux:
1237+
name: build-x86_64-linux
11301238
torch-build: << pipeline.parameters.torch-build >>
11311239
torch-build-index: << pipeline.parameters.torch-build-index >>
11321240

@@ -1153,6 +1261,36 @@ workflows:
11531261
requires:
11541262
- build-x86_64-linux
11551263

1264+
- build-x86_64-linux:
1265+
name: build-x86_64-linux-legacy
1266+
torch-build: << pipeline.parameters.torch-build-legacy >>
1267+
torch-build-index: << pipeline.parameters.torch-build-index-legacy >>
1268+
1269+
- test-core-cpp-x86_64-linux:
1270+
name: test-core-cpp-x86_64-linux-legacy
1271+
torch-build: << pipeline.parameters.torch-build-legacy >>
1272+
torch-build-index: << pipeline.parameters.torch-build-index-legacy >>
1273+
trt-version-short: << pipeline.parameters.trt-version-short >>
1274+
trt-version-long: << pipeline.parameters.trt-version-long >>
1275+
cudnn-version: << pipeline.parameters.cudnn-version >>
1276+
requires:
1277+
- build-x86_64-linux-legacy
1278+
1279+
- test-py-ts-x86_64-linux:
1280+
name: test-py-ts-x86_64-linux-legacy
1281+
torch-build: << pipeline.parameters.torch-build-legacy >>
1282+
torch-build-index: << pipeline.parameters.torch-build-index-legacy >>
1283+
trt-version-long: << pipeline.parameters.trt-version-long >>
1284+
requires:
1285+
- build-x86_64-linux-legacy
1286+
1287+
- test-py-fx-x86_64-linux-no-aten:
1288+
torch-build: << pipeline.parameters.torch-build-legacy >>
1289+
torch-build-index: << pipeline.parameters.torch-build-index-legacy >>
1290+
trt-version-long: << pipeline.parameters.trt-version-long >>
1291+
requires:
1292+
- build-x86_64-linux-legacy
1293+
11561294
release:
11571295
when: << pipeline.parameters.enable-packaging >>
11581296
jobs:

README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ import torch_tensorrt
7373
...
7474
7575
trt_ts_module = torch_tensorrt.compile(torch_script_module,
76+
# If the inputs to the module are plain Tensors, specify them via the `inputs` argument:
7677
inputs = [example_tensor, # Provide example tensor for input shape or...
7778
torch_tensorrt.Input( # Specify input object with shape and dtype
7879
min_shape=[1, 3, 224, 224],
@@ -81,6 +82,12 @@ trt_ts_module = torch_tensorrt.compile(torch_script_module,
8182
# For static size shape=[1, 3, 224, 224]
8283
dtype=torch.half) # Datatype of input tensor. Allowed options torch.(float|half|int8|int32|bool)
8384
],
85+
86+
# For inputs containing tuples or lists of tensors, use the `input_signature` argument:
87+
# Below, we have an input consisting of a Tuple of two Tensors (Tuple[Tensor, Tensor])
88+
# input_signature = ( (torch_tensorrt.Input(shape=[1, 3, 224, 224], dtype=torch.half),
89+
# torch_tensorrt.Input(shape=[1, 3, 224, 224], dtype=torch.half)), ),
90+
8491
enabled_precisions = {torch.half}, # Run with FP16
8592
)
8693
@@ -114,7 +121,7 @@ torch.jit.save(trt_ts_module, "trt_torchscript_module.ts") # save the TRT embedd
114121
These are the following dependencies used to verify the testcases. Torch-TensorRT can work with other versions, but the tests are not guaranteed to pass.
115122

116123
- Bazel 5.2.0
117-
- Libtorch 2.0.0.dev20230103 (built with CUDA 11.7)
124+
- Libtorch 2.1.0.dev20230314 (built with CUDA 11.7)
118125
- CUDA 11.7
119126
- cuDNN 8.5.0
120127
- TensorRT 8.5.1.7
@@ -124,7 +131,7 @@ These are the following dependencies used to verify the testcases. Torch-TensorR
124131
Releases: https://github.com/pytorch/TensorRT/releases
125132

126133
```
127-
pip install torch-tensorrt==1.2.0 --find-links https://github.com/pytorch/TensorRT/releases/expanded_assets/v1.2.0
134+
pip install torch-tensorrt
128135
```
129136

130137
## Compiling Torch-TensorRT

WORKSPACE

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,17 @@ new_local_repository(
5656
http_archive(
5757
name = "libtorch",
5858
build_file = "@//third_party/libtorch:BUILD",
59-
sha256 = "8b3b48615169c83c1b643c0efade078ea080b1da598e15fcf01bc59421f3095e",
59+
sha256 = "7c4b8754830fef23ec19c5eaf414794cee9597b435df055f5c1d0471d3e81568",
6060
strip_prefix = "libtorch",
61-
urls = ["https://download.pytorch.org/libtorch/nightly/cu117/libtorch-cxx11-abi-shared-with-deps-2.0.0.dev20230219%2Bcu117.zip"],
61+
urls = ["https://download.pytorch.org/libtorch/nightly/cu117/libtorch-cxx11-abi-shared-with-deps-2.1.0.dev20230314%2Bcu117.zip"],
6262
)
6363

6464
http_archive(
6565
name = "libtorch_pre_cxx11_abi",
6666
build_file = "@//third_party/libtorch:BUILD",
67-
sha256 = "aa7fd06079d260ff83c344d043fb84fbd9cf831cf375ed8b5a1b62416817af31",
67+
sha256 = "f1e64a75dd12d0ba4c8c1f61947299e0a9c50684dff64f0cfbf355aa7a13e8cf",
6868
strip_prefix = "libtorch",
69-
urls = ["https://download.pytorch.org/libtorch/nightly/cu117/libtorch-shared-with-deps-2.0.0.dev20230219%2Bcu117.zip"],
69+
urls = ["https://download.pytorch.org/libtorch/nightly/cu117/libtorch-shared-with-deps-2.1.0.dev20230314%2Bcu117.zip"],
7070
)
7171

7272
# Download these tarballs manually from the NVIDIA website

0 commit comments

Comments
 (0)