Repair GGML_VULKAN_CHECK_RESULTS
This commit is contained in:
parent
2812b35ce4
commit
2b2bc1ff8b
1 changed files with 13 additions and 11 deletions
|
@ -5931,10 +5931,6 @@ static bool ggml_vk_compute_forward(ggml_backend_vk_context * ctx, ggml_tensor *
|
||||||
|
|
||||||
VK_LOG_DEBUG("ggml_vk_compute_forward(" << tensor << ", name=" << tensor->name << ", op=" << ggml_op_name(tensor->op) << ", type=" << tensor->type << ", ne0=" << tensor->ne[0] << ", ne1=" << tensor->ne[1] << ", ne2=" << tensor->ne[2] << ", ne3=" << tensor->ne[3] << ", nb0=" << tensor->nb[0] << ", nb1=" << tensor->nb[1] << ", nb2=" << tensor->nb[2] << ", nb3=" << tensor->nb[3] << ", view_src=" << tensor->view_src << ", view_offs=" << tensor->view_offs << ")");
|
VK_LOG_DEBUG("ggml_vk_compute_forward(" << tensor << ", name=" << tensor->name << ", op=" << ggml_op_name(tensor->op) << ", type=" << tensor->type << ", ne0=" << tensor->ne[0] << ", ne1=" << tensor->ne[1] << ", ne2=" << tensor->ne[2] << ", ne3=" << tensor->ne[3] << ", nb0=" << tensor->nb[0] << ", nb1=" << tensor->nb[1] << ", nb2=" << tensor->nb[2] << ", nb3=" << tensor->nb[3] << ", view_src=" << tensor->view_src << ", view_offs=" << tensor->view_offs << ")");
|
||||||
|
|
||||||
#ifdef GGML_VULKAN_CHECK_RESULTS
|
|
||||||
ggml_vk_check_results_0(tensor);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
vk_context subctx = ctx->tensor_ctxs[tensor_idx].lock();
|
vk_context subctx = ctx->tensor_ctxs[tensor_idx].lock();
|
||||||
|
|
||||||
// always wait for the GPU work to be done for the last submit
|
// always wait for the GPU work to be done for the last submit
|
||||||
|
@ -5942,22 +5938,28 @@ static bool ggml_vk_compute_forward(ggml_backend_vk_context * ctx, ggml_tensor *
|
||||||
use_fence = true;
|
use_fence = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
vk::Fence fence = use_fence ? ctx->fence : vk::Fence{};
|
|
||||||
|
|
||||||
// Only run if ctx hasn't been submitted yet
|
// Only run if ctx hasn't been submitted yet
|
||||||
if (!subctx->seqs.empty()) {
|
if (!subctx->seqs.empty()) {
|
||||||
|
#ifdef GGML_VULKAN_CHECK_RESULTS
|
||||||
|
ggml_vk_check_results_0(tensor);
|
||||||
|
use_fence = true;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Do staging buffer copies
|
// Do staging buffer copies
|
||||||
for (auto& cpy : subctx->in_memcpys) {
|
for (auto& cpy : subctx->in_memcpys) {
|
||||||
memcpy(cpy.dst, cpy.src, cpy.n);
|
memcpy(cpy.dst, cpy.src, cpy.n);
|
||||||
}
|
}
|
||||||
|
|
||||||
ggml_vk_submit(subctx, fence);
|
ggml_vk_submit(subctx, use_fence ? ctx->fence : vk::Fence{});
|
||||||
}
|
|
||||||
|
|
||||||
if (use_fence) {
|
if (use_fence) {
|
||||||
VK_CHECK(ctx->device->device.waitForFences({ ctx->fence }, true, UINT64_MAX), "ggml_vk_compute_forward waitForFences");
|
VK_CHECK(ctx->device->device.waitForFences({ ctx->fence }, true, UINT64_MAX), "ggml_vk_compute_forward waitForFences");
|
||||||
|
|
||||||
ctx->device->device.resetFences({ ctx->fence });
|
ctx->device->device.resetFences({ ctx->fence });
|
||||||
|
}
|
||||||
|
#ifdef GGML_VULKAN_CHECK_RESULTS
|
||||||
|
ggml_vk_check_results_1(tensor);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tensor_idx == subctx->exit_tensor_idx) {
|
if (tensor_idx == subctx->exit_tensor_idx) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue