KomputeProject / kompute

General purpose GPU compute framework built on Vulkan to support 1000s of cross vendor graphics cards (AMD, Qualcomm, NVIDIA & friends). Blazing fast, mobile-enabled, asynchronous and optimized for advanced GPU data processing usecases. Backed by the Linux Foundation.
http://kompute.cc/
Apache License 2.0
1.94k stars 146 forks source link

Instance creation fails on macOS with recent Vulkan SDK #308

Closed Archie3d closed 7 months ago

Archie3d commented 1 year ago

Running on MacOS with Vulkan SDK 1.3.231. The Manager::createInstance() fails silently when calling

vk::createInstance(&computeInstanceCreateInfo, nullptr, this->mInstance.get());

Perhaps it should check the returned code, which in this case happens to be VK_ERROR_INCOMPATIBLE_DRIVER. It seems that the recent SDK requires the VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME extension to be enabled on MacOS:

applicationExtensions.push_back(VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME);
computeInstanceCreateInfo.flags |= vk::InstanceCreateFlagBits::eEnumeratePortabilityKHR;
...
vk::createInstance(&computeInstanceCreateInfo, nullptr, this->mInstance.get());
axsaucedo commented 7 months ago

@Archie3d it seems it took a while to get back to this but we have finally been able to run Kompute reliably on an M1 device.

Specifically there are a few ways in which this can be made work, one option is to install an older SDK - this has been tested correctly with driver 1.2.198, as long as the VK_ICD_FILENAMES env var is set up correctly to your MoltenVK driver (e.g. $VULKAN_SDK/share/vulkan/icd.d/MoltenVK_icd.json)

Furthermore we should certainly extend the code to include a check for compatibility, and enable users to add the KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME as suggested.