Add preprocessor checks for Apple devices.

Based on work by @rbourgeat in https://github.com/ggerganov/llama.cpp/pull/5322/files
This commit is contained in:
Mathijs de Bruin 2024-02-06 14:39:22 +00:00 committed by Georgi Gerganov
parent 1879ec556e
commit b26c645420
No known key found for this signature in database
GPG Key ID: 449E073F9DC10735

View File

@ -1109,10 +1109,15 @@ static void ggml_vk_instance_init() {
#ifdef GGML_VULKAN_VALIDATE
"VK_EXT_validation_features",
#endif
#ifdef __APPLE__
"VK_KHR_portability_enumeration",
#endif
};
vk::InstanceCreateInfo instance_create_info(vk::InstanceCreateFlags(), &app_info, layers, extensions);
#ifdef __APPLE__
instance_create_info.flags = vk::InstanceCreateFlagBits::eEnumeratePortabilityKHR;
#endif
vk::InstanceCreateInfo instance_create_info(vk::InstanceCreateFlags(vk::InstanceCreateFlagBits::eEnumeratePortabilityKHR), &app_info, layers, extensions);
#ifdef GGML_VULKAN_VALIDATE
const std::vector<vk::ValidationFeatureEnableEXT> features_enable = { vk::ValidationFeatureEnableEXT::eBestPractices };
vk::ValidationFeaturesEXT validation_features = {