From 5d8493dab6ca3096c111e414ff717b494b1ae6f8 Mon Sep 17 00:00:00 2001 From: tejaswinp Date: Thu, 6 Aug 2026 19:40:14 -0700 Subject: [PATCH 1/2] fix(conversion): allow grouped and dilated deconv on TensorRT-RTX TensorRT-RTX defines NV_TENSORRT_MAJOR as TRT_MAJOR_RTX, which is 1. The version comparison guarding setDilationNd()/setNbGroups() therefore fails on every RTX build and selects the pre-TensorRT-7.1 fallback, which rejects any deconvolution with groups > 1 or dilation > 1 and reports "require TensorRT version >= 7.1". TensorRT-RTX supports both, so add the TRT_MAJOR_RTX escape already used for the same purpose in ConversionCtx.cpp and quantization.cpp. This also means setDilationNd() and setNbGroups() are now actually called on RTX rather than silently skipped. Only the TorchScript frontend reaches this code; the dynamo converters are unaffected and already accept grouped deconvolutions on RTX. --- core/conversion/converters/impl/conv_deconv.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/conversion/converters/impl/conv_deconv.cpp b/core/conversion/converters/impl/conv_deconv.cpp index 83b3fe7782..307e9653db 100644 --- a/core/conversion/converters/impl/conv_deconv.cpp +++ b/core/conversion/converters/impl/conv_deconv.cpp @@ -294,7 +294,9 @@ bool add_conv_deconv(ConversionCtx* ctx, const torch::jit::Node* n, args& args) deconv->setStrideNd(stride); deconv->setPrePadding(begPadding); deconv->setPostPadding(padding); -#if NV_TENSORRT_MAJOR > 7 || (NV_TENSORRT_MAJOR == 7 && NV_TENSORRT_MINOR >= 1) +// TensorRT-RTX reports NV_TENSORRT_MAJOR == 1, so the plain version comparison below would +// select the pre-7.1 fallback and reject grouped or dilated deconvolutions that RTX supports. +#if defined(TRT_MAJOR_RTX) || NV_TENSORRT_MAJOR > 7 || (NV_TENSORRT_MAJOR == 7 && NV_TENSORRT_MINOR >= 1) deconv->setDilationNd(dilation); deconv->setNbGroups(groups); #else From 9375394ac8efd28c904011fc338466efd0528af9 Mon Sep 17 00:00:00 2001 From: tejaswinp Date: Thu, 6 Aug 2026 19:40:27 -0700 Subject: [PATCH 2/2] test: guard plugin-backed converter tests on TensorRT-RTX The adaptive pooling, aten::norm and aten::instance_norm converters are implemented with TensorRT plugins, which TensorRT-RTX does not provide, so they are already compiled out for RTX builds. The gtests exercising them cannot pass there and fail conversion with "Expected converter to be true but got false". Guard them with #ifndef TRT_MAJOR_RTX, which is visible in these translation units already via tests/util/util.h -> core/ir/ir.h -> NvInfer.h, so no new includes or build dependencies are needed. Non-RTX builds leave TRT_MAJOR_RTX undefined and keep full coverage. Scope per file: - test_pooling.cpp: the 14 adaptive pooling tests; the max/avg pooling tests above them are unaffected. - test_normalize.cpp: the three ATEN_INTERPOLATE_TESTS invocations that emit aten::norm; the frobenius_norm and linalg_norm tests are left enabled since they do not use that converter. - test_instance_norm.cpp: all three tests, which share one aten::instance_norm graph. Two of them additionally carry a pre-existing unconditional GTEST_SKIP() unrelated to RTX. --- tests/core/conversion/converters/test_instance_norm.cpp | 9 +++++++++ tests/core/conversion/converters/test_normalize.cpp | 6 ++++++ tests/core/conversion/converters/test_pooling.cpp | 8 ++++++++ 3 files changed, 23 insertions(+) diff --git a/tests/core/conversion/converters/test_instance_norm.cpp b/tests/core/conversion/converters/test_instance_norm.cpp index 49dc7d9634..134c6f75c8 100644 --- a/tests/core/conversion/converters/test_instance_norm.cpp +++ b/tests/core/conversion/converters/test_instance_norm.cpp @@ -28,6 +28,13 @@ constexpr auto graph = R"IR( return (%4) )IR"; +// The aten::instance_norm converter is implemented with a TensorRT plugin, which TensorRT-RTX +// does not provide, so aten::instance_norm is left unregistered for RTX builds (see +// core/conversion/converters/impl/batch_norm.cpp). All three tests below share the same +// aten::instance_norm graph, so all three are guarded -- the first two additionally carry an +// unconditional GTEST_SKIP() that is unrelated to RTX. +#ifndef TRT_MAJOR_RTX + TEST(Converters, ATenInstanceNormConvertsCorrectly) { GTEST_SKIP(); auto g = std::make_shared(); @@ -103,3 +110,5 @@ TEST(Converters, ATenInstanceNormRunningStatsConvertsCorrectly) { auto trt_results = torch_tensorrt::tests::util::RunGraphEngine(g, params, {trt_in}); ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0].reshape_as(jit_results[0]))); } + +#endif // TRT_MAJOR_RTX diff --git a/tests/core/conversion/converters/test_normalize.cpp b/tests/core/conversion/converters/test_normalize.cpp index 8c86ab2a6a..bfc3edcb1b 100644 --- a/tests/core/conversion/converters/test_normalize.cpp +++ b/tests/core/conversion/converters/test_normalize.cpp @@ -43,6 +43,11 @@ ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt)); \ } +// The aten::norm converter is implemented with a TensorRT plugin, which TensorRT-RTX does not +// provide, so it is compiled out for RTX builds (see +// core/conversion/converters/impl/normalize.cpp). The aten::frobenius_norm and +// aten::linalg_norm tests below do not use that converter and are left enabled. +#ifndef TRT_MAJOR_RTX ATEN_INTERPOLATE_TESTS( ATenNormOrder1RemoveDims, R"IR( @@ -75,6 +80,7 @@ ATEN_INTERPOLATE_TESTS( %5 : Tensor = aten::norm(%x.1, %3, %2, %4) return (%5))IR", std::vector({3, 4, 3})); +#endif // TRT_MAJOR_RTX TEST(Converters, ATenFrobeniusNorm) { const auto graph = R"IR( diff --git a/tests/core/conversion/converters/test_pooling.cpp b/tests/core/conversion/converters/test_pooling.cpp index 1f9d500b50..b7fb4cc1c7 100644 --- a/tests/core/conversion/converters/test_pooling.cpp +++ b/tests/core/conversion/converters/test_pooling.cpp @@ -410,6 +410,12 @@ TEST(Converters, ATenAvgPool3DNoCountPadConvertsCorrectly) { ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } +// The adaptive pooling converters are implemented with TensorRT plugins, which TensorRT-RTX +// does not provide, so they are compiled out for RTX builds (see +// core/conversion/converters/impl/pooling.cpp). Without this guard every test below fails +// conversion with "Expected converter to be true but got false". +#ifndef TRT_MAJOR_RTX + TEST(Converters, ATenAdaptiveAvgPool2DConvertsCorrectly) { const auto graph = R"IR( graph(%0 : Tensor): @@ -781,3 +787,5 @@ TEST(Converters, ATenAdaptiveMaxPool3DUsingPluginConvertsCorrectly) { ASSERT_TRUE(torch_tensorrt::tests::util::almostEqual(jit_results[0], trt_results[0])); } + +#endif // TRT_MAJOR_RTX