cubecl_core/frontend/element/float/
fp6.rs1use cubecl_common::{e2m3, e3m2};
2use cubecl_ir::{ConstantValue, ElemType, FloatKind, Scope, Type};
3
4use crate::prelude::*;
5
6impl CubeType for e2m3 {
7 type ExpandType = NativeExpand<e2m3>;
8}
9
10impl CubeDebug for e2m3 {}
11impl Scalar for e2m3 {}
12impl CubePrimitive for e2m3 {
13 type Scalar = Self;
14 type Size = Const<1>;
15 type WithScalar<S: Scalar> = S;
16
17 fn as_type_native() -> Option<Type> {
19 Some(ElemType::Float(FloatKind::E2M3).into())
20 }
21
22 fn from_const_value(_value: ConstantValue) -> Self {
23 unimplemented!("e2m3 doesn't yet support conversion");
24 }
25}
26
27impl IntoRuntime for e2m3 {
28 fn __expand_runtime_method(self, _scope: &Scope) -> NativeExpand<Self> {
29 self.into()
30 }
31}
32impl IntoExpand for e2m3 {
33 type Expand = NativeExpand<e2m3>;
34 fn into_expand(self, _scope: &Scope) -> Self::Expand {
35 self.into()
36 }
37}
38
39impl NativeAssign for e2m3 {}
40
41impl CubeType for e3m2 {
42 type ExpandType = NativeExpand<e3m2>;
43}
44
45impl CubeDebug for e3m2 {}
46impl Scalar for e3m2 {}
47impl CubePrimitive for e3m2 {
48 type Scalar = Self;
49 type Size = Const<1>;
50 type WithScalar<S: Scalar> = S;
51
52 fn as_type_native() -> Option<Type> {
54 Some(ElemType::Float(FloatKind::E3M2).into())
55 }
56
57 fn from_const_value(_value: ConstantValue) -> Self {
58 unimplemented!("e3m2 doesn't yet support conversion");
59 }
60}
61
62impl IntoRuntime for e3m2 {
63 fn __expand_runtime_method(self, _scope: &Scope) -> NativeExpand<Self> {
64 self.into()
65 }
66}
67impl IntoExpand for e3m2 {
68 type Expand = NativeExpand<e3m2>;
69 fn into_expand(self, _scope: &Scope) -> Self::Expand {
70 self.into()
71 }
72}
73
74impl NativeAssign for e3m2 {}