Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions backends/vulkan/runtime/vk_api/Adapter.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
Expand Down Expand Up @@ -217,15 +217,25 @@
#endif /* VK_NV_cooperative_matrix2 */

#ifdef VK_EXT_subgroup_size_control
// Only enable the feature struct if the extension was actually requested
// and the feature flag is set on the physical device. The extension itself
// is filtered into enabled_device_extensions by
// find_requested_device_extensions.
// Only enable the feature struct if the extension was actually requested,
// supported, and successfully enabled.
bool subgroup_size_control_extension_enabled = false;
for (const auto& ext : enabled_device_extensions) {
if (strcmp(ext, VK_EXT_SUBGROUP_SIZE_CONTROL_EXTENSION_NAME) == 0) {

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.

Please add

#include <cstring>

to ensure that strcmp is defined; this should fix the CI failures on this PR!

subgroup_size_control_extension_enabled = true;
break;
}
}

VkPhysicalDeviceSubgroupSizeControlFeaturesEXT subgroup_size_control_features{
physical_device.subgroup_size_control_features};
if (physical_device.supports_subgroup_size_control) {
if (physical_device.supports_subgroup_size_control &&
subgroup_size_control_extension_enabled) {
subgroup_size_control_features.pNext = extension_list_top;
extension_list_top = &subgroup_size_control_features;
} else {
const_cast<PhysicalDevice&>(physical_device).supports_subgroup_size_control = false;

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.

rather than using const_cast, let's just change the function signature from const PhysicalDevice& physical_device to PhysicalDevice& physical_device (i.e. drop the const).

const_cast<PhysicalDevice&>(physical_device).supports_compute_full_subgroups = false;
}
#endif /* VK_EXT_subgroup_size_control */

Expand Down
Loading