Skip to content

Commit 78c0d5e

Browse files
committed
vulkan: optimize UMA buffer operations and fix driver hangs
The previous implementation was blocking the GPU for extended periods, causing the i915 driver to reset the context due to the hangcheck protection. [32628.443070] i915 0000:00:02.0: [drm] GPU HANG: ecode 12:1:85dffffb, in llama-server [194114] [32628.443091] i915 0000:00:02.0: [drm] llama-server[194114] context reset due to GPU hang Signed-off-by: Giuseppe Scrivano <[email protected]>
1 parent d304f45 commit 78c0d5e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5534,6 +5534,12 @@ static void ggml_vk_buffer_memset_async(vk_context& ctx, vk_buffer& dst, size_t
55345534
static void ggml_vk_buffer_memset(vk_buffer& dst, size_t offset, uint32_t c, size_t size) {
55355535
VK_LOG_DEBUG("ggml_vk_buffer_memset(" << offset << ", " << c << ", " << size << ")");
55365536

5537+
if (dst->memory_property_flags & vk::MemoryPropertyFlagBits::eHostVisible &&
5538+
dst->device->uma) {
5539+
memset((uint8_t*)dst->ptr + offset, c, size);
5540+
return;
5541+
}
5542+
55375543
std::lock_guard<std::recursive_mutex> guard(dst->device->mutex);
55385544
vk_context subctx = ggml_vk_create_temporary_context(dst->device->transfer_queue.cmd_pool);
55395545
ggml_vk_ctx_begin(dst->device, subctx);

0 commit comments

Comments
 (0)