Skip to content

Miscellanous TRT EP changes for DLA - #15

Open
hrishikeshm wants to merge 6 commits into
onnxruntime:mainfrom
hrishikeshm:hrishikeshm/dla-transforms-support
Open

Miscellanous TRT EP changes for DLA#15
hrishikeshm wants to merge 6 commits into
onnxruntime:mainfrom
hrishikeshm:hrishikeshm/dla-transforms-support

Conversation

@hrishikeshm

Copy link
Copy Markdown
Contributor
  1. Add support for DLA transforms
  2. Support for arena allocator on DLA
  3. Compilation fixes for ARM64 cross-compilation
  4. DLA specific unittests

When cross-compiling (e.g. x64 host to ARM64 target), FetchContent builds
protoc for the target arch which cannot execute on the host. The shim
creates an IMPORTED protobuf::protoc target from a pre-built host-arch
binary when -DPROTOC_EXECUTABLE is passed, with -Dprotobuf_BUILD_PROTOC_BINARIES=OFF
to skip building the target-arch protoc. No-op for normal native builds.
… logger suppression

- BindContextInput/Output: unregister old DLA address before rebinding if pointer changed
- Add trt_dla_static_io_buffers option to defer post-inference unregistration
- Suppress WARNING-level TRT log messages in TensorrtLogger
Replace per-run cudaMalloc/cudaFree with a BFC arena allocator that retains freed
GPU blocks in size-class bins and reuses them without calling into the CUDA runtime.
Implements Shrink() and matches canonical DeallocateChunk stream-clear behaviour.
Adds trt_dla_transform_enable provider option that can be used to apply DLA
transforms before TRT capability checking and engine compilation.

- Capability check: transforms applied to check_buf; on full TRT
  support, parser_nodes_list is rebuilt with N-space indices since
  supportsModelV2 returns M-space subgraph indices for the transformed
  model. Partial support raises an error. Partially supported graphs
  will be supported via a followup change
- Engine compile: ApplyDlaTransforms mutates string_buf in-place
  before the TRT parser sees it.
- Cache key gains _dlatransform suffix to avoid loading engines built
  without transforms.
- DLA_TRANSFORMS_ROOT / onnxruntime_ep_tensorrt_DLA_TRANSFORMS CMake
  option controls optional linkage against dla_transforms.lib.
…transforms scope

- Wrap both GetSupportedList call sites in GetCapabilityImpl (noexcept) with
  try/catch(std::exception) converting throws to OrtStatus* returns; previously
  an uncaught std::runtime_error from THROW() would call std::terminate()
- Extract duplicated DLA tensor address rebind pattern from BindContextInput and
  BindContextOutput into a single SetTensorAddressDla() helper
- Restore original TensorrtLogger::log() behaviour: remove the hardcoded kERROR
  cap, reinstate full severity label string and correct ORT log-level mapping
  (WARNING -> ORT_LOGGING_LEVEL_WARNING, ERROR -> ORT_LOGGING_LEVEL_ERROR)
- Restrict onnxruntime_ep_tensorrt_DLA_TRANSFORMS to Windows: option is now
  declared on all platforms but emits a CMake FATAL_ERROR on non-Windows builds;
  removes the unused Linux .so link path
Python:
- test_basic_inference.py: FP16 Conv smoke test
- test_dla_options.py: DLA option validation (Cat 1) and functional tests
  (Cat 3-6): mem_pool_limit, static_io_buffers, uint8_asymmetric_quantization,
  adjust_for_dla
- test_dla_transforms.py: A16W8 MatMul with DLA transforms
- conftest.py: plugin EP registration, has_dla / has_dla_transforms fixtures
- ort_helpers.py: create_session, run_in_large_stack, run_session_once

C++ (GTest):
- test_main.cc / test_config.h: shared env, CLI flags (--target=gpu|dla),
  EP lib auto-discovery adjacent to binary
- tensorrt_basic_test.cc / cuda_graph_test.cc: refactored to shared globals
- tensorrt_ep_dla_transforms_test.cc: mirrors test_dla_transforms.py
- tensorrt_ep_dla_options_test.cc: mirrors test_dla_options.py (Cat 1, 3-6)
- CMakeLists.txt: BUILD_TESTS wires all sources, copies EP + DLA DLLs post-build
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants