Skip to content

Two-GPU decode RoPE test: check the copy bitwise and the rounding at 2 ulp - #14752

Merged
danielhanchen merged 2 commits into
mainfrom
decode-rope-two-gpu-test-tolerance
Oct 22, 2026
Merged

danielhanchen merged 2 commits into
mainfrom
decode-rope-two-gpu-test-tolerance

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Follow-up to #14611. test_decode_rope_on_another_device_orders_with_the_copy compared the fused decode RoPE output with the unfused ops at atol = 0.05. The fused kernel rounds once and the unfused ops round several times, so valid bf16 results differ by one ulp, which is 0.0625 for |x| >= 8. With the test's 3 * randn inputs that happens on most seeds, so the test fails on a two-GPU runner without anything being wrong.

Change

  • The copy is compared bitwise with the same kernel run on the same inputs with its own device current. That is the property the test exists for: a copy racing the rotation would see unrotated values, which a bitwise check catches and a 0.05 tolerance could hide.
  • Fused vs unfused uses the 2 ulp bound already used by test_decode_rope_inplace_matches_unfused in the same file.

Validation

  • Single-GPU stand-in of the same comparison over 200 seeds (400 tensors): max fused vs unfused difference 0.0625, the old atol = 0.05 check fails 367 of 400, the 2 ulp bound holds on all 400, and the fused kernel is bitwise deterministic run to run.
  • Not run as written: the test needs two GPUs in one process and still skips on single-GPU runners.

The copy-ordering test compared fused output to the unfused ops at atol 0.05,
but fused rounds once and unfused several times, so valid bf16 results differ
by 0.0625 at |x| >= 8. Compare the copy bitwise to the same kernel run with its
own device current, and fused vs unfused at the 2 ulp bound used elsewhere.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-10-22T16:07:00.595597Z b58e082 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@danielhanchen
danielhanchen merged commit 6394a86 into main Oct 22, 2026
@danielhanchen
danielhanchen deleted the decode-rope-two-gpu-test-tolerance branch October 22, 2026 19:23
danielhanchen added a commit that referenced this pull request Oct 23, 2026
Conflict in tests/test_decode_fused_rope.py: main (#14752) replaced the
atol = 0.05 asserts in test_decode_rope_on_another_device_orders_with_the_copy
with a bitwise check against a same-device rotation plus a 2 ulp bound vs
the unfused ops. Kept main's assertions verbatim and appended this branch's
two new tests (64-bit indexing selection on meta tensors, and the decode
RoPE reference check past int32 cache offsets) after that test.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant