Struct cubecl_core::frontend::CubeContext

source ·
pub struct CubeContext {
    pub root: Rc<RefCell<Scope>>,
    pub scope: Rc<RefCell<Scope>>,
    pub pool: VariablePool,
}

Fields§

§root: Rc<RefCell<Scope>>§scope: Rc<RefCell<Scope>>§pool: VariablePool

Implementations§

source§

impl CubeContext

source

pub fn root() -> CubeContext

Create a new cube context, with a root scope A root scope is at the root of a compute shader Therefore there is one cube context per shader

source

pub fn register<O: Into<Operation>>(&mut self, op: O)

source

pub fn child(&mut self) -> CubeContext

source

pub fn into_scope(self) -> Scope

source

pub fn create_local(&mut self, item: Item) -> ExpandElement

When a new variable is required, we check if we can reuse an old one Otherwise we create a new one.

source

pub fn create_matrix(&mut self, matrix: Matrix) -> ExpandElement

Create a new matrix element.

source

pub fn create_slice(&mut self, item: Item) -> ExpandElement

Create a new slice element.

source

pub fn create_shared(&mut self, item: Item, size: u32) -> ExpandElement

source

pub fn create_local_array(&mut self, item: Item, size: u32) -> ExpandElement

source

pub fn input(&mut self, id: u16, item: Item) -> ExpandElement

Obtain the index-th input

source

pub fn output(&mut self, id: u16, item: Item) -> ExpandElement

Obtain the index-th output

source

pub fn scalar(&self, id: u16, elem: Elem) -> ExpandElement

Obtain the index-th scalar

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> 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, U> TryFrom<U> for T
where U: Into<T>,

§

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

§

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<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V