Skip to content

Commit 1dd0b1d

Browse files
swolchokpytorchmergebot
authored andcommitted
Unbreak torch.is_vulkan_available() on Mac (re-send of #154675, please stamp) (#155595)
This is a new PR duplicating #154675 due to merge issues with that PR coming from my old (now updated) version of ghstack. I am a Vulkan noob, but this extension and flag seem to be necessary. See "Encounted VK_ERROR_INCOMPATIBLE_DRIVER" at https://vulkan-tutorial.com/Drawing_a_triangle/Setup/Instance . (For anyone trying to repro at home, I have the following homebrew packages installed, not all of which may be necessary: molten-vk, vulkan-headers, vulkan-loader, vulkan-tools, vulkan-utility-libraries. I also have VK_ICD_FILENAMES set to /opt/homebrew/etc/vulkan/icd.d/MoltenVK_icd.json, and I built PyTorch with USE_VULKAN=1. Making sure vkcube works helped me debug this setup.) Pull Request resolved: #155595 Approved by: https://github.com/malfet
1 parent d1947a8 commit 1dd0b1d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

aten/src/ATen/native/vulkan/api/Runtime.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ VkInstance create_instance(const RuntimeConfiguration& config) {
7878
#ifdef VK_EXT_debug_report
7979
VK_EXT_DEBUG_REPORT_EXTENSION_NAME,
8080
#endif /* VK_EXT_debug_report */
81+
#ifdef __APPLE__
82+
VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME,
83+
#endif // __APPLE__
8184
};
8285

8386
find_requested_layers_and_extensions(
@@ -90,7 +93,11 @@ VkInstance create_instance(const RuntimeConfiguration& config) {
9093
const VkInstanceCreateInfo instance_create_info{
9194
VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO, // sType
9295
nullptr, // pNext
96+
#ifdef __APPLE__
97+
VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR, // flags
98+
#else // __APPLE__
9399
0u, // flags
100+
#endif // __APPLE__
94101
&application_info, // pApplicationInfo
95102
static_cast<uint32_t>(enabled_layers.size()), // enabledLayerCount
96103
enabled_layers.data(), // ppEnabledLayerNames

0 commit comments

Comments
 (0)