[PR #280] [CLOSED] RoPE: every kernel reads the session's float64 angle table #2546

Closed
opened 2026-11-04 02:01:12 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/280
Author: @sergqwer
Created: 9/30/2026
Status: ❌ Closed

Base: main ← Head: pr/rope-f64


📝 Commits (1)

  • bfaae8d RoPE: every kernel reads the session's float64 angle table

📊 Changes

5 files changed (+78 additions, -26 deletions)

View changed files

📝 include/strata/kernels/mrope.hpp (+35 -0)
📝 src/core/layer.cpp (+3 -0)
📝 src/kernels/cuda/native_qsa_indexer.cu (+14 -15)
📝 src/kernels/cuda/native_rope.cu (+20 -6)
📝 src/prefill/kernels.cu (+6 -5)

📄 Description

Summary

Three RoPE implementations disagreed:

  • the native decode/verify rope and the indexer's pooled keys computed pos * powf(...) with cosf/sinf under
    --use_fast_math: 0.0014 rad off at 32K, ~0.02 at 262K;
  • the prompt path used precise float libm;
  • the float64 angle table the session builds was read only by the non-native path.

rope_table_set now registers that table per device (mrope.hpp), and every kernel reads it through rope_cs, or
computes in float64 past its end. A position then has the same angle on every path.

Measured

Measured on current main (0.1.29, d6708a4) with ISTA-DASLab's IQ2_XS, RTX 5090 32 GB, Ryzen 9 9950X3D, 128 GB DDR5, Windows 11. KL is first-token KL divergence (STRATA_DUMP_FIRST_LOGITS, #276); two runs of main itself differ by 0 on 5 of 6 short prompts and by 0.00013 on the sixth.

prompt KL, old angles vs the table top-1
32K tokens, IQ2_XS 0.0045 same
32K and 125K, NVFP4 pack (fork) 0.0063 same

That is ~35x the run-to-run noise. Prompt and decode speed are unchanged (fork measurement).

Switch

STRATA_ROPE_LEGACY=1 brings the old float angles back.

🤖 Generated with Claude Code

https://claude.ai/code/session_01VZy1yKaDDiA8a7svdwaHio


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/280 **Author:** [@sergqwer](https://github.com/sergqwer) **Created:** 9/30/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `pr/rope-f64` --- ### 📝 Commits (1) - [`bfaae8d`](https://github.com/Niko1221/Strata/commit/bfaae8d97eeb7217cd18ec63acbdd0ae7912d7a6) RoPE: every kernel reads the session's float64 angle table ### 📊 Changes **5 files changed** (+78 additions, -26 deletions) <details> <summary>View changed files</summary> 📝 `include/strata/kernels/mrope.hpp` (+35 -0) 📝 `src/core/layer.cpp` (+3 -0) 📝 `src/kernels/cuda/native_qsa_indexer.cu` (+14 -15) 📝 `src/kernels/cuda/native_rope.cu` (+20 -6) 📝 `src/prefill/kernels.cu` (+6 -5) </details> ### 📄 Description ## Summary Three RoPE implementations disagreed: - the native decode/verify rope and the indexer's pooled keys computed `pos * powf(...)` with `cosf`/`sinf` under `--use_fast_math`: 0.0014 rad off at 32K, ~0.02 at 262K; - the prompt path used precise float libm; - the float64 angle table the session builds was read only by the non-native path. `rope_table_set` now registers that table per device (`mrope.hpp`), and every kernel reads it through `rope_cs`, or computes in float64 past its end. A position then has the same angle on every path. ## Measured Measured on current main (0.1.29, d6708a4) with ISTA-DASLab's IQ2_XS, RTX 5090 32 GB, Ryzen 9 9950X3D, 128 GB DDR5, Windows 11. KL is first-token KL divergence (`STRATA_DUMP_FIRST_LOGITS`, #276); two runs of main itself differ by 0 on 5 of 6 short prompts and by 0.00013 on the sixth. | prompt | KL, old angles vs the table | top-1 | | --- | ---: | --- | | 32K tokens, IQ2_XS | 0.0045 | same | | 32K and 125K, NVFP4 pack (fork) | 0.0063 | same | That is ~35x the run-to-run noise. Prompt and decode speed are unchanged (fork measurement). ## Switch `STRATA_ROPE_LEGACY=1` brings the old float angles back. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01VZy1yKaDDiA8a7svdwaHio --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-04 02:01:12 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#2546
No description provided.