Skip to main content

FunctionAttribute

Enum FunctionAttribute 

Source
#[non_exhaustive]
#[repr(u32)]
pub enum FunctionAttribute {
Show 17 variants SharedMemoryMode = 17, MaxThreadsPerBlock = 0, SharedSizeBytes = 1, ConstSizeBytes = 2, LocalSizeBytes = 3, NumRegs = 4, PtxVersion = 5, BinaryVersion = 6, CacheModeCa = 7, MaxDynamicSharedSizeBytes = 8, PreferredSharedMemoryCarveout = 9, ClusterSizeMustBeSet = 10, RequiredClusterWidth = 11, RequiredClusterHeight = 12, RequiredClusterDepth = 13, NonPortableClusterSizeAllowed = 14, ClusterSchedulingPolicyPreference = 15,
}
Expand description

Attribute of a compiled kernel function, queried or set per function.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

SharedMemoryMode = 17

The shared memory mode of a function, as a SharedMemoryMode.

§

MaxThreadsPerBlock = 0

The maximum number of threads per block, beyond which a launch of the function would fail.

This number depends on both the function and the device on which the function is currently loaded.

§

SharedSizeBytes = 1

The size in bytes of statically-allocated shared memory required by this function.

This does not include dynamically-allocated shared memory requested by the user at runtime.

§

ConstSizeBytes = 2

The size in bytes of user-allocated constant memory required by this function.

§

LocalSizeBytes = 3

The size in bytes of local memory used by each thread of this function.

§

NumRegs = 4

The number of registers used by each thread of this function.

§

PtxVersion = 5

The PTX virtual architecture version for which the function was compiled.

This value is the major PTX version times 10 plus the minor PTX version, so a PTX version 1.3 function returns 13. Cubins compiled before CUDA 3.0 may report the undefined value 0.

§

BinaryVersion = 6

The binary architecture version for which the function was compiled.

This value is the major binary version times 10 plus the minor binary version, so a binary version 1.3 function returns 13. Legacy cubins without a properly encoded binary architecture version report 10.

§

CacheModeCa = 7

Whether the function was compiled with the -Xptxas --dlcm=ca option.

§

MaxDynamicSharedSizeBytes = 8

The maximum size in bytes of dynamically-allocated shared memory that can be used by this function.

If the user-specified dynamic shared memory size is larger than this value, the launch will fail.

The default is DeviceAttribute::MaxSharedMemoryPerBlock minus Self::SharedSizeBytes, or 0 when the static size exceeds that maximum. It can be raised to DeviceAttribute::MaxSharedMemoryPerBlockOptin minus Self::SharedSizeBytes.

This attribute is ignored if the function or launch sets a shared memory mode, such as Self::SharedMemoryMode.

This attribute cannot be used to access oversized shared memory, which only a shared memory mode enables.

§

PreferredSharedMemoryCarveout = 9

On devices where the L1 cache and shared memory use the same hardware resources, this sets the shared memory carveout preference, in percent of the total shared memory.

The total is DeviceAttribute::MaxSharedMemoryPerMultiprocessor. This is only a hint, and the driver can choose a different ratio if required to execute the function.

§

ClusterSizeMustBeSet = 10

If this attribute is set, the kernel must launch with a valid cluster size specified.

§

RequiredClusterWidth = 11

The required cluster width in blocks.

The values must either all be 0 or all be positive. The validity of the cluster dimensions is otherwise checked at launch time.

If the value is set during compile time, it cannot be set at runtime. Setting it at runtime returns Status::NotPermitted.

§

RequiredClusterHeight = 12

The required cluster height in blocks.

The values must either all be 0 or all be positive. The validity of the cluster dimensions is otherwise checked at launch time.

If the value is set during compile time, it cannot be set at runtime. Setting it at runtime returns Status::NotPermitted.

§

RequiredClusterDepth = 13

The required cluster depth in blocks.

The values must either all be 0 or all be positive. The validity of the cluster dimensions is otherwise checked at launch time.

If the value is set during compile time, it cannot be set at runtime. Setting it at runtime returns Status::NotPermitted.

§

NonPortableClusterSizeAllowed = 14

Whether the function can be launched with non-portable cluster size.

1 is allowed, 0 is disallowed. A non-portable cluster size may only function on the specific SKUs the program is tested on. The launch might fail if the program is run on a different hardware platform.

An occupancy query for the maximum active clusters checks whether a size can launch on the current device.

A portable cluster size is guaranteed to be functional on all compute capabilities higher than the target compute capability. The portable cluster size for sm_90 is 8 blocks per cluster. This value may increase for future compute capabilities.

The specific hardware unit may support higher cluster sizes that are not guaranteed to be portable.

§

ClusterSchedulingPolicyPreference = 15

The block scheduling policy of a function, as a ClusterSchedulingPolicy.

Trait Implementations§

Source§

impl Clone for FunctionAttribute

Source§

fn clone(&self) -> Self

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 Copy for FunctionAttribute

Source§

impl Debug for FunctionAttribute

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Display for FunctionAttribute

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for FunctionAttribute

Source§

impl From<FunctionAttribute> for u32

Source§

fn from(enum_value: FunctionAttribute) -> Self

Converts to this type from the input type.
Source§

impl From<FunctionAttribute> for CUfunction_attribute

Source§

fn from(value: FunctionAttribute) -> Self

Converts to this type from the input type.
Source§

impl Hash for FunctionAttribute

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for FunctionAttribute

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for FunctionAttribute

Source§

impl TryFrom<CUfunction_attribute_enum> for FunctionAttribute

Source§

type Error = UnknownEnumValue

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

fn try_from(value: CUfunction_attribute) -> Result<Self, UnknownEnumValue>

Performs the conversion.
Source§

impl TryFrom<u32> for FunctionAttribute

Source§

type Error = TryFromPrimitiveError<FunctionAttribute>

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

fn try_from(number: u32) -> Result<Self, TryFromPrimitiveError<Self>>

Performs the conversion.
Source§

impl TryFromPrimitive for FunctionAttribute

Auto Trait Implementations§

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.