Skip to content

Commit c2e396a

Browse files
authored
Merge pull request #1158 from pytorch/trt_8.4_rel_1.1
feat: Upgrade TensorRT to 8.4 EA
2 parents 3cf58a2 + 5da47c1 commit c2e396a

File tree

5 files changed

+11
-47
lines changed

5 files changed

+11
-47
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ These are the following dependencies used to verify the testcases. Torch-TensorR
113113
- Bazel 4.2.1
114114
- Libtorch 1.11.0 (built with CUDA 11.3)
115115
- CUDA 11.3 (10.2 on Jetson)
116-
- cuDNN 8.2.1
117-
- TensorRT 8.2.4.2 (TensorRT 8.2.1 on Jetson)
116+
- cuDNN 8.3.2
117+
- TensorRT 8.4.0.6
118118

119119
## Prebuilt Binaries and Wheel files
120120

WORKSPACE

+6-6
Original file line numberDiff line numberDiff line change
@@ -76,20 +76,20 @@ http_archive(
7676
http_archive(
7777
name = "cudnn",
7878
build_file = "@//third_party/cudnn/archive:BUILD",
79-
sha256 = "0e5d2df890b9967efa6619da421310d97323565a79f05a1a8cb9b7165baad0d7",
80-
strip_prefix = "cuda",
79+
sha256 = "5500953c08c5e5d1dddcfda234f9efbddcdbe43a53b26dc0a82c723fa170c457",
80+
strip_prefix = "cudnn-linux-x86_64-8.3.2.44_cuda11.5-archive",
8181
urls = [
82-
"https://developer.nvidia.com/compute/machine-learning/cudnn/secure/8.2.4/11.4_20210831/cudnn-11.4-linux-x64-v8.2.4.15.tgz",
82+
"https://developer.nvidia.com/compute/cudnn/secure/8.3.2/local_installers/11.5/cudnn-linux-x86_64-8.3.2.44_cuda11.5-archive.tar.xz",
8383
],
8484
)
8585

8686
http_archive(
8787
name = "tensorrt",
8888
build_file = "@//third_party/tensorrt/archive:BUILD",
89-
sha256 = "826180eaaecdf9a7e76116855b9f1f3400ea9b06e66b06a3f6a0747ba6f863ad",
90-
strip_prefix = "TensorRT-8.2.4.2",
89+
sha256 = "0cd8071d717f1b870ada79ce5889ab3d702439c356e96cbef23d0b469007fcb4",
90+
strip_prefix = "TensorRT-8.4.0.6",
9191
urls = [
92-
"https://developer.nvidia.com/compute/machine-learning/tensorrt/secure/8.2.4/tars/tensorrt-8.2.4.2.linux.x86_64-gnu.cuda-11.4.cudnn8.2.tar.gz",
92+
"https://developer.nvidia.com/compute/machine-learning/tensorrt/secure/8.4.0/tars/tensorrt-8.4.0.6.linux.x86_64-gnu.cuda-11.6.cudnn8.3.tar.gz",
9393
],
9494
)
9595

core/conversion/converters/converter_util.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,9 @@ nvinfer1::ITensor* castITensor(ConversionCtx* ctx, nvinfer1::ITensor* tensor, nv
135135

136136
auto id_layer = ctx->net->addIdentity(*tensor);
137137
TORCHTRT_CHECK(id_layer, "Unable to create identity layer for ITensor: " << tensor_id.str());
138+
// layer->setOutputType should be used for casting and not manually setting output_tensor->setType()
139+
id_layer->setOutputType(0, dtype);
138140
auto casted_tensor = id_layer->getOutput(0);
139-
casted_tensor->setType(dtype);
140-
141141
LOG_DEBUG(ctx->logger, "Casting ITensor " << tensor_id.str() << " from " << tensor->getType() << " to " << dtype);
142142

143143
std::stringstream ss;

tests/core/partitioning/test_fallback_graph_output.cpp

-36
Original file line numberDiff line numberDiff line change
@@ -66,40 +66,4 @@ TEST(Partitioning, ComputeMobileNetFallbackGraphCorrectly) {
6666
auto trt_results = trt_mod.forward(trt_inputs_ivalues).toTensor();
6767
ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results, trt_results, 2e-6));
6868
}
69-
70-
TEST(Partitioning, ComputeResNet50HalfFallbackGraphCorrectly) {
71-
torch::jit::script::Module mod;
72-
try {
73-
mod = torch::jit::load("tests/modules/resnet50_traced.jit.pt");
74-
} catch (const c10::Error& e) {
75-
std::cerr << "error loading the model\n";
76-
return;
77-
}
78-
79-
mod.to(torch::kHalf);
80-
81-
const std::vector<std::vector<int64_t>> input_shapes = {{1, 3, 224, 224}};
82-
std::vector<torch::jit::IValue> jit_inputs_ivalues;
83-
std::vector<torch::jit::IValue> trt_inputs_ivalues;
84-
for (auto in_shape : input_shapes) {
85-
auto in = at::randint(5, in_shape, {at::kCUDA}).to(torch::kHalf);
86-
jit_inputs_ivalues.push_back(in.clone());
87-
trt_inputs_ivalues.push_back(in.clone());
88-
}
89-
90-
auto in_shape = torch_tensorrt::core::ir::Input({1, 3, 224, 224});
91-
in_shape.dtype = nvinfer1::DataType::kHALF;
92-
93-
std::vector<torch_tensorrt::core::ir::Input> input_ranges({in_shape});
94-
auto g = mod.get_method("forward").graph();
95-
torch_tensorrt::core::CompileSpec cfg(input_ranges);
96-
cfg.partition_info.enabled = true;
97-
cfg.partition_info.forced_fallback_operators.push_back("aten::add");
98-
99-
auto jit_results = mod.forward(jit_inputs_ivalues).toTensor();
100-
auto trt_mod = torch_tensorrt::core::CompileGraph(mod, cfg);
101-
auto trt_results = trt_mod.forward(trt_inputs_ivalues).toTensor();
102-
// Lower threshold because FP16
103-
ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results, trt_results, 2e-1));
104-
}
10569
#endif

third_party/cudnn/archive/BUILD

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ cc_library(
99

1010
cc_import(
1111
name = "cudnn_lib",
12-
shared_library = "lib64/libcudnn.so",
12+
shared_library = "lib/libcudnn.so",
1313
visibility = ["//visibility:private"],
1414
)
1515

0 commit comments

Comments
 (0)