Skip to content

[ExecuTorch][WebGPU] 2D compute dispatch tests — prefill golden + fold unit test#20584

Open
JulianCloudNTH wants to merge 1 commit into
gh/JulianCloudNTH/76/basefrom
gh/JulianCloudNTH/76/head
Open

[ExecuTorch][WebGPU] 2D compute dispatch tests — prefill golden + fold unit test#20584
JulianCloudNTH wants to merge 1 commit into
gh/JulianCloudNTH/76/basefrom
gh/JulianCloudNTH/76/head

Conversation

@JulianCloudNTH

@JulianCloudNTH JulianCloudNTH commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

Test coverage for the 2D dispatch fold, stacked above the cap-lift op.

Problem: The 2D fold is load-bearing index math — a wrong {x, y} means out-of-bounds writes or dropped threads — and the prefill shapes that exercise it previously threw at the 1D cap, so they were untested.

Solution: A device-free unit test for the fold arithmetic, plus two single-shot prefill SDPA golden configs that fold each kernel family.

  • Before: no coverage for >65535-workgroup dispatch; llama1b_prefill_512/_2048 shapes threw at the cap
  • After: fold_workgroup_count_2d unit-tested at the cap boundaries, and the two prefill shapes run as goldens

Implementation:

  • test/native/test_dispatch_2d.cpp — device-free unit test for utils::fold_workgroup_count_2d: the 1D fast path, the 2D fold, the real Llama-1B QK counts at S=512 ({65535, 3}) and S=2048 ({65535, 33}), and the needs-3rd-dimension throw; asserts each {x, y} covers [0, count)
  • llama1b_prefill_512 + llama1b_prefill_2048 configs appended to the byte-mirrored CONFIGS (test_sdpa.py) and kSdpaConfigs (test_webgpu_native.cpp)
  • Registers webgpu_dispatch_2d_test in CMake + the native CI script

Constraints:

  • The Python/C++ config entries byte-mirror each other (kept in sync)
  • add shares the element-form path with QK, so it is covered structurally; a dedicated >16M-element add fold case is omitted as disproportionate

Co-authored-with: Claude Code.

Differential Revision: D109517683

[ghstack-poisoned]
@pytorch-bot

pytorch-bot Bot commented Jun 28, 2026

Copy link
Copy Markdown

🔗 Helpful Links

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

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

❌ 1 New Failure

As of commit 1f4f899 with merge base 55a71e6 (image):

NEW FAILURE - The following job has failed:

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

@github-actions

Copy link
Copy Markdown

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

@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 Jun 28, 2026
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