detrium.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+.

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.Tensor

Export-time entrypoint that emits `dfine::MSDeformAttnV2Fused` in ONNX.

名称类型默认值
valuetorch.Tensor—
spatial_shapesSequence[Sequence[int]]—
sampling_offsetstorch.Tensor—
attention_logitstorch.Tensor—
reference_pointstorch.Tensor—
num_points_listSequence[int]—
offset_scalefloat0.5