pub struct OccupancyModel {
pub compute_units: u32,
pub max_warps_per_cu: u32,
pub warp_size: u32,
pub shared_mem_per_cu: u32,
pub registers_per_cu: u32,
}Expand description
GPU occupancy model (simplified).
Models occupancy as the ratio of active warps to maximum concurrent warps.
Fields§
§compute_units: u32Total number of compute units (SMs / CUs).
max_warps_per_cu: u32Maximum warps per compute unit.
warp_size: u32Warp size (threads per warp, typically 32 for NVIDIA or 64 for AMD).
Shared memory per compute unit (bytes).
registers_per_cu: u32Registers per compute unit.
Implementations§
Source§impl OccupancyModel
impl OccupancyModel
Sourcepub fn estimate_occupancy(
&self,
workgroup_size: u32,
shared_mem_bytes: u32,
registers_per_thread: u32,
) -> f64
pub fn estimate_occupancy( &self, workgroup_size: u32, shared_mem_bytes: u32, registers_per_thread: u32, ) -> f64
Estimate the theoretical occupancy (0.0–1.0) for a kernel.
Occupancy is limited by:
- Workgroup size (must not exceed warp_size * max_warps_per_cu).
- Shared memory usage.
- Register usage.
Sourcepub fn peak_gflops(&self, clock_mhz: f64) -> f64
pub fn peak_gflops(&self, clock_mhz: f64) -> f64
Total theoretical peak throughput in GFLOP/s (mock model).
Assumes 2 FP32 ops per clock per SIMD unit.
Trait Implementations§
Source§impl Clone for OccupancyModel
impl Clone for OccupancyModel
Source§fn clone(&self) -> OccupancyModel
fn clone(&self) -> OccupancyModel
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for OccupancyModel
impl RefUnwindSafe for OccupancyModel
impl Send for OccupancyModel
impl Sync for OccupancyModel
impl Unpin for OccupancyModel
impl UnsafeUnpin for OccupancyModel
impl UnwindSafe for OccupancyModel
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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 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>
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