Repository navigation
RoPE: 64-bit cos / sin row offsets for tables past 2**31 elements - #14714
Conversation
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
[skip ci]
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]
|
@codex review |
|
Codex Review: Didn't find any major issues. Breezy! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. You're on a roll. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
What
The RoPE kernel loads
cos + rot_position * cos_row_stridewith an int32 position. For a cos / sin table with more than 2**31 elements (16.8M positions at head_dim 128, 4.2M at head_dim 512) the product wraps negative and the load reads before the table. #14599 routes single-token decode through this kernel, so decode at those positions now hits it; the training path with explicit position ids already could.This PR adds
cosandsinto the tensorslong_indexingchecks and widens the position to int64 whenLONG_INDEXINGis set.LONG_INDEXINGis a constexpr, so every table below 2**31 elements compiles the exact same kernel as before.Evidence (B200, fp16, head_dim 128)
No shipped model decodes that far today, so this is a bound fix, not a hot path change.
Tests
tests/test_decode_fused_rope.py: a meta-tensor check that a table past int32 offsets takes 64-bit indexing, and a GPU test (markedgpu, skips without about 9 GiB free) that decodes at position 2**31 / 128 + 3 against a reference. The GPU test crashes on main and passes here.