is_trt_plugin_export_enabled() -> booldetrium.ops.trt_plugins
TensorRT 10.7+ / 11+ Ahead-of-Time (AOT) CUDA Plugin for `ms_deform_attn_v2` (fused). Provides: 1. `export_ms_deform_attn_trt_plugin(enabled=True)`: context manager that switches `MSDeformableAttention` + `TransformerDecoder.value_op` during `torch.onnx.export` to emit a single `dfine::MSDeformAttnV2Fused` ONNX custom node per decoder layer (skipping `.permute().split()` and eliminating all `GridSample` + `Reshape/Transpose` fragmentation). 2. `register_trt_plugins()`: registers the `dfine::MSDeformAttnV2Fused` plugin with TensorRT via `tensorrt.plugin` (`@trtp.register` + `@trtp.aot_impl` + `@trtp.impl`). The AOT implementation compiles the specialized `half2` / `bfloat162` / scalar CUDA kernel directly to PTX via `nvcc --ptx` with `DeformMeta` baked as immediate constants, embedding raw PTX inside the serialized `.engine` for zero-Python-overhead, native CUDA-Graph-compatible execution on TRT 10.7+ / 11+.
has_trt_plugin_support() -> boolReturn True iff the installed TensorRT Python package exposes `tensorrt.plugin` (TRT >= 10.7+).
export_ms_deform_attn_trt_plugin(enabled: bool=True)Enable/disable emitting `dfine::MSDeformAttnV2Fused` during `torch.onnx.export`.
| 名称 | 类型 | 默认值 |
|---|---|---|
enabled | bool | True |
ms_deform_attn_v2_fused_trt_export(value: torch.Tensor, spatial_shapes: Sequence[Sequence[int]], sampling_offsets: torch.Tensor, attention_logits: torch.Tensor, reference_points: torch.Tensor, num_points_list: Sequence[int], offset_scale: float=0.5) -> torch.TensorExport-time entrypoint that emits `dfine::MSDeformAttnV2Fused` in ONNX.
| 名称 | 类型 | 默认值 |
|---|---|---|
value | torch.Tensor | — |
spatial_shapes | Sequence[Sequence[int]] | — |
sampling_offsets | torch.Tensor | — |
attention_logits | torch.Tensor | — |
reference_points | torch.Tensor | — |
num_points_list | Sequence[int] | — |
offset_scale | float | 0.5 |
register_trt_plugins() -> NoneRegister `dfine::MSDeformAttnV2Fused` (AOT CUDA PTX + JIT fallback) with TensorRT.