Repository navigation
[ET-VK][runtime] Derive SPIR-V requirements and enable Vulkan shader features - #24387
Merged
Merged
Conversation
…features Pull Request resolved: #24340 ## Ulterior Motive Run supported shaders with the required Vulkan features enabled, and skip unsupported shaders before driver compilation. ## Rationale Make compiled SPIR-V the source of shader capability requirements and carry those requirements through code generation, device setup, and pipeline validation. GLSL extension declarations can be hidden in includes or unused. Vulkan features must also be enabled on the logical device before shaders can use them. ## Details | Area | Before | After | | --- | --- | --- | | Requirement detection | Six flags inferred from GLSL extension text. | Require compiled SPIR-V, preserve every declared `OpCapability`, and remove GLSL extension matching. | | Runtime validation | Check the six feature flags. | Map capability IDs to arithmetic, storage, image, subgroup, and cooperative-matrix support; reject unsupported or unrecognized IDs before shader-module/pipeline creation. | | Device setup | Cache selected core features and enable `shaderInt16`, `shaderInt64`, and `shaderFloat64`. | Cache the full core feature query and also enable supported shader image/indexing features required by the expanded checks. | | Error reporting | Describe requirements using the fixed `VulkanExtension` enum. | Accept requirement descriptions that include arbitrary SPIR-V capability IDs. | `gen_vulkan_spv.py` emits the capability list into `ShaderInfo.required_capabilities`; named `SpirvCapability` IDs make the runtime mapping readable. `Device` caches feature queries, `Adapter` configures the device and checks support, and `Context`/`ComputeGraph` enforce requirements. Existing flag checks remain for manually constructed metadata without a list. ```python info = getShaderInfo(glsl_path, spv_path) ``` ```cpp context.check_device_capabilities(shader); ``` Use the authoritative Python host tool in shader-generation builds. Keep descriptor, tile, and required-subgroup-size metadata parsing. Generator tests cover mappings, ignored GLSL extension declarations, unknown-capability preservation, and malformed modules; framework-dependent integration tests accompany the later benchmark commit. Authored with Codex (AI). ghstack-source-id: 461636565 @exported-using-ghexport Differential Revision: [D128509572](https://our.internmc.facebook.com/intern/diff/D128509572/)
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/24387
Note: Links to docs will display an error until the docs builds have been completed. ❌ 19 Pending, 6 Unclassified FailuresAs of commit 5c2d7c3 with merge base aed328d ( UNCLASSIFIED FAILURES - DrCI could not classify the following jobs because the workflow did not run on the merge base. The failures may be pre-existing on trunk or introduced by this PR:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
SS-JIA
approved these changes
Oct 31, 2026
This branch was previously deployed
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: #24340 by @SS-JIA
^ 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/SS-JIA/674/base
ghstack PR head: https://github.com/pytorch/executorch/tree/gh/SS-JIA/674/head
Merge bot PR base: https://github.com/pytorch/executorch/tree/gh/SS-JIA/673/orig
Merge bot PR head: https://github.com/pytorch/executorch/tree/gh/SS-JIA/674/orig
Differential Revision: D128509572
@diff-train-skip-merge
cc @SS-JIA @manuelcandales @digantdesai @cbilgin