Skip to content

Commit

Permalink
Drop dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
antiagainst committed Jan 14, 2025
1 parent cd6cb33 commit 71b2248
Showing 1 changed file with 0 additions and 33 deletions.
33 changes: 0 additions & 33 deletions third_party/amd/lib/TritonAMDGPUToLLVM/UpcastMXFPToLLVM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,39 +147,6 @@ SmallVector<Value> upcastMxfp4(RewriterBase &rewriter, UpcastMXFPOp upcastOp,
return results;
}

SmallVector<Value> convertMxfp4x2ToFp16x2(RewriterBase &rewriter, Location loc,
ArrayRef<Value> values) {
SmallVector<Value> results;
for (auto v : values) {
auto em0 = and_(v, i8_val(0x7));
auto em1 = and_(v, i8_val(0x70));
// FP16 bits: sign = 1, exponent = 5, mantissa = 10
Value v0 = or_(shl(zext(i16_ty, em0), i16_val(10 - 1)),
shl(zext(i16_ty, and_(v, i8_val(0x8))), i16_val(12)));
Value v1 = or_(shl(zext(i16_ty, em1), i16_val(10 - 1 - 4)),
shl(zext(i16_ty, and_(v, i8_val(0x80))), i16_val(8)));

// Three cases:
// 1) x is normal and non-zero: Correct bias
v0 = select(icmp_ne(and_(em0, i8_val(0x6)), i8_val(0)),
add(v0, i16_val((15 - 1) << 10)), v0);
v1 = select(icmp_ne(and_(em1, i8_val(0x60)), i8_val(0)),
add(v1, i16_val((15 - 1) << 10)), v1);

// 2) x is subnormal (x == 0bs001 where s is the sign): Map to fp16 +-0.5
v0 = bitcast(select(icmp_eq(em0, i8_val(0x1)),
or_(i16_val(0x3800), and_(v0, i16_val(0x8000))), v0),
f16_ty);
v1 = bitcast(select(icmp_eq(em1, i8_val(0x10)),
or_(i16_val(0x3800), and_(v1, i16_val(0x8000))), v1),
f16_ty);
// 3) x is zero, nothing to do
results.push_back(v0);
results.push_back(v1);
}
return results;
}

Value mxfpScaleFp16(RewriterBase &rewriter, Location loc, Value v, Value scale,
bool fastMath) {
Value scaleF32 = bitcast(shl(zext(i32_ty, scale), i32_val(23)), f32_ty);
Expand Down

0 comments on commit 71b2248

Please sign in to comment.