pub struct KernelEnvelope { /* private fields */ }Expand description
Builder/configuration for a single run_kernel invocation.
Existing actors that call the free run_kernel function are
unaffected — that path still constructs a default envelope
internally. Actors that want observability migrate to
KernelEnvelope::new(lib).with_trace(..).with_nvtx(..).run_kernel(..).
Implementations§
Source§impl KernelEnvelope
impl KernelEnvelope
Sourcepub fn new(lib_tag: &'static str) -> Self
pub fn new(lib_tag: &'static str) -> Self
Construct a trace-less, NVTX-less envelope tagged with the
given library. op_name defaults to lib_tag and can be
refined via Self::with_op_name.
Sourcepub fn with_op_name(self, op_name: &'static str) -> Self
pub fn with_op_name(self, op_name: &'static str) -> Self
Override the op identifier surfaced to the trace callback (e.g.
"sgemm", "conv2d_forward").
Sourcepub fn with_dtype(self, dtype: &'static str) -> Self
pub fn with_dtype(self, dtype: &'static str) -> Self
Tag the envelope with a dtype name (e.g. "f32", "f16").
Surfaced to trace callbacks as KernelInfo::dtype.
Sourcepub fn with_trace(self, trace: Arc<dyn KernelTrace>) -> Self
pub fn with_trace(self, trace: Arc<dyn KernelTrace>) -> Self
Attach a KernelTrace callback. Cloning Arc<dyn KernelTrace>
is cheap; the same object can be shared across many envelopes.
Sourcepub fn with_nvtx(self, name: &'static str) -> Self
pub fn with_nvtx(self, name: &'static str) -> Self
Attach an NVTX range label. No-op unless the nvtx cargo
feature is enabled.
Sourcepub fn run_kernel<O, KA, F>(
self,
stream: &Arc<CudaStream>,
completion: &Arc<dyn CompletionStrategy>,
output: O,
reply: Sender<Result<O, GpuError>>,
enqueue: F,
)
pub fn run_kernel<O, KA, F>( self, stream: &Arc<CudaStream>, completion: &Arc<dyn CompletionStrategy>, output: O, reply: Sender<Result<O, GpuError>>, enqueue: F, )
Builder-style equivalent of the free run_kernel function
with observability hooks layered in.
Behaviour without a trace and without an NVTX range is
byte-for-byte identical to run_kernel.
Trait Implementations§
Source§impl Clone for KernelEnvelope
impl Clone for KernelEnvelope
Source§fn clone(&self) -> KernelEnvelope
fn clone(&self) -> KernelEnvelope
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more