Skip to content

Commit 68504bd

Browse files
Fix Vulkan compute pipeline crash by checking if VK_EXT_subgroup_size_control is successfully enabled
1 parent ec8f099 commit 68504bd

1 file changed

Lines changed: 15 additions & 5 deletions

File tree

backends/vulkan/runtime/vk_api/Adapter.cpp

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -217,15 +217,25 @@ VkDevice create_logical_device(
217217
#endif /* VK_NV_cooperative_matrix2 */
218218

219219
#ifdef VK_EXT_subgroup_size_control
220-
// Only enable the feature struct if the extension was actually requested
221-
// and the feature flag is set on the physical device. The extension itself
222-
// is filtered into enabled_device_extensions by
223-
// find_requested_device_extensions.
220+
// Only enable the feature struct if the extension was actually requested,
221+
// supported, and successfully enabled.
222+
bool subgroup_size_control_extension_enabled = false;
223+
for (const auto& ext : enabled_device_extensions) {
224+
if (strcmp(ext, VK_EXT_SUBGROUP_SIZE_CONTROL_EXTENSION_NAME) == 0) {
225+
subgroup_size_control_extension_enabled = true;
226+
break;
227+
}
228+
}
229+
224230
VkPhysicalDeviceSubgroupSizeControlFeaturesEXT subgroup_size_control_features{
225231
physical_device.subgroup_size_control_features};
226-
if (physical_device.supports_subgroup_size_control) {
232+
if (physical_device.supports_subgroup_size_control &&
233+
subgroup_size_control_extension_enabled) {
227234
subgroup_size_control_features.pNext = extension_list_top;
228235
extension_list_top = &subgroup_size_control_features;
236+
} else {
237+
const_cast<PhysicalDevice&>(physical_device).supports_subgroup_size_control = false;
238+
const_cast<PhysicalDevice&>(physical_device).supports_compute_full_subgroups = false;
229239
}
230240
#endif /* VK_EXT_subgroup_size_control */
231241

0 commit comments

Comments
 (0)