Skip to content

[executorch][muse] Verify CUDA DFlash drafts on device under any sampling - #24042

Merged
Gasoonjia merged 1 commit into
gh/Gasoonjia/82/origfrom
gh/Gasoonjia/83/orig
Oct 21, 2026
Merged

Gasoonjia merged 1 commit into
gh/Gasoonjia/82/origfrom
gh/Gasoonjia/83/orig

Conversation

@pytorchbot

Copy link
Copy Markdown
Collaborator

This PR was created by the merge bot to help merge the original PR into the main branch.
ghstack PR number: #23984 by @Gasoonjia
^ Please use this as the source of truth for the PR details, comments, and reviews
ghstack PR base: https://github.com/pytorch/executorch/tree/gh/Gasoonjia/83/base
ghstack PR head: https://github.com/pytorch/executorch/tree/gh/Gasoonjia/83/head
Merge bot PR base: https://github.com/pytorch/executorch/tree/gh/Gasoonjia/82/orig
Merge bot PR head: https://github.com/pytorch/executorch/tree/gh/Gasoonjia/83/orig
Differential Revision: D125705716
@diff-train-skip-merge

…ling

Pull Request resolved: #23984

Export dflash_verify / dflash_verify_argmax: batched on-device acceptance of
every owner's drafts under that owner's temperature / top-k / top-p, with a
greedy fast path. Only token IDs return to the host. Uniforms come from
(seed, position, purpose) so results do not depend on batch composition.
Target preamble sampling also stays on device (CudaExecutor::sample_rows).
ghstack-source-id: 453099298
@exported-using-ghexport

Differential Revision: [D125705716](https://our.internmc.facebook.com/intern/diff/D125705716/)
@pytorch-bot

pytorch-bot Bot commented Oct 21, 2026

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/24042

Note: Links to docs will display an error until the docs builds have been completed.

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 21, 2026
@Gasoonjia
Gasoonjia added this pull request to stack #24044 October 21, 2026 06:44
@Gasoonjia
Gasoonjia merged commit c8ce66c into main Oct 21, 2026
306 of 315 checks passed
@Gasoonjia
Gasoonjia deleted the gh/Gasoonjia/83/orig branch October 21, 2026 06:48
Gasoonjia added a commit that referenced this pull request Oct 21, 2026
CudaDFlashNative.FinalWholeBlockFitsExactlyAndPreservesAllPrefillRows has
failed in unittest-cuda-muse-glimmer-batching since #24043 added draft
forward count checks to it:

  Expected: (drained.draft_forwards - drain.draft_forwards) >
            (drained.static_draft_forwards - drain.static_draft_forwards),
  actual: 1 vs 1

The test expected the decode at position 78 to drain the 79 hidden rows
dynamically before the static draft. But run_target drains every owner
it touches right after appending hidden rows (#24042), so the 78-row
prefill already drains down to the fresh context (32). The decode then
holds at most one block of rows and takes a single static draft, and the
dynamic forwards fall before the window the test measured.

Measure from before the prefill instead: the prefill drains through
dynamic drafts only, and the decode runs exactly one static draft.
@pytorchbot
pytorchbot deployed to upload-benchmark-results October 22, 2026 05:03 — with GitHub Actions Active
Gasoonjia added a commit that referenced this pull request Oct 22, 2026
Stacked on #24047.

`CudaDFlashNative.FinalWholeBlockFitsExactlyAndPreservesAllPrefillRows`
has failed in `unittest-cuda-muse-glimmer-batching` since #24043. It
failed on that PR's own CI and on `main` at 8d9eec3:

```
cuda_dflash_native_test.cpp:612: Failure
Expected: (drained.draft_forwards - drain.draft_forwards) > (drained.static_draft_forwards - drain.static_draft_forwards), actual: 1 vs 1
```

The test expected the decode at position 78 to drain the 79 hidden rows
through the dynamic draft before running the static draft. But
`run_target` drains every owner it touches right after it appends hidden
rows (added in #24042). So the 78-row prefill already drains down to the
fresh context (32 in this fixture). The decode then holds at most one
block (16) of rows and runs a single static draft. The dynamic forwards
happen during the prefill, before the stats snapshot the test took.

This is a bug in the test's measurement window, not in the executor. The
fix takes the first snapshot before the prefill and checks two things:
- the prefill runs only dynamic draft forwards (at least one);
- the decode runs exactly one draft forward, and it is static.

Test plan:
- `clang-format` is clean on the changed lines.
- No local GPU, so the test relies on CI:
`unittest-cuda-muse-glimmer-batching` on this PR should pass.

This branch was successfully deployed

2 active deployments
upload-benchmark-results — ab2e345a Deployed Oct 22, 2026 by pytorchbot via upload-benchmark-results #21164
cadence — ab2e345a Deployed Oct 21, 2026 by pytorchbot via hifi-op-test / hifi4 #34256
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants