pub struct Function { /* private fields */ }Expand description
A kernel entry point — either inside a Module (classic
Driver API) or materialized from a crate::library::Kernel (CUDA
12.0+ library API). Either way it keeps the parent alive via an Arc
so the kernel stays valid for as long as any Function handle exists.
Implementations§
Source§impl Function
impl Function
Sourcepub fn launch(&self) -> LaunchBuilder<'_>
pub fn launch(&self) -> LaunchBuilder<'_>
Start a kernel-launch builder for this function.
Source§impl Function
impl Function
Sourcepub fn as_raw(&self) -> CUfunction
pub fn as_raw(&self) -> CUfunction
Raw CUfunction. Use with care.
Sourcepub fn module(&self) -> Option<&Module>
pub fn module(&self) -> Option<&Module>
The Module this kernel lives in, if it was obtained through
Module::get_function. Returns None for kernels materialized
from a library::Kernel.
Sourcepub fn get_attribute(&self, attribute: i32) -> Result<i32>
pub fn get_attribute(&self, attribute: i32) -> Result<i32>
Query a kernel attribute (see
baracuda_cuda_sys::types::CUfunction_attribute).
Sourcepub fn param_info(&self, index: usize) -> Result<(usize, usize)>
pub fn param_info(&self, index: usize) -> Result<(usize, usize)>
Return (offset_in_bytes, size_in_bytes) for the index-th
parameter in this function’s ABI signature.
Sourcepub fn module_raw(&self) -> Result<CUmodule>
pub fn module_raw(&self) -> Result<CUmodule>
Return the raw CUmodule this function was loaded from, if any.
Sourcepub fn set_attribute(&self, attribute: i32, value: i32) -> Result<()>
pub fn set_attribute(&self, attribute: i32, value: i32) -> Result<()>
Set a kernel attribute. Only a subset is writable (notably
MAX_DYNAMIC_SHARED_SIZE_BYTES and
PREFERRED_SHARED_MEMORY_CARVEOUT).
Sourcepub fn max_threads_per_block(&self) -> Result<i32>
pub fn max_threads_per_block(&self) -> Result<i32>
Maximum threads per block this kernel supports on the current device.
Size of per-block statically-allocated shared memory (bytes).
Sourcepub fn local_size_bytes(&self) -> Result<i32>
pub fn local_size_bytes(&self) -> Result<i32>
Per-thread local-memory footprint (bytes).
Sourcepub fn ptx_version(&self) -> Result<i32>
pub fn ptx_version(&self) -> Result<i32>
PTX version this kernel was compiled from, as major*10 + minor.
Sourcepub fn binary_version(&self) -> Result<i32>
pub fn binary_version(&self) -> Result<i32>
SM-architecture this kernel was compiled for, as major*10 + minor.