perf(ds4): overlap heterogeneous owner prefill - #647
Open
cheese-cakee wants to merge 12 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 4 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
cheese-cakee
marked this pull request as draft
August 22, 2026 22:49
cheese-cakee
marked this pull request as ready for review
August 23, 2026 15:33
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 7 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 2 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
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.
Important
Stacking: GitHub shows
mainas this PR's base branch, but the commit history is stacked directly on the open PR #640 head (51d2929). The #647-specific commits arecdcd4ac4,42bd9ab2,538b3041, and2eab093e. PR #640 merges first and becomes the baseline; PR #647 is the incremental scheduling optimization on top of it.Benchmark baseline: Every #647 feature-off and feature-on measurement below already includes #640. “Feature off” means #640 with only
DFLASH_MOE_COLD_INPUT_FIRST=0; it does not mean the pre-#640 baseline.Result
This removes a host-side serialization point from heterogeneous DeepSeek-V4 expert prefill while preserving the existing device-side copy dependency.
Performance stack
The merge and measurement story has two stages:
mainat #640's qualification (ac22a3ed) -> #640The headline for #647 is therefore +4.27% at 2048 tokens and +4.59% at 401 tokens, incrementally on top of #640, with exact output parity. The #640 absolute values differ between its own qualification (304.69 tok/s at 2048 tokens) and the later #647 qualification baseline (308.67 tok/s) because they were separate sessions; each percentage above is calculated only within its matched experiment.
Full qualification
The two independent 2048 brackets were +4.45% and +3.84%. The 401 regression brackets were +4.84% and +4.73%. Every timed response matched the exact oracle.
Review-fix validation
The final head was rebuilt and re-tested after the review fixes:
test_deepseek4_unit: PASS on gfx1201 and gfx1151, including the63=false,64=truesafety boundaryThe exact live head
2eab093ewas not run through another complete performance qualification. The performance headline above remains tied to the preserved complete matched qualification; no incomplete or cross-session post-review result is used as headline evidence.What changed
ggml_backend_synchronize()from that readiness pointDFLASH_MOE_COLD_INPUT_FIRSTis disabledThe option remains default-off and is an immediate escape hatch: leave
DFLASH_MOE_COLD_INPUT_FIRSTunset or set it to0.Why it works
The D2D transfer itself was not made smaller or removed. Both traces contain the same 43 hot-to-cold copies with effectively unchanged median copy duration.
This is a scheduling/overlap improvement: the host can submit independent hot work earlier while the destination stream still waits on the copy event before consuming the input.
Qualification
The preserved complete matched performance qualification used two warmups and five measured requests per block in
off/on/on/offorder. Values above are pooled medians; no outliers were removed.+4.27%, brackets+4.45%,+3.84%)+4.59%, brackets+4.84%,+4.73%)-0.24%pooled; brackets+2.06%,-0.50%)test_moe_input_ready: PASS, including bounded pre-ready exception propagation and concurrent single-shot signalingtest_deepseek4_unit: PASS on gfx1201 and gfx1151.Reproducibility
51d2929bd0b133f7b284ce544be56327312b87372eab093e3d88a1c184c8e6579cbd048eb843631cdc57dac68602908e1f51f10c98df6740ab64b72401058b04a18404ae3630254fcd8b9c74e54f0578b68e7f35abae22f1fca26a03d0b9e5b79bd4103c26b4add4391f0656fe16f86b7c4373be006cf79b8fa6c30d9badd8e72f83c62952fe24b2e8cd647e103aff086bece328cb9c9208cd5cb9fb5ac3c4f4007e8b41d117da21622439cd05c1728f3e82f90e4f869dad8494bc2a54ee32d5b99eab0b76a99c7060974e41c472b9027ab50fb24fd87743c5d09cff0e30baed33f2087f91313dfb82f1daeabdf5666d57d5d4fa26f977f1d8230ed1f8d0e59688ac09e0226a6e6d192c9b4fd21c8630007da54ec9c5ff66Preserved evidence roots
/home/cheese/perf-ds4-owner-input-first-final-qual5-20260823T203000IST/home/cheese/perf-ds4-owner-input-first-final-trace-20260823T220000IST/home/cheese/perf-ds4-owner-input-first-final-static-20260823T214500ISTEach final evidence root includes checksums; the qualification and causal-trace manifests were sealed and verified.