[executorch][vulkan] Add payload-bounded constant sharding - #21467
Merged
Conversation
Pull Request resolved: #21404 **Enable deterministic payload-bounded Vulkan constant sharding** **Problem** Large Vulkan exports can make inline PTE named data exceed downstream artifact limits, but `NamedDataStore` cannot externalize that data into bounded groups. **Solution** - **Before:** Vulkan constants remain inline with no payload-bounded externalization option. - **After:** an opt-in `uint64` raw-data cap externalizes constants after graph construction into deterministic shards. **Implementation** - `NamedDataStore.externalize_pte_data` groups aliases by backing buffer, preserves existing tags, and rejects oversize buffers or collisions atomically. - `parse_compile_options` and `parse_compile_spec` transport `external_constants_max_data_bytes` as a strict positive `uint64`. - `VulkanBackend.preprocess` applies sharding only when the option is present. **Constraints** The default path is unchanged; buffers are not copied or split. The cap bounds unique raw buffer bytes per external tag, not final `FlatTensor` file size including alignment and header overhead. Co-authored-with: Claude Code. ghstack-source-id: 407350478 @exported-using-ghexport Differential Revision: [D113608555](https://our.internmc.facebook.com/intern/diff/D113608555/)
pytorchbot
requested review from
JacobSzwejbka,
SS-JIA and
larryliu0820
as code owners
July 29, 2026 17:45
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/21467
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
|
Pull Request resolved: #21405 **Dynamic Q4 embedding reuse now preserves the complete packing configuration.** A resize used to rebuild the uniform field by field, which dropped `is_linear_weight`. The resize hook now captures the fully initialized `EmbeddingParams` and rewrites only `num_indices` and `total_blocks`. Key changes: - `EmbeddingQ4gsw.cpp` — pass a 32-byte base parameter struct by value through the resize callback. - Resize recomputation updates only dynamic counts, so current and future invariant fields are preserved by construction. - Mirrors Vulkan `EmbeddingQ4gsw.cpp`, which retains `is_linear_weight` in push-constant state across resize. Static and nonlinear embedding behavior is unchanged. Co-authored-with: Claude Code. ghstack-source-id: 407350572 @exported-using-ghexport Differential Revision: [D113627870](https://our.internmc.facebook.com/intern/diff/D113627870/)
Pull Request resolved: #21406 **Dynamic-shape coverage now locks linear-packed Q4 embedding reuse.** The fixture exports a discriminating linear-packed model and reuses one loaded graph across N=16,8,1,16, covering the resize transition that previously reset nibble order. Key changes: - `test_dynamic_shape_export.py` — export deterministic true-packing artifacts and torch goldens for N=16,8,1. - `test_dynamic_shape.cpp` — add one-graph linear-packed reuse coverage while preserving the nonlinear control. The explicit true-vs-false output guard prevents a non-discriminating fixture. Co-authored-with: Claude Code. ghstack-source-id: 407350695 @exported-using-ghexport Differential Revision: [D113627869](https://our.internmc.facebook.com/intern/diff/D113627869/)
JCNTH
approved these changes
Jul 29, 2026
JCNTH
approved these changes
Jul 29, 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: #21404 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/194/base
ghstack PR head: https://github.com/pytorch/executorch/tree/gh/JCNTH/194/head
Merge bot PR base: https://github.com/pytorch/executorch/tree/main
Merge bot PR head: https://github.com/pytorch/executorch/tree/gh/JCNTH/194/orig
@diff-train-skip-merge
cc @SS-JIA @manuelcandales @digantdesai @cbilgin