Skip to content

deps: RoPE correctness fix in llama.cpp (point at GeometricAGI fork)#9

Open
DeanoC wants to merge 1 commit into
mainfrom
fix/rope-fp64-correctness-bump-ggml
Open

deps: RoPE correctness fix in llama.cpp (point at GeometricAGI fork)#9
DeanoC wants to merge 1 commit into
mainfrom
fix/rope-fp64-correctness-bump-ggml

Conversation

@DeanoC

@DeanoC DeanoC commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

What

Repoints server/deps/llama.cpp from ac06e543 (Luce-Org perf/luce-verify-kernels) to GeometricAGI/lucebox-ggml @ 0fe65d93 = ac06e543 + one commit:

ggml-cuda: defer RoPE mod-2pi reduction until after angle scaling

Also switches the submodule url to our fork and its tracking branch to fix/rope-fp64-deferred-reduction. No source changes in lucebox-hub itself — only .gitmodules + the gitlink.

Why (the bug)

rope_theta_fp64() reduced the rotation angle mod-2π before the downstream scaling in rope_yarn (freq_scale *) and the callers' /freq_factor. mod-2π reduction does not commute with scaling, so results were wrong for every RoPE config with freq_scale != 1.0 or freq_factor != 1.0 — freq_factors, YaRN, mrope/vision/imrope, and the backward + set_rows paths that share the helper. (The code comment even documented the caveat: only valid for the qwen35 dflash graph where fs==ff==1.)

The fix returns the unreduced angle in double, carries double through rope_yarn's scaling, and does the mod-2π reduction in double right before cosf/sinf — preserving the large-freq_base (Qwen3.5, 1e7) precision benefit and a no-op for the fs=1,ff=1 fast path.

Verification

rope.cu is byte-identical between ac06e543 and 30c9d7d, where this exact change was verified with test-backend-ops on gfx1201 (R9700) and gfx1100 (7900 XTX):

op before after
ROPE 82/268 268/268
ROPE_BACK 82/228 228/228
ROPE_SET_ROWS 24/48 48/48
SOFT_MAX (control) 212/212 212/212

Full suite went 11232 → 11588 / 11606 (the remaining 18 are GATED_DELTA_NET, a separate unrelated op bug — not addressed here).

Recommend a CI test-backend-ops run on the fork to confirm on the exact ac06e543 tree.

Follow-ups

  • Upstream 0fe65d93 from GeometricAGI/lucebox-ggmlLuce-Org/lucebox-ggml (base perf/luce-verify-kernels) when ready.
  • GATED_DELTA_NET (18 failing ops) still needs separate diagnosis.

🤖 Generated with Claude Code

Bumps server/deps/llama.cpp from ac06e543 (Luce-Org perf/luce-verify-kernels)
to GeometricAGI/lucebox-ggml @ 0fe65d93 = ac06e543 + one commit:
'ggml-cuda: defer RoPE mod-2pi reduction until after angle scaling'.

rope_theta_fp64() reduced the rotation angle mod-2pi before rope_yarn's
freq_scale multiply and the callers' /freq_factor; the reduction does not
commute with scaling, so every RoPE config with freq_scale!=1 or freq_factor!=1
was numerically wrong (freq_factors, YaRN, mrope/vision/imrope, ROPE_BACK,
ROPE_SET_ROWS). rope.cu is byte-identical between ac06e543 and 30c9d7d, where
this exact change was verified via test-backend-ops on gfx1201 + gfx1100:
ROPE 268/268, ROPE_BACK 228/228, ROPE_SET_ROWS 48/48 (was 356 failures),
SOFT_MAX unchanged 212/212. Upstream to Luce-Org when ready.
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