Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion TRITON_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.70.0dev
2.70.0
4 changes: 2 additions & 2 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@
"triton_container_version": "26.06dev",
"upstream_container_version": "26.05",
"ort_version": "1.24.4",
"ort_openvino_version": "2026.1.0",
"standalone_openvino_version": "2026.1.0",
"ort_openvino_version": "2026.2.0",
"standalone_openvino_version": "2026.2.0",
"dcgm_version": "4.5.3-1",
"rhel_py_version": "3.12.3",
}
Expand Down
22 changes: 22 additions & 0 deletions qa/common/gen_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,28 @@ def np_to_torch_dtype(np_dtype):
return None


def trt_set_dynamic_range(tensor, lo, hi):
"""Set ITensor.dynamic_range on TRT versions that support it.

Removed in TensorRT 11+ (strongly-typed networks). Silently skip on
versions where the attribute is gone so the QA model-gen scripts stay
compatible with both old and new TRT."""
try:
tensor.dynamic_range = (lo, hi)
except AttributeError:
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
pass # ITensor.dynamic_range removed in TensorRT 11+ (strongly-typed)


def trt_cast_tensor(network, tensor, target_dtype):
"""Insert an explicit dtype cast that works on both TRT 8.5+ (add_cast)
and older TRT (add_identity + set_output_type). Returns the cast layer."""
if hasattr(network, "add_cast"):
return network.add_cast(tensor, target_dtype)
layer = network.add_identity(tensor)
layer.set_output_type(0, target_dtype)
return layer


def openvino_save_model(model_version_dir, model):
import openvino as ov

Expand Down
51 changes: 36 additions & 15 deletions qa/common/gen_qa_dyna_sequence_implicit_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@
import os

import numpy as np
from gen_common import np_to_model_dtype, np_to_onnx_dtype, np_to_trt_dtype
from gen_common import (
np_to_model_dtype,
np_to_onnx_dtype,
np_to_trt_dtype,
trt_set_dynamic_range,
)

FLAGS = None
np_dtype_string = np.dtype(object)
Expand Down Expand Up @@ -388,7 +393,10 @@ def create_plan_modelfile(models_dir, model_version, max_batch, dtype, shape):
not_start = network.add_elementwise(
constant_1.get_output(0), start0, trt.ElementWiseOperation.SUB
)
not_start.set_output_type(0, trt_dtype)
# set_output_type was removed from all layers in TensorRT 11; the
# elementwise output already has trt_dtype, so this was a no-op.
if hasattr(not_start, "set_output_type"):
not_start.set_output_type(0, trt_dtype)

input_state_cond_temp = network.add_elementwise(
ready0, not_start.get_output(0), trt.ElementWiseOperation.SUM
Expand Down Expand Up @@ -527,7 +535,10 @@ def create_plan_rf_modelfile(models_dir, model_version, max_batch, dtype, shape)
not_start = network.add_elementwise(
constant_1.get_output(0), start0, trt.ElementWiseOperation.SUB
)
not_start.set_output_type(0, trt_dtype)
# set_output_type was removed from all layers in TensorRT 11; the
# elementwise output already has trt_dtype, so this was a no-op.
if hasattr(not_start, "set_output_type"):
not_start.set_output_type(0, trt_dtype)

input_state_cond_temp = network.add_elementwise(
ready0, not_start.get_output(0), trt.ElementWiseOperation.SUM
Expand All @@ -552,11 +563,19 @@ def create_plan_rf_modelfile(models_dir, model_version, max_batch, dtype, shape)

out0.get_output(0).name = "OUTPUT"
network.mark_output(out0.get_output(0))
out0.get_output(0).dtype = trt_dtype
# ITensor.dtype setter removed in TRT 11; elementwise output already has
# trt_dtype.
try:
out0.get_output(0).dtype = trt_dtype
except AttributeError:
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
pass # ITensor.dtype setter removed in TensorRT 11+

out0_state.get_output(0).name = "OUTPUT_STATE"
network.mark_output(out0_state.get_output(0))
out0_state.get_output(0).dtype = trt_dtype
try:
out0_state.get_output(0).dtype = trt_dtype
except AttributeError:
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
pass # ITensor.dtype setter removed in TensorRT 11+

in0.allowed_formats = 1 << int(trt_memory_format)
in_state0.allowed_formats = 1 << int(trt_memory_format)
Expand All @@ -566,21 +585,23 @@ def create_plan_rf_modelfile(models_dir, model_version, max_batch, dtype, shape)
out0_state.get_output(0).allowed_formats = 1 << int(trt_memory_format)

if trt_dtype == trt.int8:
in0.dynamic_range = (-128.0, 127.0)
in_state0.dynamic_range = (-128.0, 127.0)
out0.dynamic_range = (-128.0, 127.0)
out0_state.dynamic_range = (-128.0, 127.0)
start0.dynamic_range = (-128.0, 127.0)
ready0.dynamic_range = (-128.0, 127.0)

trt_set_dynamic_range(in0, -128.0, 127.0)
trt_set_dynamic_range(in_state0, -128.0, 127.0)
trt_set_dynamic_range(out0, -128.0, 127.0)
trt_set_dynamic_range(out0_state, -128.0, 127.0)
trt_set_dynamic_range(start0, -128.0, 127.0)
trt_set_dynamic_range(ready0, -128.0, 127.0)
flags = 1 << int(trt.BuilderFlag.DIRECT_IO)
flags |= 1 << int(trt.BuilderFlag.PREFER_PRECISION_CONSTRAINTS)
# TensorRT 11 removed PREFER_PRECISION_CONSTRAINTS / INT8 / FP16
# BuilderFlags (strongly-typed networks). Older TRT still has them.
if hasattr(trt.BuilderFlag, "PREFER_PRECISION_CONSTRAINTS"):
flags |= 1 << int(trt.BuilderFlag.PREFER_PRECISION_CONSTRAINTS)
if hasattr(trt.BuilderFlag, "REJECT_EMPTY_ALGORITHMS"):
flags |= 1 << int(trt.BuilderFlag.REJECT_EMPTY_ALGORITHMS)

if trt_dtype == trt.int8:
if trt_dtype == trt.int8 and hasattr(trt.BuilderFlag, "INT8"):
flags |= 1 << int(trt.BuilderFlag.INT8)
elif trt_dtype == trt.float16:
elif trt_dtype == trt.float16 and hasattr(trt.BuilderFlag, "FP16"):
flags |= 1 << int(trt.BuilderFlag.FP16)

config = builder.create_builder_config()
Expand Down
67 changes: 44 additions & 23 deletions qa/common/gen_qa_dyna_sequence_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
np_to_torch_dtype,
np_to_trt_dtype,
openvino_save_model,
trt_set_dynamic_range,
)

FLAGS = None
Expand Down Expand Up @@ -101,15 +102,26 @@ def create_plan_shape_tensor_modelfile(
resized_out0 = resize_layer.get_output(0)

shape_out0.get_output(0).name = "SHAPE_OUTPUT"
shape_out0.get_output(0).dtype = trt.int64
# ITensor.dtype setter removed in TRT 11; shape/elementwise/resize
# outputs already have the correct dtype.
try:
shape_out0.get_output(0).dtype = trt.int64
except AttributeError:
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
pass # ITensor.dtype setter removed in TensorRT 11+
network.mark_output_for_shapes(shape_out0.get_output(0))

out0.name = "OUTPUT"
out0.dtype = trt.int32
try:
out0.dtype = trt.int32
except AttributeError:
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
pass # ITensor.dtype setter removed in TensorRT 11+
network.mark_output(out0)

resized_out0.name = "RESIZED_OUTPUT"
resized_out0.dtype = trt_dtype
try:
resized_out0.dtype = trt_dtype
except AttributeError:
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
pass # ITensor.dtype setter removed in TensorRT 11+
network.mark_output(resized_out0)

shape_in0.allowed_formats = 1 << int(trt_memory_format)
Expand All @@ -121,20 +133,22 @@ def create_plan_shape_tensor_modelfile(
resized_out0.allowed_formats = 1 << int(trt_memory_format)

if trt_dtype == trt.int8:
dummy_in0.dynamic_range = (-128.0, 127.0)
resized_out0.dynamic_range = (-128.0, 127.0)
start0.dynamic_range = (-128.0, 127.0)
end0.dynamic_range = (-128.0, 127.0)
ready0.dynamic_range = (-128.0, 127.0)

trt_set_dynamic_range(dummy_in0, -128.0, 127.0)
trt_set_dynamic_range(resized_out0, -128.0, 127.0)
trt_set_dynamic_range(start0, -128.0, 127.0)
trt_set_dynamic_range(end0, -128.0, 127.0)
trt_set_dynamic_range(ready0, -128.0, 127.0)
flags = 1 << int(trt.BuilderFlag.DIRECT_IO)
flags |= 1 << int(trt.BuilderFlag.PREFER_PRECISION_CONSTRAINTS)
# TensorRT 11 removed PREFER_PRECISION_CONSTRAINTS / INT8 / FP16
# BuilderFlags (strongly-typed networks). Older TRT still has them.
if hasattr(trt.BuilderFlag, "PREFER_PRECISION_CONSTRAINTS"):
flags |= 1 << int(trt.BuilderFlag.PREFER_PRECISION_CONSTRAINTS)
if hasattr(trt.BuilderFlag, "REJECT_EMPTY_ALGORITHMS"):
flags |= 1 << int(trt.BuilderFlag.REJECT_EMPTY_ALGORITHMS)

if trt_dtype == trt.int8:
if trt_dtype == trt.int8 and hasattr(trt.BuilderFlag, "INT8"):
flags |= 1 << int(trt.BuilderFlag.INT8)
elif trt_dtype == trt.float16:
elif trt_dtype == trt.float16 and hasattr(trt.BuilderFlag, "FP16"):
flags |= 1 << int(trt.BuilderFlag.FP16)

min_prefix = []
Expand Down Expand Up @@ -353,29 +367,36 @@ def create_plan_rf_modelfile(models_dir, model_version, max_batch, dtype, shape)
out0.get_output(0).name = "OUTPUT"
network.mark_output(out0.get_output(0))

out0.get_output(0).dtype = trt_dtype
# ITensor.dtype setter removed in TRT 11; elementwise output already has
# trt_dtype.
try:
out0.get_output(0).dtype = trt_dtype
except AttributeError:
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
pass # ITensor.dtype setter removed in TensorRT 11+

in0.allowed_formats = 1 << int(trt_memory_format)
start0.allowed_formats = 1 << int(trt_memory_format)
ready0.allowed_formats = 1 << int(trt_memory_format)
out0.get_output(0).allowed_formats = 1 << int(trt_memory_format)

if trt_dtype == trt.int8:
in0.dynamic_range = (-128.0, 127.0)
out0.dynamic_range = (-128.0, 127.0)
start0.dynamic_range = (-128.0, 127.0)
end0.dynamic_range = (-128.0, 127.0)
ready0.dynamic_range = (-128.0, 127.0)
corrid0.dynamic_range = (-128.0, 127.0)

trt_set_dynamic_range(in0, -128.0, 127.0)
trt_set_dynamic_range(out0, -128.0, 127.0)
trt_set_dynamic_range(start0, -128.0, 127.0)
trt_set_dynamic_range(end0, -128.0, 127.0)
trt_set_dynamic_range(ready0, -128.0, 127.0)
trt_set_dynamic_range(corrid0, -128.0, 127.0)
flags = 1 << int(trt.BuilderFlag.DIRECT_IO)
flags |= 1 << int(trt.BuilderFlag.PREFER_PRECISION_CONSTRAINTS)
# TensorRT 11 removed PREFER_PRECISION_CONSTRAINTS / INT8 / FP16
# BuilderFlags (strongly-typed networks). Older TRT still has them.
if hasattr(trt.BuilderFlag, "PREFER_PRECISION_CONSTRAINTS"):
flags |= 1 << int(trt.BuilderFlag.PREFER_PRECISION_CONSTRAINTS)
if hasattr(trt.BuilderFlag, "REJECT_EMPTY_ALGORITHMS"):
flags |= 1 << int(trt.BuilderFlag.REJECT_EMPTY_ALGORITHMS)

if trt_dtype == trt.int8:
if trt_dtype == trt.int8 and hasattr(trt.BuilderFlag, "INT8"):
flags |= 1 << int(trt.BuilderFlag.INT8)
elif trt_dtype == trt.float16:
elif trt_dtype == trt.float16 and hasattr(trt.BuilderFlag, "FP16"):
flags |= 1 << int(trt.BuilderFlag.FP16)

min_shape = []
Expand Down
49 changes: 34 additions & 15 deletions qa/common/gen_qa_identity_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
np_to_onnx_dtype,
np_to_trt_dtype,
openvino_save_model,
trt_set_dynamic_range,
)

FLAGS = None
Expand Down Expand Up @@ -552,14 +553,18 @@ def create_plan_dynamic_rf_modelfile(
out_node = network.add_identity(in_node)

out_node.get_output(0).name = "OUTPUT{}".format(io_num)
out_node.get_output(0).dtype = trt_dtype
# Identity preserves input dtype; the ITensor.dtype setter was
# removed in TensorRT 11. Older TRT versions still accept it.
try:
out_node.get_output(0).dtype = trt_dtype
except AttributeError:
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
pass # ITensor.dtype setter removed in TensorRT 11+
network.mark_output(out_node.get_output(0))
out_node.get_output(0).allowed_formats = 1 << int(trt_memory_format)

if trt_dtype == trt.int8:
in_node.dynamic_range = (-128.0, 127.0)
out_node.get_output(0).dynamic_range = (-128.0, 127.0)

trt_set_dynamic_range(in_node, -128.0, 127.0)
trt_set_dynamic_range(out_node.get_output(0), -128.0, 127.0)
min_shape = []
opt_shape = []
max_shape = []
Expand All @@ -583,14 +588,17 @@ def create_plan_dynamic_rf_modelfile(
profile.set_shape("INPUT{}".format(io_num), min_shape, opt_shape, max_shape)

flags = 1 << int(trt.BuilderFlag.DIRECT_IO)
flags |= 1 << int(trt.BuilderFlag.PREFER_PRECISION_CONSTRAINTS)
# TensorRT 11 removed PREFER_PRECISION_CONSTRAINTS / INT8 / FP16
# BuilderFlags (strongly-typed networks). Older TRT still has them.
if hasattr(trt.BuilderFlag, "PREFER_PRECISION_CONSTRAINTS"):
flags |= 1 << int(trt.BuilderFlag.PREFER_PRECISION_CONSTRAINTS)
if hasattr(trt.BuilderFlag, "REJECT_EMPTY_ALGORITHMS"):
flags |= 1 << int(trt.BuilderFlag.REJECT_EMPTY_ALGORITHMS)
datatype_set = set([trt_dtype])
for dt in datatype_set:
if dt == trt.int8:
if dt == trt.int8 and hasattr(trt.BuilderFlag, "INT8"):
flags |= 1 << int(trt.BuilderFlag.INT8)
elif dt == trt.float16:
elif dt == trt.float16 and hasattr(trt.BuilderFlag, "FP16"):
flags |= 1 << int(trt.BuilderFlag.FP16)
config = builder.create_builder_config()
config.flags = flags
Expand Down Expand Up @@ -668,18 +676,26 @@ def create_plan_shape_tensor_modelfile(

dummy_out_node.name = "DUMMY_OUTPUT{}".format(io_num)

dummy_out_node.dtype = trt_dtype
# The ITensor.dtype setter was removed in TensorRT 11; resize and
# shape layers already produce the correct dtype, so suppress the
# AttributeError instead of changing the older-TRT behavior.
try:
dummy_out_node.dtype = trt_dtype
except AttributeError:
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
pass # ITensor.dtype setter removed in TensorRT 11+
network.mark_output(dummy_out_node)
dummy_out_node.allowed_formats = 1 << int(trt_memory_format)

out_node.get_output(0).dtype = trt.int64
try:
out_node.get_output(0).dtype = trt.int64
except AttributeError:
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
pass # ITensor.dtype setter removed in TensorRT 11+
network.mark_output_for_shapes(out_node.get_output(0))
out_node.get_output(0).allowed_formats = 1 << int(trt_memory_format)

if trt_dtype == trt.int8:
in_node.dynamic_range = (-128.0, 127.0)
out_node.get_output(0).dynamic_range = (-128.0, 127.0)

trt_set_dynamic_range(in_node, -128.0, 127.0)
trt_set_dynamic_range(out_node.get_output(0), -128.0, 127.0)
config = builder.create_builder_config()

min_prefix = []
Expand Down Expand Up @@ -707,14 +723,17 @@ def create_plan_shape_tensor_modelfile(
config.add_optimization_profile(profile)

flags = 1 << int(trt.BuilderFlag.DIRECT_IO)
flags |= 1 << int(trt.BuilderFlag.PREFER_PRECISION_CONSTRAINTS)
# TensorRT 11 removed PREFER_PRECISION_CONSTRAINTS / INT8 / FP16
# BuilderFlags (strongly-typed networks). Older TRT still has them.
if hasattr(trt.BuilderFlag, "PREFER_PRECISION_CONSTRAINTS"):
flags |= 1 << int(trt.BuilderFlag.PREFER_PRECISION_CONSTRAINTS)
if hasattr(trt.BuilderFlag, "REJECT_EMPTY_ALGORITHMS"):
flags |= 1 << int(trt.BuilderFlag.REJECT_EMPTY_ALGORITHMS)
datatype_set = set([trt_dtype])
for dt in datatype_set:
if dt == trt.int8:
if dt == trt.int8 and hasattr(trt.BuilderFlag, "INT8"):
flags |= 1 << int(trt.BuilderFlag.INT8)
elif dt == trt.float16:
elif dt == trt.float16 and hasattr(trt.BuilderFlag, "FP16"):
flags |= 1 << int(trt.BuilderFlag.FP16)
config.flags = flags

Expand Down
Loading
Loading