[CI][Bugfix] Relax packed_qk_rope_ correctness test to one ULP (#59008)

Signed-off-by: Stefan Koncarevic <stefan.koncarevic@amd.com>
Co-authored-by: Andreas Karatzas <akaratza@amd.com>
This commit is contained in:
stefankoncarevic
2026-09-28 17:29:59 +00:00
committed by GitHub
co-authored by Andreas Karatzas
parent c01368fd64
commit 6c300ddb9e
2 changed files with 22 additions and 7 deletions
@@ -46,8 +46,10 @@ def packed_qk_rope_(xqkv: torch.Tensor, freqs_cis: torch.Tensor) -> None:
freqs_cis: contiguous (seqlen, headdim // 2) complex64 rotary freqs,
read through its interleaved re/im fp32 view.
Bitwise identical to ``ApplyRotaryEmb(enable_fp32_compute=True)`` applied
to Q and K separately, but in one kernel with ~5x less memory traffic.
Matches ``ApplyRotaryEmb(enable_fp32_compute=True)`` applied to Q and K
separately to within one ULP, but in one kernel with ~5x less memory
traffic. Both compute in fp32; the gap is which product the compiler
keeps exact inside the fused multiply-add, which differs per backend.
Requires triton: callers must check HAS_TRITON and use the unfused path
otherwise. Contract violations raise.