Skip to content

Commit

Permalink
Fix const cast identifier for cpp (#400)
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanielsimard authored Jan 8, 2025
1 parent 29f5735 commit 6c60851
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion crates/cubecl-cpp/src/shared/instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -450,8 +450,10 @@ for ({i_ty} {i} = {start}; {i} {cmp} {end}; {increment}) {{
Instruction::Fma { a, b, c, out } => Fma::format(f, a, b, c, out),
Instruction::Wmma(it) => write!(f, "{it}"),
Instruction::Bitcast(UnaryInstruction { input, out }) => {
let qualifier = out.const_qualifier();
let out_elem = out.elem();
let out = out.fmt_left();

match (input.elem(), out_elem) {
(Elem::F32, Elem::I32) => {
writeln!(f, "{out} = __float_as_int({input});")
Expand Down Expand Up @@ -490,7 +492,7 @@ for ({i_ty} {i} = {start}; {i} {cmp} {end}; {increment}) {{
writeln!(f, "{out} = __ushort_as_bfloat16({input});")
}
(Elem::I32, Elem::U32) => {
writeln!(f, "{out} = reinterpret_cast<uint&>({input});")
writeln!(f, "{out} = reinterpret_cast<uint{qualifier}&>({input});")
}
elem => panic!("Unsupported type for bitcasting {elem:?}"),
}
Expand Down

0 comments on commit 6c60851

Please sign in to comment.