@@ -534,6 +534,7 @@ struct vk_device_struct {
534534 ggml_backend_buffer_type buffer_type;
535535
536536 bool disable_fusion;
537+ bool disable_host_visible_vidmem;
537538
538539#ifdef GGML_VULKAN_MEMORY_DEBUG
539540 std::unique_ptr<vk_memory_logger> memory_logger;
@@ -1804,6 +1805,8 @@ static vk_buffer ggml_vk_create_buffer_device(vk_device& device, size_t size) {
18041805 } else if (device->uma) {
18051806 // Fall back to host memory type
18061807 buf = ggml_vk_create_buffer(device, size, vk::MemoryPropertyFlagBits::eDeviceLocal, vk::MemoryPropertyFlagBits::eHostVisible | vk::MemoryPropertyFlagBits::eHostCoherent);
1808+ } else if (device->disable_host_visible_vidmem) {
1809+ buf = ggml_vk_create_buffer(device, size, vk::MemoryPropertyFlagBits::eDeviceLocal, vk::MemoryPropertyFlagBits::eDeviceLocal);
18071810 } else {
18081811 // use rebar if available, otherwise fallback to device only visible memory
18091812 buf = ggml_vk_create_buffer(device, size, vk::MemoryPropertyFlagBits::eDeviceLocal | vk::MemoryPropertyFlagBits::eHostVisible | vk::MemoryPropertyFlagBits::eHostCoherent, vk::MemoryPropertyFlagBits::eDeviceLocal);
@@ -3265,6 +3268,9 @@ static vk_device ggml_vk_get_device(size_t idx) {
32653268 const char* GGML_VK_PREFER_HOST_MEMORY = getenv("GGML_VK_PREFER_HOST_MEMORY");
32663269 device->prefer_host_memory = GGML_VK_PREFER_HOST_MEMORY != nullptr;
32673270
3271+ const char* GGML_VK_DISABLE_HOST_VISIBLE_VIDMEM = getenv("GGML_VK_DISABLE_HOST_VISIBLE_VIDMEM");
3272+ device->disable_host_visible_vidmem = GGML_VK_DISABLE_HOST_VISIBLE_VIDMEM != nullptr;
3273+
32683274 bool fp16_storage = false;
32693275 bool fp16_compute = false;
32703276 bool maintenance4_support = false;
0 commit comments