vulkan: Call ggml_vk_buffer_write_2d from ggml_vk_buffer_copy (#16793)

This lets the copy to the destination device use the host-visible
vidmem optimization.
This commit is contained in:
Jeff Bolz
2025-10-29 03:53:04 -05:00
committed by GitHub
parent 9a3ea685b9
commit f549b0007d

View File

@@ -5652,14 +5652,11 @@ static void ggml_vk_buffer_copy(vk_buffer& dst, size_t dst_offset, vk_buffer& sr
VK_LOG_DEBUG("ggml_vk_buffer_copy(MULTI_DEVICE, " << size << ")");
// Copy device to device
ggml_vk_ensure_sync_staging_buffer(src->device, size);
ggml_vk_ensure_sync_staging_buffer(dst->device, size);
// Copy to src staging buffer
ggml_vk_buffer_copy(src->device->sync_staging, 0, src, src_offset, size);
// memcpy to dst staging buffer
memcpy(dst->device->sync_staging->ptr, src->device->sync_staging->ptr, size);
// Copy to dst buffer
ggml_vk_buffer_copy(dst, dst_offset, dst->device->sync_staging, 0, size);
ggml_vk_buffer_write_2d(dst, dst_offset, src->device->sync_staging->ptr, 0, size, 1);
}
}