Skip to content

[BUG] ParoQuant bf16 single-rounding fix covers only the Torch reference; the CUDA/HIP fused op and the Triton rotation still round after each Givens stage (incomplete fix of #4221) #4317

Closed

Description

@Qubitium

Severity: low. Status: confirmed by measurement on an RTX 4090 and a Radeon AI PRO R9700. Kind: incomplete fix of #4221 item 1 (c45c1b0).

Where

Repro

  1. Build ParoLinear or ParoQuantTritonLinear with:
    • krot=8;
    • random pairs;
    • theta in ±1 rad;
    • channel_scales in 0.5–1.5;
    • K=2048, N=512;
    • group size 128, -1 or 16.
  2. Take a bf16 input x of shape [256, K].
  3. Compare m._rotate_inputs(x) against an FP64 Givens oracle.
Kernels (CUDA and ROCm) Fixed reference (single rounding)
Rotated-activation rel error 3.6e-3 – 5.6e-3 2.4e-3 – 3.0e-3
Layer output rel error 4.2e-3 – 5.7e-3 2.7e-3 – 3.3e-3

Because of this, the Torch reference used as the test oracle no longer matches what inference actually computes.

Expected: the CUDA/HIP fused op and the Triton rotation accumulate bf16 in FP32 and round once, like the reference.


Found during an AI-assisted review (Claude Code, round 11) of 842d666; repros were run at that commit on RTX 4090/5090 (CUDA 13) and/or Radeon AI PRO R9700 (ROCm) unless marked static/suspected.

Activity

  1. added
    bug
    on Nov 16, 2026
  2. Qubitium commented on Nov 16, 2026

    @Qubitium
    CollaboratorAuthor

    Clarification from a second reviewer: with the original #4221 repro settings, the fused CUDA op, the reference and the vectorized path all sit at the same single-rounding floor (5.06e-3 / 5.10e-3).

    The gap described above shows up with krot=8, non-unit channel_scales (0.5–1.5) and θ in ±1 rad, measured against an FP64 Givens oracle. So the kernels match the reference on the original case, but diverge from it on deeper rotation stacks.

  3. Qubitium commented on Nov 16, 2026

    @Qubitium
    CollaboratorAuthor

    Taking this. I'll investigate against current main, add a targeted regression test, and open a PR. Will report back here if the claim turns out to be invalid or already fixed.

  4. self-assigned this
    on Nov 16, 2026
  5. Qubitium commented on Nov 16, 2026

    @Qubitium
    CollaboratorAuthor

    PR opened: #4365 — fused bf16 rotation now keeps an FP32 shared workspace and narrows once on store. The CUDA/HIP extension cannot be compiled on this host, so the two fused-path tests skip here; static review only for the kernel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions