Skip to main content

Capabilities

Struct Capabilities 

Source
pub struct Capabilities {
    pub supports_fp16: bool,
    pub supports_bf16: bool,
    pub supports_fp8: bool,
    pub tensor_cores: bool,
    pub peer_access: bool,
    pub unified_memory: bool,
    pub cluster_launch: bool,
    pub async_copy: bool,
    pub max_threads_per_block: u32,
    pub max_shared_mem_per_block: u32,
    pub warp_size: u32,
}
Expand description

Per-backend capability report.

A concrete backend populates this from its driver during ComputeBackend::capabilities. Consumers use it to decide whether a mixed-precision or Tensor-Core path is available before issuing work.

The Default value is the conservative CPU profile: no accelerated precisions, no Tensor Cores, no peer access, but generous thread/shared-memory limits that any host can honour.

Fields§

§supports_fp16: bool

Native FP16 (half precision) compute is available.

§supports_bf16: bool

Native BF16 (bfloat16) compute is available.

§supports_fp8: bool

FP8 (E4M3/E5M2) compute is available.

§tensor_cores: bool

Dedicated matrix/Tensor-Core (WMMA / mma.sync) units are present.

§peer_access: bool

Peer-to-peer access between devices of this backend is possible.

§unified_memory: bool

Unified / managed memory (host and device share an address space).

§cluster_launch: bool

Thread-block clusters (Hopper sm_90+) are supported.

§async_copy: bool

Asynchronous global→shared copy (cp.async, Ampere sm_80+).

§max_threads_per_block: u32

Maximum threads per block / workgroup.

§max_shared_mem_per_block: u32

Maximum shared / local memory per block in bytes.

§warp_size: u32

Warp / wavefront / subgroup width in lanes.

Implementations§

Source§

impl Capabilities

Source

pub const fn cpu() -> Self

Conservative capability profile for a pure-CPU reference backend.

No accelerated precisions or matrix units, but limits large enough that the consumer never rejects a launch for being “too big”.

Source

pub const fn supports_mixed_precision(&self) -> bool

Returns true if any reduced-precision compute path is available.

Source

pub const fn can_use_tensor_cores(&self, m: usize, n: usize, k: usize) -> bool

Returns true if a GEMM of the given shape can plausibly use a Tensor-Core path: matrix units present and all three dimensions are multiples of the smallest standard WMMA tile (16).

Trait Implementations§

Source§

impl Clone for Capabilities

Source§

fn clone(&self) -> Capabilities

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 Capabilities

Source§

impl Debug for Capabilities

Source§

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

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

impl Default for Capabilities

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Display for Capabilities

Source§

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

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

impl Eq for Capabilities

Source§

impl PartialEq for Capabilities

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Capabilities

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