trt-runner 0.1.0

Minimal TensorRT 10 inference runner: deserialize an engine, bind I/O tensors, enqueue V3. No bindings generator, no runtime dependencies.
Documentation
//! Declarations for the C ABI in `csrc/shim.h`. Nothing here is public: every entry point is wrapped
//! by a safe (or explicitly documented `unsafe`) API elsewhere in the crate.

use std::os::raw::c_char;
use std::os::raw::c_void;

extern "C" {
    pub fn trt_last_error() -> *const c_char;

    pub fn trt_version_major() -> i32;
    pub fn trt_version_minor() -> i32;
    pub fn trt_version_patch() -> i32;

    pub fn trt_runtime_create(verbosity: i32) -> *mut c_void;
    pub fn trt_runtime_destroy(runtime: *mut c_void);
    pub fn trt_runtime_deserialize(
        runtime: *mut c_void,
        data: *const c_void,
        size: usize,
    ) -> *mut c_void;

    pub fn trt_engine_destroy(engine: *mut c_void);
    pub fn trt_engine_num_io(engine: *mut c_void) -> i32;
    pub fn trt_engine_io_name(engine: *mut c_void, index: i32) -> *const c_char;
    pub fn trt_engine_io_mode(engine: *mut c_void, name: *const c_char) -> i32;
    pub fn trt_engine_io_dtype(engine: *mut c_void, name: *const c_char) -> i32;
    pub fn trt_engine_io_dims(
        engine: *mut c_void,
        name: *const c_char,
        out: *mut i64,
        capacity: i32,
    ) -> i32;

    pub fn trt_context_create(engine: *mut c_void) -> *mut c_void;
    pub fn trt_context_destroy(context: *mut c_void);
    pub fn trt_context_set_profile(context: *mut c_void, index: i32, stream: *mut c_void) -> i32;
    pub fn trt_context_set_shape(
        context: *mut c_void,
        name: *const c_char,
        dims: *const i64,
        count: i32,
    ) -> i32;
    pub fn trt_context_bind(
        context: *mut c_void,
        name: *const c_char,
        address: *const c_void,
    ) -> i32;
    pub fn trt_context_enqueue(context: *mut c_void, stream: *mut c_void) -> i32;

    pub fn trt_cuda_device_count(out: *mut i32) -> i32;
    pub fn trt_cuda_set_device(device: i32) -> i32;
    pub fn trt_cuda_malloc(out: *mut *mut c_void, bytes: usize) -> i32;
    pub fn trt_cuda_free(ptr: *mut c_void) -> i32;
    pub fn trt_cuda_host_malloc(out: *mut *mut c_void, bytes: usize) -> i32;
    pub fn trt_cuda_host_free(ptr: *mut c_void) -> i32;
    pub fn trt_cuda_stream_create(out: *mut *mut c_void, non_blocking: i32) -> i32;
    pub fn trt_cuda_stream_destroy(stream: *mut c_void) -> i32;
    pub fn trt_cuda_stream_sync(stream: *mut c_void) -> i32;
    pub fn trt_cuda_copy_h2d(
        device: *mut c_void,
        host: *const c_void,
        bytes: usize,
        stream: *mut c_void,
    ) -> i32;
    pub fn trt_cuda_copy_d2h(
        host: *mut c_void,
        device: *const c_void,
        bytes: usize,
        stream: *mut c_void,
    ) -> i32;
    pub fn trt_cuda_zero(device: *mut c_void, bytes: usize, stream: *mut c_void) -> i32;
}