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_70 … SmResourceLimits::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: u32Threads per warp (32 on every NVIDIA architecture to date).
max_threads_per_block: u32Maximum threads that may be launched in a single thread block.
max_threads_per_sm: u32Maximum number of resident threads per SM (max_warps_per_sm * warp_size).
max_warps_per_sm: u32Maximum number of resident warps per SM.
max_blocks_per_sm: u32Maximum number of resident thread blocks per SM (hard architectural cap).
registers_per_sm: u32Number of 32-bit registers in the SM register file.
register_alloc_granularity: u32Granularity (in 32-bit registers) at which a block’s register usage is rounded up.
Bytes of shared memory available per SM.
Implementations§
Source§impl SmResourceLimits
impl SmResourceLimits
Sourcepub const fn sm_70() -> Self
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
Sourcepub const fn sm_75() -> Self
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
Sourcepub const fn sm_80() -> Self
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
Sourcepub const fn sm_86() -> Self
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
Sourcepub const fn sm_90() -> Self
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
Sourcepub fn from_compute_capability(
compute_capability: (u32, u32),
) -> Result<Self, GpuOptimError>
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:
7.2(Volta Xavier) →Self::sm_708.7(Ampere Orin) →Self::sm_868.9(Ada Lovelace) →Self::sm_86(closest documented per-SM budget)
Sourcepub fn from_device_capabilities(
capabilities: &DeviceCapabilities,
) -> Result<Self, GpuOptimError>
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
impl Clone for SmResourceLimits
Source§fn clone(&self) -> SmResourceLimits
fn clone(&self) -> SmResourceLimits
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for SmResourceLimits
Source§impl Debug for SmResourceLimits
impl Debug for SmResourceLimits
impl Eq for SmResourceLimits
Source§impl PartialEq for SmResourceLimits
impl PartialEq for SmResourceLimits
impl StructuralPartialEq for SmResourceLimits
Auto Trait Implementations§
impl Freeze for SmResourceLimits
impl RefUnwindSafe for SmResourceLimits
impl Send for SmResourceLimits
impl Sync for SmResourceLimits
impl Unpin for SmResourceLimits
impl UnsafeUnpin for SmResourceLimits
impl UnwindSafe for SmResourceLimits
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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