cubecl_core/frontend/element/float/
fp6.rs1use cubecl_common::{e2m3, e3m2};
2use cubecl_ir::{Elem, ExpandElement, FloatKind, Scope};
3
4use crate::prelude::{
5 CubePrimitive, CubeType, ExpandElementIntoMut, ExpandElementTyped, IntoRuntime,
6 into_mut_expand_element, into_runtime_expand_element,
7};
8
9impl CubeType for e2m3 {
10 type ExpandType = ExpandElementTyped<e2m3>;
11}
12
13impl CubePrimitive for e2m3 {
14 fn as_elem_native() -> Option<Elem> {
16 Some(Elem::Float(FloatKind::E2M3))
17 }
18}
19
20impl IntoRuntime for e2m3 {
21 fn __expand_runtime_method(self, scope: &mut Scope) -> ExpandElementTyped<Self> {
22 let elem: ExpandElementTyped<Self> = self.into();
23 into_runtime_expand_element(scope, elem).into()
24 }
25}
26
27impl ExpandElementIntoMut for e2m3 {
28 fn elem_into_mut(scope: &mut Scope, elem: ExpandElement) -> ExpandElement {
29 into_mut_expand_element(scope, elem)
30 }
31}
32
33impl CubeType for e3m2 {
34 type ExpandType = ExpandElementTyped<e3m2>;
35}
36
37impl CubePrimitive for e3m2 {
38 fn as_elem_native() -> Option<Elem> {
40 Some(Elem::Float(FloatKind::E3M2))
41 }
42}
43
44impl IntoRuntime for e3m2 {
45 fn __expand_runtime_method(self, scope: &mut Scope) -> ExpandElementTyped<Self> {
46 let elem: ExpandElementTyped<Self> = self.into();
47 into_runtime_expand_element(scope, elem).into()
48 }
49}
50
51impl ExpandElementIntoMut for e3m2 {
52 fn elem_into_mut(scope: &mut Scope, elem: ExpandElement) -> ExpandElement {
53 into_mut_expand_element(scope, elem)
54 }
55}