ONNX Parser Flags for DLA#
Important
DLA support depends on your platform and package. In TensorRT 11.5.0, DLA is supported on Windows on ARM, where it is in beta. NVIDIA Jetson AGX Orin has DLA on NVIDIA JetPack 7.2.2 or later, but through TensorRT 11.4.1 rather than 11.5.0, because NVIDIA JetPack is not supported in TensorRT 11.5.0. DLA is not supported on NVIDIA Jetson AGX Thor or for NVIDIA DriveOS deployments. Refer to Working with DLA for the platforms and packages that support DLA.
When building from an ONNX model, use OnnxParserFlag values to control
DLA-specific parsing behavior: IParser::setFlags() takes a bitmask in C++,
and IParser.set_flag() sets one flag per call in Python. The flag names in
this section are the C++ enumerators; the Python members drop the leading
k. All three DLA-specific flags are disabled by default.
kENABLE_UINT8_AND_ASYMMETRIC_QUANTIZATION_DLAEnables UINT8 as a quantization data type and permits asymmetric quantization with nonzero zero-point values in
QuantizeLinearandDequantizeLinearnodes. Without this flag, the parser converts UINT8 constants to INT32.This flag is required for the asymmetric
IQuantizeLayerandIDequantizeLayersupport described in DLA Supported Layers for Windows on ARM. The scale must be FP32, and the zero-point must be UINT8. The target platform must be NVIDIA Orin or Windows on ARM.kREPORT_CAPABILITY_DLAValidates each parsed ONNX node against DLA support. If a resulting TensorRT layer cannot run on DLA, parsing fails with a descriptive error instead of allowing the layer to fall back to GPU.
Before calling
IParser::parse(), provide a validIBuilderConfigby callingIParser::setBuilderConfig(), orset_builder_config()in Python. When this flag is set,IParser::isSubgraphSupported()also reports capability in the DLA context.kADJUST_FOR_DLAOpportunistically rewrites or modifies layers during parsing to make them more amenable to DLA execution. For example, the parser can reshape tensors to 4D or adjust quantization formats.
The following example enables all three flags for a DLA build:
parser->setFlags(
(1U << static_cast<uint32_t>(
OnnxParserFlag::kENABLE_UINT8_AND_ASYMMETRIC_QUANTIZATION_DLA))
| (1U << static_cast<uint32_t>(
OnnxParserFlag::kREPORT_CAPABILITY_DLA))
| (1U << static_cast<uint32_t>(
OnnxParserFlag::kADJUST_FOR_DLA)));
parser->setBuilderConfig(builderConfig);
parser.set_flag(trt.OnnxParserFlag.ENABLE_UINT8_AND_ASYMMETRIC_QUANTIZATION_DLA)
parser.set_flag(trt.OnnxParserFlag.REPORT_CAPABILITY_DLA)
parser.set_flag(trt.OnnxParserFlag.ADJUST_FOR_DLA)
parser.set_builder_config(builder_config)
The builder configuration must remain valid until parsing is complete.