pub struct TensorRtBackend {
pub inference_metrics: InferenceMetrics,
pub precision_policy: PrecisionPolicy,
pub batch_config: BatchConfig,
/* private fields */
}Expand description
TensorRT/CUDA ORT inference backend.
Implements UpscaleBackend using
ONNX Runtime with a TensorRT or CUDA execution provider. Output buffers
are managed via a fixed-size OutputRing to avoid per-frame allocation.
Fields§
§inference_metrics: InferenceMetricsAtomic inference latency and frame count metrics.
precision_policy: PrecisionPolicyPrecision policy used when building the TensorRT EP session.
batch_config: BatchConfigBatch configuration (must have max_batch = 1 — batching not yet implemented).
Implementations§
Source§impl TensorRtBackend
impl TensorRtBackend
Sourcepub fn new(
model_path: PathBuf,
ctx: Arc<GpuContext>,
device_id: i32,
ring_size: usize,
downstream_capacity: usize,
) -> Self
pub fn new( model_path: PathBuf, ctx: Arc<GpuContext>, device_id: i32, ring_size: usize, downstream_capacity: usize, ) -> Self
Create a new backend instance.
§Parameters
ring_size: number of output ring slots to pre-allocate.downstream_capacity: the bounded channel capacity between inference and the encoder. Ring size is validated ≥downstream_capacity + 2.
Sourcepub fn with_precision(
model_path: PathBuf,
ctx: Arc<GpuContext>,
device_id: i32,
ring_size: usize,
downstream_capacity: usize,
precision_policy: PrecisionPolicy,
batch_config: BatchConfig,
) -> Self
pub fn with_precision( model_path: PathBuf, ctx: Arc<GpuContext>, device_id: i32, ring_size: usize, downstream_capacity: usize, precision_policy: PrecisionPolicy, batch_config: BatchConfig, ) -> Self
Create with explicit precision policy and batch config.
Sourcepub async fn ring_metrics(&self) -> Option<RingMetricsSnapshot>
pub async fn ring_metrics(&self) -> Option<RingMetricsSnapshot>
Access ring metrics (if initialized).
Sourcepub fn selected_provider(&self) -> Option<&str>
pub fn selected_provider(&self) -> Option<&str>
Active ORT execution provider selected during initialization.
Trait Implementations§
Source§impl Drop for TensorRtBackend
impl Drop for TensorRtBackend
Source§impl UpscaleBackend for TensorRtBackend
impl UpscaleBackend for TensorRtBackend
Source§fn initialize<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn initialize<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Warm up the backend: load the model, allocate buffers, build engine plans.
Source§fn process<'life0, 'async_trait>(
&'life0 self,
input: GpuTexture,
) -> Pin<Box<dyn Future<Output = Result<GpuTexture>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn process<'life0, 'async_trait>(
&'life0 self,
input: GpuTexture,
) -> Pin<Box<dyn Future<Output = Result<GpuTexture>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Run a single upscale pass on the given GPU texture, returning the upscaled output.
Source§fn shutdown<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn shutdown<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Flush any pending work, synchronize streams, and release GPU resources.
Source§fn metadata(&self) -> Result<&ModelMetadata>
fn metadata(&self) -> Result<&ModelMetadata>
Return the model metadata extracted during
initialize.Auto Trait Implementations§
impl !Freeze for TensorRtBackend
impl !RefUnwindSafe for TensorRtBackend
impl Send for TensorRtBackend
impl Sync for TensorRtBackend
impl Unpin for TensorRtBackend
impl UnsafeUnpin for TensorRtBackend
impl !UnwindSafe for TensorRtBackend
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more