Skip to content

Commit 9597782

Browse files
0cc4mluciferous
authored andcommitted
Merge 0cc4m/fix-apu
1 parent 08bf455 commit 9597782

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

ggml-vulkan.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,8 @@ static vk_buffer ggml_vk_create_buffer(ggml_backend_vk_context * ctx, size_t siz
754754
}
755755

756756
if (memory_type_index == -1) {
757+
ctx->device.lock()->device.destroyBuffer(buf->buffer);
758+
buf->size = 0;
757759
throw vk::OutOfDeviceMemoryError("No suitable memory type found");
758760
}
759761

@@ -3885,7 +3887,7 @@ static ggml_tensor * ggml_vk_find_last_use(const ggml_tensor * node, ggml_cgraph
38853887

38863888
static void ggml_vk_preallocate_buffers_graph(ggml_backend_vk_context * ctx, ggml_tensor * node){
38873889
#ifdef GGML_VULKAN_DEBUG
3888-
std::cerr << "ggml_ctx->preallocate_buffers_graph(" << node << ")" << std::endl;
3890+
std::cerr << "ggml_vk_preallocate_buffers_graph(" << node << ")" << std::endl;
38893891
#endif
38903892
const bool any_on_device = node->backend == GGML_BACKEND_GPU
38913893
|| (node->src[0] != nullptr && (node->src[0]->backend == GGML_BACKEND_GPU || node->src[0]->backend == GGML_BACKEND_GPU_SPLIT))
@@ -4004,8 +4006,7 @@ static void ggml_vk_preallocate_buffers(ggml_backend_vk_context * ctx) {
40044006
return;
40054007
}
40064008
#ifdef GGML_VULKAN_DEBUG
4007-
std::cerr << "ggml_ctx->preallocate_buffers()" << std::endl;
4008-
std::cerr << "qx_size: " << ctx->prealloc_size_qx << " qy_size: " << ctx->prealloc_size_qy << " x_size: " << ctx->prealloc_size_x << " y_size: " << ctx->prealloc_size_y << " split_k_size: " << ctx->prealloc_size_split_k << std::endl;
4009+
std::cerr << "ggml_vk_preallocate_buffers(qx_size: " << ctx->prealloc_size_qx << " qy_size: " << ctx->prealloc_size_qy << " x_size: " << ctx->prealloc_size_x << " y_size: " << ctx->prealloc_size_y << " split_k_size: " << ctx->prealloc_size_split_k << ")" << std::endl;
40094010
#endif
40104011
#if defined(GGML_VULKAN_RUN_TESTS)
40114012
ctx->staging = ggml_vk_create_buffer_check(ctx, 100ul * 1024ul * 1024ul, vk::MemoryPropertyFlagBits::eHostVisible | vk::MemoryPropertyFlagBits::eHostCoherent, vk::MemoryPropertyFlagBits::eHostCached);

0 commit comments

Comments
 (0)