Skip to content

[ET-VK][runtime] Derive SPIR-V requirements and enable Vulkan shader features - #24340

Open
SS-JIA wants to merge 3 commits into
gh/SS-JIA/674/basefrom
gh/SS-JIA/674/head
Open

SS-JIA wants to merge 3 commits into
gh/SS-JIA/674/basefrom
gh/SS-JIA/674/head

Conversation

@SS-JIA

@SS-JIA SS-JIA commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

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.

info = getShaderInfo(glsl_path, spv_path)
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).

Differential Revision: D128509572

cc @manuelcandales @digantdesai @cbilgin

[ghstack-poisoned]
@pytorch-bot

pytorch-bot Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

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

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

✅ No Failures

As of commit def96f3 with merge base aed328d (image):
💚 Looks good so far! There are no failures yet. 💚

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.

@JakeStevens JakeStevens left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review automatically exported from Phabricator review in Meta.

[ghstack-poisoned]
[ghstack-poisoned]

This branch was successfully deployed

1 active deployment
cadence — def96f32 Deployed Oct 31, 2026 by SS-JIA via hifi-op-test / hifi4 #35716
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. meta-exported module: vulkan Issues related to the Vulkan delegate and code under backends/vulkan/

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants