Repository navigation
update(perf): bound DRY and sparse penalty step costs - #2272
Merged
Merged
Conversation
Replace quadratic backward matching with a linear reverse-Z pass and scatter DRY and rebuild frequency/presence updates only across touched token IDs. Preserve backend-specific dense dtype behavior and the existing incremental f32 path. Add dense-reference parity matrices, breaker-boundary and linear comparison-count checks, bf16 incremental regression coverage, and an ignored timing report. Build and tests have not run yet because the orchestrated CUDA profiling window is still active. Refs #2259
Build a reversed-token matcher once per DRY step so exact IDs and multi-token breakers cost expected O(P + N) instead of multiplying breaker configuration size by the history window. Preserve scalar breaker semantics in direct per-position parity tests and cover large exact sets plus shared-tail failure chains with separate build and scan counters. Validation: cargo fmt --all. Build and tests are pending the root validation gate. Refs #2259
Publish the quiet GB10 host matching and lazy graph-construction timings for issue #2259 with byte-preserved logs, validation output, checksums, and source, artifact, driver, and host-gate provenance. The record distinguishes these measurements from GPU end-to-end latency. Validation: sha256sum --check SHA256SUMS and git diff --cached --check. Refs #2259
Add bilingual technical reports and preserve the original two-commit implementation patch used for GB10 timing. Record the measured and rebased source identities, prove the scoped core, native, and lockfile diff is empty, and document replay from the public measurement base. Validation: - `sha256sum --check SHA256SUMS` - Replayed the archived patch from `73700aaf` and matched tree `58b9a04161eaf88048699d0930a69dd59ccdd7b3` - `git diff --cached --check` Refs #2259, #2272
2 of 3 tasks
inureyes
added a commit
that referenced
this pull request
Oct 12, 2026
…2275) ## Summary Docs-only measurement record for issue #2239: the reported pipelined B=1 decode regression on Gemma 3 (gfx1151, pp2048/tg128) does not reproduce on the current tree, so no code change ships. `docs/benchmark_results/wrapped-ring-lookahead-gfx1151-2026-10-12.md` records the paired measurements, with session scripts and raw CSV under `docs/benchmark_results/data/`. ## Measurements Four-arm interleaved session (pre-epic `4c44e317` base, branch pipelined, `MLXCEL_FORCE_SYNC=1`, base noise floor), 12 runs, all CLEAN under the GPU guard: base median 62.61 tok/s, pipelined branch 62.63 (paired median -0.13 percent), sync 61.10 (-2.41 percent), noise floor +0.00 percent (range -0.18 to +0.14). A follow-up arm on origin/main at `e24fb7b2` without the branch's changes measures 62.79 (+0.29 percent), so the Oct 8 -1.3 percent gap was already recovered by #2271 and #2272 before this branch existed. The pp512 cell stays within the 1.0 percent threshold (+0.78 percent). A wrapped-window synchronous handover prototype carried during measurement was dropped: it never routes this bench path and its destination measures below the pipeline today. ## Test plan - [x] Full ROCm gate (`make verify-rocm-held`): 12264 passed, 0 failed, 404 ignored - [x] `engine-parity`: 14 pairs, 13 identical, 1 n/a - [ ] CUDA (GB10) three-arm measurement: not run, the spark-102 host's gpu-lock tooling is not reachable from this host; that criterion stays open Closes #2239
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A full-history DRY step previously rescanned repeated suffixes quadratically, and checking every position against request-supplied breaker lists could multiply window length by breaker configuration size. This change computes suffix matches with reverse Z and breaker starts with a reversed-token Aho-Corasick matcher, bounding expected host work to
O(N + P)for history lengthNand configured breaker-pattern tokensP.DRY and rebuilt frequency/presence penalties now scatter only touched token IDs instead of constructing vocabulary-sized host buffers. The sparse paths preserve the pinned MLX backend semantics: CUDA bf16 mixed arithmetic remains bf16 on rebuild paths, while the pre-existing incremental frequency/presence path still explicitly promotes to f32.
Quiet GB10 host matching and lazy MLX graph-construction timing used vocabulary 4, a period-3 history, and no breakers. Reference iterations were 3/3/1 and new-path iterations were 20/20/20. Returned arrays were not evaluated, so these figures are not GPU end-to-end latency:
Validation on CUDA GB10:
cargo fmt --checkpassed.Timing evidence:
docs/benchmark_results/dry-penalty-step-cost-gb10-2026-10-11.mdand its linked raw package.Closes #2259
Refs #2229, #2256