[ExecuTorch][WebGPU] Fold remaining hardcoded 65535 dispatch-limit checks into queried_max_workgroups#20950
Open
pytorchbot wants to merge 2 commits into
Open
[ExecuTorch][WebGPU] Fold remaining hardcoded 65535 dispatch-limit checks into queried_max_workgroups#20950pytorchbot wants to merge 2 commits into
pytorchbot wants to merge 2 commits into
Conversation
…ecks into queried_max_workgroups Pull Request resolved: #20916 The backend queries the device's `maxComputeWorkgroupsPerDimension` through `utils::queried_max_workgroups` (keeping `65535` only as the documented spec-default fallback when the query fails), but a few landed dispatch-limit guards still hardcode the literal `65535u` or re-inline the same query. This folds them onto the shared helper, matching the convention already used by `Linear.cpp`/`Bmm.cpp` and the backend's "query the device limit, don't hardcode" rule. Key changes: - `RmsNorm.cpp` — replace both `> 65535u` guards (build path and resize hook) with `utils::queried_max_workgroups(...)`; drop the now-stale `(65535)` from the two error strings. - `QuantizedLinear.cpp` — delete the file-local `max_workgroups_per_dim` (a near-duplicate of the util) and call `utils::queried_max_workgroups` at both sites; `steel_supported()` (a `maxComputeInvocationsPerWorkgroup` gate) is unchanged. - `WebGPUUtils.h` — `clamp_workgroup_count` now delegates to `queried_max_workgroups` instead of re-inlining the same query + fallback. No behavior change on compliant devices: `queried_max_workgroups` returns the reported `maxComputeWorkgroupsPerDimension` (the WebGPU spec guarantees >= 65535) or falls back to 65535 if the query fails, so each swapped `> ...` guard can only relax versus the old `> 65535u` literal — no currently-passing shape newly throws. Co-authored-with: Claude Code. ghstack-source-id: 402967330 @exported-using-ghexport Differential Revision: [D111999110](https://our.internmc.facebook.com/intern/diff/D111999110/)
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/20950
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. |
This PR needs a
|
JCNTH
approved these changes
Jul 15, 2026
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.
This PR was created by the merge bot to help merge the original PR into the main branch.
ghstack PR number: #20916 by @JCNTH
^ 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/JCNTH/55/base
ghstack PR head: https://github.com/pytorch/executorch/tree/gh/JCNTH/55/head
Merge bot PR base: https://github.com/pytorch/executorch/tree/main
Merge bot PR head: https://github.com/pytorch/executorch/tree/gh/JCNTH/55/orig
@diff-train-skip-merge