perf(mla): use native SATFINITE FP8 conversion in MLA KV/Q preparation (#42659)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Xiaoyu Zhang <1182563586@qq.com>
This commit is contained in:
Chunan Zeng
2026-10-06 22:47:47 +08:00
committed by GitHub
co-authored by Claude Opus 5.5 Xiaoyu Zhang
parent 679d2851ba
commit 49bafb58cd
@@ -325,10 +325,10 @@ struct SetMlaKVConcatQFp8Params {
int32_t qo_stride_1;
};
// 2x bf16 -> 2x fp8 e4m3, float-mediated cvt.rn NOSAT (matches aten: overflow -> NaN).
// Native packed E4M3 conversion: clamp overflow/infinity to +/-448, preserve NaN.
SGL_DEVICE uint16_t bf16x2_to_fp8x2(const bf16x2_t v) {
const float2 f = __bfloat1622float2(v);
return __nv_cvt_float2_to_fp8x2(f, __NV_NOSAT, __NV_E4M3);
return __nv_cvt_float2_to_fp8x2(f, __NV_SATFINITE, __NV_E4M3);
}
// Convert 8 bf16 (one int4 load) to 8 fp8 packed in a uint2.