Module registry

Module registry 

Source
Expand description

Global kernel registry — load PTX once, cache modules/functions/streams.

Eliminates ~0.06-0.26ms overhead per kernel call from:

  • CudaContext::new (driver init)
  • CudaContext::load_module (PTX JIT compilation)
  • CudaContext::new_stream (stream creation)
  • cuModuleGetFunction (function lookup) — now cached after first call

Usage: let reg = AtlasRegistry::get_or_init(ordinal, &[(“gemm”, PTX_SRC), …])?; let func = reg.function(“gemm”, “dense_gemm_tc_bf16”)?; unsafe { reg.stream.launch_builder(&func).arg(&ptr).launch(cfg)?; } reg.stream.synchronize()?;

Re-exports§

pub use crate::cuda_host::CudaHost;
pub use crate::cuda_host::host;
pub use crate::cuda_host::release;

Structs§

AtlasRegistry
The PTX/CUBIN modules for one loaded model.
RawCudaFunc
Wrapper for raw CUfunction handle (Send+Sync safe — handles are context-wide).

Constants§

CUDA_ERROR_DEINITIALIZED
CUDA_ERROR_DEINITIALIZED. The driver tears the primary context down in its own atexit handler, which can run before our Drop impls do. Every module unload and every host free then reports this code.

Functions§

cuda_error_text
Resolve a CUresult status code into "<NAME>: <description>" via cuGetErrorName + cuGetErrorString. Returns “CUDA_UNKNOWN” / “(no message)” if the driver doesn’t recognize the code.
is_teardown_noop
Whether a CUresult means “the context is already gone, nothing to do”.