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
impl CubeContext
sourcepub fn root() -> CubeContext
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
pub fn register<O: Into<Operation>>(&mut self, op: O)
pub fn child(&mut self) -> CubeContext
pub fn into_scope(self) -> Scope
sourcepub fn create_local(&mut self, item: Item) -> ExpandElement
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.
sourcepub fn create_matrix(&mut self, matrix: Matrix) -> ExpandElement
pub fn create_matrix(&mut self, matrix: Matrix) -> ExpandElement
Create a new matrix element.
sourcepub fn create_slice(&mut self, item: Item) -> ExpandElement
pub fn create_slice(&mut self, item: Item) -> ExpandElement
Create a new slice element.
pub fn create_local_array(&mut self, item: Item, size: u32) -> ExpandElement
sourcepub fn input(&mut self, id: u16, item: Item) -> ExpandElement
pub fn input(&mut self, id: u16, item: Item) -> ExpandElement
Obtain the index-th input
sourcepub fn output(&mut self, id: u16, item: Item) -> ExpandElement
pub fn output(&mut self, id: u16, item: Item) -> ExpandElement
Obtain the index-th output
sourcepub fn scalar(&self, id: u16, elem: Elem) -> ExpandElement
pub fn scalar(&self, id: u16, elem: Elem) -> ExpandElement
Obtain the index-th scalar
Auto Trait Implementations§
impl Freeze for CubeContext
impl !RefUnwindSafe for CubeContext
impl !Send for CubeContext
impl !Sync for CubeContext
impl Unpin for CubeContext
impl !UnwindSafe for CubeContext
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