Skip to main content

LibraryKernel

Struct LibraryKernel 

Source
pub struct LibraryKernel<'a> { /* private fields */ }

Implementations§

Source§

impl LibraryKernel<'_>

Source

pub fn name(&self) -> Result<String>

Source

pub fn function(&self) -> Result<DeviceFunction>

Returns the device function handle for this kernel and the current context. If the handle is not found, the call returns crate::error::Status::NotFound.

§Errors

Returns an error if the CUDA context cannot be bound, if CUDA Driver cannot find the function, or if it returns a null handle.

Source

pub unsafe fn add_to_graph<'a, P>( &self, graph: &mut Graph, dependencies: &[GraphNode], config: &LaunchConfig, params: P, ) -> Result<GraphNode>
where P: KernelLaunchArgs<'a>,

Adds this kernel to graph as a kernel node.

§Safety

The caller must ensure every pointer value passed through params remains valid for every graph instantiation, update, and launch that can execute the created node. Mutable pointer arguments must remain exclusive for the work ordered by those launches.

Source

pub unsafe fn set_graph_node_params<'a, P>( &self, executable: &mut ExecutableGraph, node: GraphNode, config: &LaunchConfig, params: P, ) -> Result<()>
where P: KernelLaunchArgs<'a>,

Updates this kernel’s parameters in an executable graph node.

§Safety

The caller must ensure every pointer value passed through params remains valid for every future launch that can execute node. Mutable pointer arguments must remain exclusive for the work ordered by those launches.

Source

pub fn attribute(&self, attribute: FunctionAttribute) -> Result<i32>

Source

pub fn set_attribute( &self, attribute: FunctionAttribute, value: i32, ) -> Result<()>

Source

pub fn set_cache_config(&self, config: FunctionCache) -> Result<()>

Sets the preferred cache configuration for this kernel on devices where L1 cache and shared memory use the same hardware resources. This setting is only a preference. The driver uses the requested configuration if possible, but it may choose a different configuration if required to execute the kernel. This per-kernel setting overrides any context-wide preference set via sys::cuCtxSetCacheConfig.

Attributes set using sys::cuFuncSetCacheConfig override this preference regardless of call order.

This setting does nothing on devices where the size of the L1 cache and shared memory are fixed.

Launching a kernel with a different preference than the most recent preference setting may insert a device-side synchronization point.

The supported cache configurations are:

This has stricter locking requirements than its legacy counterpart sys::cuFuncSetCacheConfig because the setting has device-wide semantics. If multiple threads try to set a configuration on the same device simultaneously, the final cache configuration depends on OS scheduler interleaving and memory consistency.

§Errors

Returns an error if the CUDA context cannot be bound or if CUDA Driver rejects the cache configuration.

Source

pub fn param_info(&self, index: usize) -> Result<KernelParamInfo>

Queries the kernel parameter at the given index, returning the offset and size where the parameter resides in the device-side parameter layout. Use this information to update kernel node parameters from the device. The index must be less than the number of parameters that the kernel takes.

§Errors

Returns an error if the library context cannot be bound, index is not a valid kernel parameter index, CUDA cannot query the parameter layout, or a previous asynchronous launch reported an error.

Source

pub const fn as_raw(&self) -> CUkernel

Trait Implementations§

Source§

impl<'a> Clone for LibraryKernel<'a>

Source§

fn clone(&self) -> LibraryKernel<'a>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Copy for LibraryKernel<'a>

Source§

impl<'a> Debug for LibraryKernel<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> !Send for LibraryKernel<'a>

§

impl<'a> !Sync for LibraryKernel<'a>

§

impl<'a> Freeze for LibraryKernel<'a>

§

impl<'a> RefUnwindSafe for LibraryKernel<'a>

§

impl<'a> Unpin for LibraryKernel<'a>

§

impl<'a> UnsafeUnpin for LibraryKernel<'a>

§

impl<'a> UnwindSafe for LibraryKernel<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.