mirror of
https://github.com/tile-ai/tilelang.git
synced 2026-10-20 06:30:07 +08:00
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.