DLA enabled engine not getting created in NVIDIA Orin NX using C++ API

I am trying to create engine file for my custom onnx model in Jetson Orin NX, I am hit by this error:

ERROR: DLA execution was requested for the network using setDefaultDeviceType, but neither FP16 or Int8 mode is enabled
ERROR: 4: [network.cpp::validate::2789] Error Code 4: Internal Error (DLA validation failed)
ERROR: 2: [builder.cpp::buildSerializedNetwork::751] Error Code 2: Internal Error (Assertion engine != nullptr failed. )

But I have enabled inference precision as FP16 in my code. Here is my snippet for setting Builder Config flags:


When I created engine file for the same onnx model using trtexec binary, I was able to generate it. And with this engine, I could execute inference as well.

12/01/2023-11:31:34] [I] [TRT] ---------- Layers Running on DLA ----------
[12/01/2023-11:31:34] [I] [TRT] [DlaLayer] {ForeignNode[Conv_0…Concat_10]}
[12/01/2023-11:31:34] [I] [TRT] [DlaLayer] {ForeignNode[Slice_49…Concat_58]}
[12/01/2023-11:31:34] [I] [TRT] [DlaLayer] {ForeignNode[Slice_97…Concat_106]}

[12/01/2023-11:31:34] [I] [TRT] ---------- Layers Running on GPU ----------
[12/01/2023-11:31:34] [I] [TRT] [GpuLayer] SHUFFLE: Reshape_32 + Transpose_33
[12/01/2023-11:31:34] [I] [TRT] [GpuLayer] SHUFFLE: Reshape_38

I was also successful in running sampleOnnxMNIST code on DLA too. I am not sure why my C++ engine creation code does not work


TensorRT Version: 8.5.2
GPU Type: Orin
Nvidia Driver Version: 35.4.1 / 5.10.120-tegra
CUDA Version: 11.4
CUDNN Version:
Operating System + Version:
Python Version (if applicable):
TensorFlow Version (if applicable):
PyTorch Version (if applicable):
Baremetal or Container (if container which image + tag):

Relevant Files

Please attach or include links to any models, data, files, or scripts necessary to reproduce your issue. (Github repo, Google Drive, Dropbox, etc.)

Steps To Reproduce

Please include:

  • Exact steps/commands to build your repro
  • Exact steps/commands to run your repro
  • Full traceback of errors encountered

Unfortunately, it was some issue with my IDE, and my module works fine in C++ also. Thanks