Files
tilelang/testing/python/math
Ruihan11 c8e402fc93 [BugFix][CUDA] Provide htan overloads for fp16/bf16 tangent (#2894)
T.tan and T.__tan on float16/bfloat16 lower to htan() calls, but CUDA
has no half-precision tangent intrinsic, so the generated kernels failed
to compile with 'identifier htan is undefined'.

Add TL_PATCH device overloads for htan(half_t) and htan(bfloat16_t) in
src/tl_templates/cuda/common.h. Both evaluate via float32 tanf and
convert the result back, matching the existing pattern used for hexp and
other missing 16-bit intrinsics in the same file.

Add test_tan_16bit_compiles_and_runs covering T.tan and T.__tan for
both float16 and bfloat16, asserting the generated source contains
htan() and that numerical results match torch.tan within fp16 tolerance.
2026-08-11 15:22:06 +08:00
..