Skip to main content

SmResourceLimits

Struct SmResourceLimits 

Source
pub struct SmResourceLimits {
    pub compute_capability: (u32, u32),
    pub warp_size: u32,
    pub max_threads_per_block: u32,
    pub max_threads_per_sm: u32,
    pub max_warps_per_sm: u32,
    pub max_blocks_per_sm: u32,
    pub registers_per_sm: u32,
    pub register_alloc_granularity: u32,
    pub shared_mem_per_sm_bytes: usize,
}
Expand description

Architectural per-SM resource limits for a streaming multiprocessor.

Instances are normally created with one of the named compute-capability constructors (SmResourceLimits::sm_70SmResourceLimits::sm_90) or derived from a device report via SmResourceLimits::from_compute_capability / SmResourceLimits::from_device_capabilities.

Fields§

§compute_capability: (u32, u32)

CUDA compute capability (major, minor) that this model represents.

§warp_size: u32

Threads per warp (32 on every NVIDIA architecture to date).

§max_threads_per_block: u32

Maximum threads that may be launched in a single thread block.

§max_threads_per_sm: u32

Maximum number of resident threads per SM (max_warps_per_sm * warp_size).

§max_warps_per_sm: u32

Maximum number of resident warps per SM.

§max_blocks_per_sm: u32

Maximum number of resident thread blocks per SM (hard architectural cap).

§registers_per_sm: u32

Number of 32-bit registers in the SM register file.

§register_alloc_granularity: u32

Granularity (in 32-bit registers) at which a block’s register usage is rounded up.

§shared_mem_per_sm_bytes: usize

Bytes of shared memory available per SM.

Implementations§

Source§

impl SmResourceLimits

Source

pub const fn sm_70() -> Self

Volta — compute capability 7.0 (e.g. Tesla V100).

Documented per-SM limits (CUDA C Programming Guide, “Technical Specifications per Compute Capability”):

  • 64 resident warps / 2048 resident threads per SM
  • 32 resident thread blocks per SM
  • 65536 32-bit registers per SM, allocated with 256-register granularity
  • 96 KiB (98304 bytes) of shared memory per SM
  • 1024 threads per block, 32 threads per warp
Source

pub const fn sm_75() -> Self

Turing — compute capability 7.5 (e.g. RTX 2080, T4).

Turing halves the resident warp/thread budget relative to Volta:

  • 32 resident warps / 1024 resident threads per SM
  • 16 resident thread blocks per SM
  • 65536 32-bit registers per SM, 256-register granularity
  • 64 KiB (65536 bytes) of shared memory per SM
  • 1024 threads per block, 32 threads per warp
Source

pub const fn sm_80() -> Self

Ampere A100 — compute capability 8.0 (datacenter GA100).

  • 64 resident warps / 2048 resident threads per SM
  • 32 resident thread blocks per SM
  • 65536 32-bit registers per SM, 256-register granularity
  • 164 KiB (167936 bytes) of shared memory per SM (opt-in maximum)
  • 1024 threads per block, 32 threads per warp
Source

pub const fn sm_86() -> Self

Ampere GA10x — compute capability 8.6 (consumer Ampere, e.g. RTX 3080).

GA10x lowers the resident block/warp budget relative to A100:

  • 48 resident warps / 1536 resident threads per SM
  • 16 resident thread blocks per SM
  • 65536 32-bit registers per SM, 256-register granularity
  • 100 KiB (102400 bytes) of shared memory per SM (opt-in maximum)
  • 1024 threads per block, 32 threads per warp
Source

pub const fn sm_90() -> Self

Hopper — compute capability 9.0 (datacenter H100/GH100).

  • 64 resident warps / 2048 resident threads per SM
  • 32 resident thread blocks per SM
  • 65536 32-bit registers per SM, 256-register granularity
  • 228 KiB (233472 bytes) of shared memory per SM (opt-in maximum)
  • 1024 threads per block, 32 threads per warp
Source

pub fn from_compute_capability( compute_capability: (u32, u32), ) -> Result<Self, GpuOptimError>

Build limits from a CUDA compute capability (major, minor).

Exact matches map to the corresponding constructor. Capabilities that belong to a known architecture family but are not modelled individually are mapped to the nearest modelled architecture (documented below). Any other capability — including the (0, 0) reported by non-CUDA devices — yields an honest GpuOptimError::UnsupportedOperation rather than a fabricated guess.

Nearest-architecture mappings:

Source

pub fn from_device_capabilities( capabilities: &DeviceCapabilities, ) -> Result<Self, GpuOptimError>

Derive limits from a crate::backends::DeviceCapabilities report.

All per-SM architectural constants are taken from the model keyed on the device’s compute_capability; the per-block thread cap is overridden with the device-reported max_threads_per_block when that value is non-zero. Non-CUDA devices (which report a (0, 0) capability) produce an error, because the SM occupancy model does not apply to them.

Trait Implementations§

Source§

impl Clone for SmResourceLimits

Source§

fn clone(&self) -> SmResourceLimits

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 SmResourceLimits

Source§

impl Debug for SmResourceLimits

Source§

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

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

impl Eq for SmResourceLimits

Source§

impl PartialEq for SmResourceLimits

Source§

fn eq(&self, other: &SmResourceLimits) -> 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 SmResourceLimits

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<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

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<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

Checks if this value is equivalent to the given key. 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,