Skip to main content

GpuLimits

Struct GpuLimits 

Source
pub struct GpuLimits {
    pub max_shared_bytes: usize,
    pub max_cube_count: (u32, u32, u32),
    pub max_units_per_cube: u32,
    pub max_cube_dim: (u32, u32, u32),
    pub max_binding_bytes: u64,
    pub plane_size_min: u32,
    pub plane_size_max: u32,
}
Expand description

Every device limit that dispatch geometry and staging decisions depend on.

Read once per client via GpuLimits::from_client and passed around as data. Fields mirror cubecl’s HardwareProperties and MemoryDeviceProperties.

§Note

The values a backend reports are not uniform. Apple Silicon via wgpu gives 32768 bytes of shared memory, a plane size pinned to 32/32 and a 4 GiB binding limit. Integrated parts report as little as 16384 bytes of shared memory, AMD reports a plane size of 64, and Intel reports a range because the real value depends on register pressure and cannot be queried ahead of time.

Fields§

§max_shared_bytes: usize

Shared memory available to one workgroup, in bytes

§max_cube_count: (u32, u32, u32)

Maximum number of cubes per grid dimension, as (x, y, z)

§max_units_per_cube: u32

Maximum number of units in a single cube

§max_cube_dim: (u32, u32, u32)

Maximum extent of a cube per dimension, as (x, y, z)

§max_binding_bytes: u64

Largest single allocation or binding the device accepts, in bytes

§plane_size_min: u32

Smallest plane size the device may use

§plane_size_max: u32

Largest plane size the device may use

Implementations§

Source§

impl GpuLimits

Source

pub fn from_client<R: Runtime>(client: &ComputeClient<R>) -> Self

Read the limits from a live compute client.

ComputeClient::properties() is a field borrow rather than a device query, so this is cheap enough to call per allocation. It is still worth hoisting where several decisions share the same client.

§Params
  • client - CubeCL compute client for the target device
§Returns

A GpuLimits describing that device.

§Note

The cube-count limit comes from the client properties rather than from Runtime::max_cube_count(). The latter is a per-backend constant: the wgpu implementation returns u16::MAX on every device regardless of what the adapter actually supports, which is a safe floor but discards headroom on hardware that allows more.

Trait Implementations§

Source§

impl Clone for GpuLimits

Source§

fn clone(&self) -> GpuLimits

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 GpuLimits

Source§

impl Debug for GpuLimits

Source§

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

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

impl Eq for GpuLimits

Source§

impl PartialEq for GpuLimits

Source§

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

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<C> CloneExpand for C
where C: Clone,

Source§

fn __expand_clone_method(&self, _scope: &mut Scope) -> C

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

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

Source§

fn comptime(self) -> Self

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> TuneInputs for T
where T: Clone + Send + Sync + 'static,

Source§

type At<'a> = T

The concrete input type at lifetime 'a.