cubecl_ir/types/
barrier.rs1use cubecl_macros_internal::TypeHash;
2use derive_more::Deref;
3use pliron::{
4 derive::{format, pliron_type},
5 r#type::TypedHandle,
6};
7
8use crate::{aligned, sized};
9
10#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
11#[derive(Debug, Clone, TypeHash, PartialEq, Eq, Hash, Copy, PartialOrd, Ord)]
12#[format]
13pub enum BarrierLevel {
14 Unit,
15 Cube,
16}
17
18#[allow(missing_docs)]
19#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
20#[pliron_type(
21 name = "cube.barrier",
22 format = "`barrier<` $0 `>`",
23 generate_get = true,
24 verifier = "succ"
25)]
26pub struct BarrierType(pub BarrierLevel);
27aligned!(BarrierType, align_of::<u64>());
28sized!(BarrierType, size_of::<u64>());
29
30#[allow(missing_docs)]
31#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Deref)]
32#[pliron_type(
33 name = "cube.barrier_token",
34 format = "`barrier_token<` $0 `>`",
35 generate_get = true,
36 verifier = "succ"
37)]
38pub struct BarrierTokenType(pub TypedHandle<BarrierType>);
39aligned!(BarrierTokenType, align_of::<u64>());
40sized!(BarrierTokenType, size_of::<u64>());