@@ -534,6 +534,7 @@ struct vk_device_struct {
534
534
ggml_backend_buffer_type buffer_type;
535
535
536
536
bool disable_fusion;
537
+ bool disable_host_visible_vidmem;
537
538
538
539
#ifdef GGML_VULKAN_MEMORY_DEBUG
539
540
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) {
1804
1805
} else if (device->uma) {
1805
1806
// Fall back to host memory type
1806
1807
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);
1807
1810
} else {
1808
1811
// use rebar if available, otherwise fallback to device only visible memory
1809
1812
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) {
3265
3268
const char* GGML_VK_PREFER_HOST_MEMORY = getenv("GGML_VK_PREFER_HOST_MEMORY");
3266
3269
device->prefer_host_memory = GGML_VK_PREFER_HOST_MEMORY != nullptr;
3267
3270
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
+
3268
3274
bool fp16_storage = false;
3269
3275
bool fp16_compute = false;
3270
3276
bool maintenance4_support = false;
0 commit comments