Skip to main content

Config

Struct Config 

Source
pub struct Config { /* private fields */ }
Expand description

One point in a kernel’s configuration space: a total assignment of every declared dimension. Dimensions are kept sorted by name, which is what makes the canonical ID canonical.

Implementations§

Source§

impl Config

Source

pub fn kernel(&self) -> &str

The kernel this configuration belongs to.

Source

pub fn get(&self, dim: &str) -> Option<&Value>

The value assigned to one dimension, or None if the spec does not declare it.

Source

pub fn values(&self) -> impl Iterator<Item = (&str, &Value)>

Every (dimension, value) pair, ascending by dimension name.

The order is the sorted order, not the declaration order, and it is what makes Config::id canonical: two configurations that assign the same values hash identically however their spec was written.

Source

pub fn block_threads(&self) -> u64

Total threads per block implied by this configuration. Absent block dimensions default to 1, matching CUDA launch semantics.

Saturating, like grid_blocks in launchbound-model, and for the same reason: the factors come from kernel.toml, and .product() over three attacker-shaped u64s panics in a debug build and wraps in a release one — where a wrapped value would then flow into estimate and into the gate’s threads > WARP_SIZE test and be believed.

A valid spec cannot reach the saturation point: KernelSpec rejects a block dimension above the CUDA per-axis limit at load, so the largest product this can be asked for is 1024 x 1024 x 64. The saturation is the floor under a Config built by some other route.

Source

pub fn id(&self) -> ConfigId

The canonical, stable ID: a versioned SHA-256 over the kernel name and the sorted dimension assignments. Changing the encoding is a breaking change and must bump the config.v1 tag.

Source

pub fn spec_key(&self, spec: &KernelSpec) -> String

Only the compile-time specialization dimensions, sorted. Candidates sharing this key share generated source, and therefore share one reconverge verdict and one compiled artifact.

Trait Implementations§

Source§

impl Clone for Config

Source§

fn clone(&self) -> Config

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 Debug for Config

Source§

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

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

impl Display for Config

Source§

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

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

impl Eq for Config

Source§

impl PartialEq for Config

Source§

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

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

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

Source§

type Output = T

Should always be Self
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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.