Skip to content

Commit 1bbf139

Browse files
cleaned up debug codes
Signed-off-by: cliu-us <[email protected]>
1 parent 5283323 commit 1bbf139

File tree

1 file changed

+0
-23
lines changed

1 file changed

+0
-23
lines changed

fms_mo/custom_ext_kernels/triton_kernels.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -465,29 +465,6 @@ def round_and_trun(x, round_bit, trun_mask, clamp_acc_to_dl16):
465465
return x
466466

467467

468-
# @triton.jit
469-
# def fp32_clamp_to_dl16(x):
470-
# """clamp FP32 (1-8-23) TENSOR x to DL16 (1-6-9) range."""
471-
# # 1. rounding: add round bit, zero out last 13 bits, back to float
472-
# x = libdevice.float_as_uint(x)
473-
# round_bit = 1 << (23 - 9 - 1)
474-
# mask_13x0 = ~tl.cast((1 << 13) - 1, tl.uint32)
475-
# x = libdevice.uint_as_float((x + round_bit) & mask_13x0)
476-
477-
# # 2. clamp to min/max:
478-
# # max = 2^32 * 1.(1111 1111 0)_base2 => 2^32*1.(1111 1111 1) will become inf
479-
# # (32 + 127) << 23 | (0xFF8 << (23 - 12)) in FP32 is 8581545984.0
480-
# # min = 2^-31 * 1.(0000 0000 1)_base2 => set to 0 for those smaller than this
481-
# # (-31 + 127) << 23 | (1 << (23 - 9)) in FP32 is 4.665707820095122e-10
482-
# dl16_max = 8581545984.0
483-
# dl16_min = 4.665707820095122e-10
484-
# x = tl.where(x >= dl16_max, float("inf"), x)
485-
# x = tl.where(x <= -dl16_max, float("-inf"), x)
486-
# x = tl.where(tl.abs(x) < dl16_min, 0, x)
487-
488-
# return x
489-
490-
491468
def tl_matmul_chunk_truncate(
492469
a,
493470
b,

0 commit comments

Comments
 (0)