cubecl_cpp/shared/
body.rs1use crate::shared::Item;
2
3use super::{Dialect, Instruction, barrier::BarrierOps};
4use std::fmt::Display;
5
6#[derive(Debug, Clone)]
8pub struct Body<D: Dialect> {
9 pub instructions: Vec<Instruction<D>>,
10 pub shared_memories: Vec<super::SharedMemory<D>>,
11 pub barriers: Vec<BarrierOps<D>>,
12 pub info_by_ptr: bool,
13 pub has_dynamic_meta: bool,
14 pub address_type: Item<D>,
15}
16
17impl<D: Dialect> Display for Body<D> {
18 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
19 D::compile_bindings_body(f, self)?;
20
21 for shared in &self.shared_memories {
22 D::compile_shared_memory_declaration(f, shared)?;
23 }
24
25 for barrier in self.barriers.iter() {
26 writeln!(f, "{barrier}")?;
27 }
28
29 D::compile_wmma_local_variables(f)?;
30
31 for ops in self.instructions.iter() {
32 write!(f, "{ops}")?;
33 }
34
35 Ok(())
36 }
37}