Skip to content

Commit 94e549c

Browse files
committed
vulkan: Call ggml_vk_buffer_write_2d from ggml_vk_buffer_copy
This lets the copy to the destination device use the host-visible vidmem optimization.
1 parent 73a48c9 commit 94e549c

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

ggml/src/ggml-vulkan/ggml-vulkan.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5652,14 +5652,11 @@ static void ggml_vk_buffer_copy(vk_buffer& dst, size_t dst_offset, vk_buffer& sr
56525652
VK_LOG_DEBUG("ggml_vk_buffer_copy(MULTI_DEVICE, " << size << ")");
56535653
// Copy device to device
56545654
ggml_vk_ensure_sync_staging_buffer(src->device, size);
5655-
ggml_vk_ensure_sync_staging_buffer(dst->device, size);
56565655

56575656
// Copy to src staging buffer
56585657
ggml_vk_buffer_copy(src->device->sync_staging, 0, src, src_offset, size);
5659-
// memcpy to dst staging buffer
5660-
memcpy(dst->device->sync_staging->ptr, src->device->sync_staging->ptr, size);
56615658
// Copy to dst buffer
5662-
ggml_vk_buffer_copy(dst, dst_offset, dst->device->sync_staging, 0, size);
5659+
ggml_vk_buffer_write_2d(dst, dst_offset, src->device->sync_staging->ptr, 0, size, 1);
56635660
}
56645661
}
56655662

0 commit comments

Comments
 (0)