Skip to content

Fix Vulkan compute pipeline crash by checking if VK_EXT_subgroup_size_control is enabled#20762

Open
RanjithRagavan wants to merge 2 commits into
pytorch:mainfrom
RanjithRagavan:fix-vulkan-subgroup-crash
Open

Fix Vulkan compute pipeline crash by checking if VK_EXT_subgroup_size_control is enabled#20762
RanjithRagavan wants to merge 2 commits into
pytorch:mainfrom
RanjithRagavan:fix-vulkan-subgroup-crash

Conversation

@RanjithRagavan

@RanjithRagavan RanjithRagavan commented Jul 7, 2026

Copy link
Copy Markdown

This PR fixes a native Vulkan compute pipeline creation crash (-3 VK_ERROR_INITIALIZATION_FAILED) in Android 16 (API 36) system images. The bug occurs because the physical device reports subgroup size control support, but the extension is not enabled on the logical device (due to it being promoted to core Vulkan 1.3, which is not core in Vulkan 1.1 instance/device target). Passing the extension feature struct in pNext of VkDeviceCreateInfo without enabling the extension is invalid usage. This change checks if VK_EXT_subgroup_size_control is successfully enabled before utilizing its features. Fixes #11754.

cc @SS-JIA @manuelcandales @digantdesai @cbilgin

@RanjithRagavan RanjithRagavan requested a review from SS-JIA as a code owner July 7, 2026 12:59
@pytorch-bot pytorch-bot Bot added the module: vulkan Issues related to the Vulkan delegate and code under backends/vulkan/ label Jul 7, 2026
@pytorch-bot

pytorch-bot Bot commented Jul 7, 2026

Copy link
Copy Markdown

🔗 Helpful Links

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

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

⚠️ 13 Awaiting Approval

As of commit c76ab9a with merge base b1ef9a5 (image):

AWAITING APPROVAL - The following workflows need approval before CI can run:

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

@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 Jul 7, 2026
@RanjithRagavan

Copy link
Copy Markdown
Author

Root Cause: The Vulkan physical device reported supporting the VK_EXT_subgroup_size_control feature during initial queries. However, during logical device creation (vkCreateDevice), the extension itself was not successfully enabled (common on modern drivers because the extension has been promoted to core in Vulkan 1.3, but ExecuTorch initializes Vulkan with a Vulkan 1.1 target version, making it non-core). Passing the features struct in pNext of VkDeviceCreateInfo without enabling the corresponding extension is a Vulkan specification violation, leading to driver errors (-3 VK_ERROR_INITIALIZATION_FAILED) when compute pipelines attempt to bind or compile shaders.
Fix: Updated
Adapter.cpp
to verify that VK_EXT_subgroup_size_control is actually present in the list of successfully enabled device extensions (enabled_device_extensions) before adding the features struct to device initialization. If the extension is not enabled, the subgroup size control features are disabled, ensuring clean fallback behavior without a driver crash.

@RanjithRagavan

Copy link
Copy Markdown
Author

@pytorchbot label "release notes: none"

@pytorch-bot pytorch-bot Bot added the release notes: none Do not include this in the release notes label Jul 7, 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. module: vulkan Issues related to the Vulkan delegate and code under backends/vulkan/ release notes: none Do not include this in the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Android native crash when running DeepLabV3Demo with vulkan backend in Android 16

2 participants