# bluerivertechnology/tensorrt architecture

> Architecture diagram of the GitHub repository bluerivertechnology/tensorrt, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bluerivertechnology/tensorrt
- Repository: https://github.com/bluerivertechnology/tensorrt

## Overview

TensorRT OSS exposes TensorRT’s engine-building and runtime APIs, plugin APIs and implementations, an ONNX parser interface, Python bindings, and engine-analysis utilities. A typical user builds or loads an inference engine through TensorRT, optionally uses plugins for specialized operations, then runs inference; the repository also includes tools for examining engine plans. The README identifies plugins, the ONNX parser, and sample applications as product capabilities. Source excerpts are limited, so unverified implementation links are omitted; paths for unsampled subsystems use existing directories.

Main entry points: [`tools/experimental/trt-engine-explorer/trex/engine_plan.py`](https://github.com/bluerivertechnology/tensorrt/blob/main/tools/experimental/trt-engine-explorer/trex/engine_plan.py) (Engine Plan Model), [`plugin/bertQKVToContextPlugin/mhaRunner.h`](https://github.com/bluerivertechnology/tensorrt/blob/main/plugin/bertQKVToContextPlugin/mhaRunner.h) (Attention Runners), [`include/NvInferPlugin.h`](https://github.com/bluerivertechnology/tensorrt/blob/main/include/NvInferPlugin.h) (Plugin API), [`python/src/infer/pyPlugin.cpp`](https://github.com/bluerivertechnology/tensorrt/blob/main/python/src/infer/pyPlugin.cpp) (Python Plugin Bindings)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["TensorRT APIs"]
  node_builder_api["Builder API<br/>[NvInfer.h]"]
  node_runtime_api["Runtime API<br/>[NvInferRuntime.h]"]
  node_plugin_api["Plugin API<br/>[NvInferPlugin.h]"]
  node_onnx_parser["ONNX Parser<br/>[NvOnnxParser.h]"]
end

subgraph group_plugins["Plugin Implementations"]
  node_plugin_registry["Plugin Registry<br/>[inferPlugin.cpp]"]
  node_bert_plugin["QKV Attention Plugin"]
  node_bert_legacy["Legacy QKV Plugin"]
  node_mha_runner["Attention Runners<br/>[mhaRunner.h]"]
  node_fused_attention["Fused Attention Kernels"]
  node_fused_attention_v2["Attention Kernels V2"]
  node_detection_plugins["Detection Plugins"]
  node_other_plugins["Other Plugins"]
end

subgraph group_python["Python Interfaces"]
  node_python_plugin["Python Plugin Bindings<br/>[pyPlugin.cpp]"]
  node_python_plugin_api["Python Plugin API"]
end

subgraph group_analysis["Engine Analysis"]
  node_engine_processing["Engine Build Profiling<br/>[process_engine.py]"]
  node_engine_plan["Engine Plan Model<br/>[engine_plan.py]"]
  node_engine_comparison["Engine Comparison<br/>[compare_engines.py]"]
  node_engine_drawing["Engine Drawing<br/>[draw_engine.py]"]
  node_engine_summary["Engine Summary"]
end

node_developer(("Application Developer"))

node_developer -.->|"builds with"| node_builder_api
node_developer -.->|"runs inference"| node_runtime_api
node_developer -.->|"parses models"| node_onnx_parser
node_plugin_api -->|"includes"| node_builder_api
node_plugin_registry -.->|"registers plugins"| node_plugin_api
node_bert_plugin -->|"sets up runner"| node_mha_runner
node_bert_legacy -->|"runs attention"| node_mha_runner
node_mha_runner -.->|"dispatches kernels"| node_fused_attention
node_mha_runner -.->|"dispatches kernels"| node_fused_attention_v2
node_developer -.->|"uses bindings"| node_python_plugin
node_python_plugin -->|"uses API"| node_python_plugin_api
node_engine_processing -.->|"profiles engine"| node_engine_plan
node_engine_plan -.->|"compares plans"| node_engine_comparison
node_engine_plan -->|"draws plan"| node_engine_drawing
node_engine_plan -->|"summarizes plan"| node_engine_summary

click node_builder_api "https://github.com/bluerivertechnology/tensorrt/blob/main/include/NvInfer.h"
click node_runtime_api "https://github.com/bluerivertechnology/tensorrt/blob/main/include/NvInferRuntime.h"
click node_plugin_api "https://github.com/bluerivertechnology/tensorrt/blob/main/include/NvInferPlugin.h"
click node_onnx_parser "https://github.com/bluerivertechnology/tensorrt/blob/main/include/NvOnnxParser.h"
click node_plugin_registry "https://github.com/bluerivertechnology/tensorrt/blob/main/plugin/api/inferPlugin.cpp"
click node_bert_plugin "https://github.com/bluerivertechnology/tensorrt/blob/main/plugin/bertQKVToContextPlugin/qkvToContextPlugin.cpp"
click node_bert_legacy "https://github.com/bluerivertechnology/tensorrt/blob/main/plugin/bertQKVToContextPlugin/qkvToContextPluginLegacy.cpp"
click node_mha_runner "https://github.com/bluerivertechnology/tensorrt/blob/main/plugin/bertQKVToContextPlugin/mhaRunner.h"
click node_fused_attention "https://github.com/bluerivertechnology/tensorrt/blob/main/plugin/bertQKVToContextPlugin/fused_multihead_attention/fused_multihead_attention.h"
click node_fused_attention_v2 "https://github.com/bluerivertechnology/tensorrt/blob/main/plugin/bertQKVToContextPlugin/fused_multihead_attention_v2/fused_multihead_attention_v2.h"
click node_detection_plugins "https://github.com/bluerivertechnology/tensorrt/tree/main/plugin/batchedNMSPlugin"
click node_other_plugins "https://github.com/bluerivertechnology/tensorrt/tree/main/plugin"
click node_python_plugin "https://github.com/bluerivertechnology/tensorrt/blob/main/python/src/infer/pyPlugin.cpp"
click node_python_plugin_api "https://github.com/bluerivertechnology/tensorrt/blob/main/include/impl/NvInferPythonPlugin.h"
click node_engine_processing "https://github.com/bluerivertechnology/tensorrt/blob/main/tools/experimental/trt-engine-explorer/utils/process_engine.py"
click node_engine_plan "https://github.com/bluerivertechnology/tensorrt/blob/main/tools/experimental/trt-engine-explorer/trex/engine_plan.py"
click node_engine_comparison "https://github.com/bluerivertechnology/tensorrt/blob/main/tools/experimental/trt-engine-explorer/trex/compare_engines.py"
click node_engine_drawing "https://github.com/bluerivertechnology/tensorrt/blob/main/tools/experimental/trt-engine-explorer/utils/draw_engine.py"
click node_engine_summary "https://github.com/bluerivertechnology/tensorrt/blob/main/tools/experimental/trt-engine-explorer/utils/summarize_engine.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_builder_api,node_runtime_api,node_plugin_api,node_onnx_parser toneBlue
class node_plugin_registry,node_bert_plugin,node_bert_legacy,node_mha_runner,node_fused_attention,node_fused_attention_v2,node_detection_plugins,node_other_plugins toneAmber
class node_python_plugin,node_python_plugin_api toneMint
class node_engine_processing,node_engine_plan,node_engine_comparison,node_engine_drawing,node_engine_summary toneRose
class node_developer toneIndigo
```

## Components

### TensorRT APIs

- [Builder API](https://github.com/bluerivertechnology/tensorrt/blob/main/include/NvInfer.h): `include/NvInfer.h`
- [Runtime API](https://github.com/bluerivertechnology/tensorrt/blob/main/include/NvInferRuntime.h): `include/NvInferRuntime.h`
- [Plugin API](https://github.com/bluerivertechnology/tensorrt/blob/main/include/NvInferPlugin.h): `include/NvInferPlugin.h`
- [ONNX Parser](https://github.com/bluerivertechnology/tensorrt/blob/main/include/NvOnnxParser.h): `include/NvOnnxParser.h`

### Plugin Implementations

- [Plugin Registry](https://github.com/bluerivertechnology/tensorrt/blob/main/plugin/api/inferPlugin.cpp): `plugin/api/inferPlugin.cpp`
- [QKV Attention Plugin](https://github.com/bluerivertechnology/tensorrt/blob/main/plugin/bertQKVToContextPlugin/qkvToContextPlugin.cpp): `plugin/bertQKVToContextPlugin/qkvToContextPlugin.cpp`
- [Legacy QKV Plugin](https://github.com/bluerivertechnology/tensorrt/blob/main/plugin/bertQKVToContextPlugin/qkvToContextPluginLegacy.cpp): `plugin/bertQKVToContextPlugin/qkvToContextPluginLegacy.cpp`
- [Attention Runners](https://github.com/bluerivertechnology/tensorrt/blob/main/plugin/bertQKVToContextPlugin/mhaRunner.h): `plugin/bertQKVToContextPlugin/mhaRunner.h`
- [Fused Attention Kernels](https://github.com/bluerivertechnology/tensorrt/blob/main/plugin/bertQKVToContextPlugin/fused_multihead_attention/fused_multihead_attention.h): `plugin/bertQKVToContextPlugin/fused_multihead_attention/fused_multihead_attention.h`
- [Attention Kernels V2](https://github.com/bluerivertechnology/tensorrt/blob/main/plugin/bertQKVToContextPlugin/fused_multihead_attention_v2/fused_multihead_attention_v2.h): `plugin/bertQKVToContextPlugin/fused_multihead_attention_v2/fused_multihead_attention_v2.h`
- [Detection Plugins](https://github.com/bluerivertechnology/tensorrt/tree/main/plugin/batchedNMSPlugin): `plugin/batchedNMSPlugin`
- [Other Plugins](https://github.com/bluerivertechnology/tensorrt/tree/main/plugin): `plugin`

### Python Interfaces

- [Python Plugin Bindings](https://github.com/bluerivertechnology/tensorrt/blob/main/python/src/infer/pyPlugin.cpp): `python/src/infer/pyPlugin.cpp`
- [Python Plugin API](https://github.com/bluerivertechnology/tensorrt/blob/main/include/impl/NvInferPythonPlugin.h): `include/impl/NvInferPythonPlugin.h`

### Engine Analysis

- [Engine Build Profiling](https://github.com/bluerivertechnology/tensorrt/blob/main/tools/experimental/trt-engine-explorer/utils/process_engine.py): `tools/experimental/trt-engine-explorer/utils/process_engine.py`
- [Engine Plan Model](https://github.com/bluerivertechnology/tensorrt/blob/main/tools/experimental/trt-engine-explorer/trex/engine_plan.py): `tools/experimental/trt-engine-explorer/trex/engine_plan.py`
- [Engine Comparison](https://github.com/bluerivertechnology/tensorrt/blob/main/tools/experimental/trt-engine-explorer/trex/compare_engines.py): `tools/experimental/trt-engine-explorer/trex/compare_engines.py`
- [Engine Drawing](https://github.com/bluerivertechnology/tensorrt/blob/main/tools/experimental/trt-engine-explorer/utils/draw_engine.py): `tools/experimental/trt-engine-explorer/utils/draw_engine.py`
- [Engine Summary](https://github.com/bluerivertechnology/tensorrt/blob/main/tools/experimental/trt-engine-explorer/utils/summarize_engine.py): `tools/experimental/trt-engine-explorer/utils/summarize_engine.py`

### Other components

- **Application Developer**

## Connections

- Application Developer → Builder API: builds with (evidence: `README.md`)
- Application Developer → Runtime API: runs inference (evidence: `README.md`)
- Application Developer → ONNX Parser: parses models (evidence: `README.md`)
- Plugin API → Builder API: includes (evidence: `include/NvInferPlugin.h`)
- Plugin Registry → Plugin API: registers plugins
- QKV Attention Plugin → Attention Runners: sets up runner (evidence: `plugin/bertQKVToContextPlugin/qkvToContextPlugin.cpp`)
- Legacy QKV Plugin → Attention Runners: runs attention (evidence: `plugin/bertQKVToContextPlugin/qkvToContextPluginLegacy.cpp`)
- Attention Runners → Fused Attention Kernels: dispatches kernels
- Attention Runners → Attention Kernels V2: dispatches kernels
- Application Developer → Python Plugin Bindings: uses bindings
- Python Plugin Bindings → Python Plugin API: uses API (evidence: `python/src/infer/pyPlugin.cpp`)
- Engine Build Profiling → Engine Plan Model: profiles engine
- Engine Plan Model → Engine Comparison: compares plans (evidence: `tools/experimental/trt-engine-explorer/trex/compare_engines.py`)
- Engine Plan Model → Engine Drawing: draws plan (evidence: `tools/experimental/trt-engine-explorer/utils/draw_engine.py`)
- Engine Plan Model → Engine Summary: summarizes plan (evidence: `tools/experimental/trt-engine-explorer/utils/summarize_engine.py`)
