Skip to content

Commit 5693b85

Browse files
jeffbolznvggerganov
authored andcommitted
vulkan: skip empty set_rows to avoid invalid API usage (llama/14860)
1 parent b275e52 commit 5693b85

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7882,6 +7882,13 @@ static void ggml_vk_set_rows(ggml_backend_vk_context * ctx, vk_context& subctx,
78827882
const uint32_t src1_type_size = ggml_type_size(src1->type);
78837883
const uint32_t dst_type_size = ggml_type_size(dst->type);
78847884

7885+
// Skip empty skip_rows operations. For most ops the empty check at the start
7886+
// of ggml_vk_build_graph is sufficient, but set_rows can have a nonempty dst
7887+
// with empty srcs.
7888+
if (ggml_is_empty(src0) || ggml_is_empty(src1)) {
7889+
return;
7890+
}
7891+
78857892
ggml_vk_op_f32<vk_op_binary_push_constants>(ctx, subctx, src0, src1, nullptr, dst, GGML_OP_SET_ROWS, {
78867893
(uint32_t)ggml_nelements(src0),
78877894
(uint32_t)src0->ne[0], (uint32_t)src0->ne[1], (uint32_t)src0->ne[2],(uint32_t)src0->ne[3], (uint32_t)src0->nb[0] / src0_type_size, (uint32_t)src0->nb[1] / src0_type_size, (uint32_t)src0->nb[2] / src0_type_size, (uint32_t)src0->nb[3] / src0_type_size,

0 commit comments

Comments
 (0)