Skip to content

Commit d283dbc

Browse files
committed
vulkan: change an assertion
src1 can go down the first pipeline as nullptr and src0 only needs to be checked once this means the assertion is only required to check if the type is GGML_TYPE_F16 and can usually be skipped
1 parent dd3a6ce commit d283dbc

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3929,13 +3929,14 @@ static vk_pipeline ggml_vk_op_get_pipeline(ggml_backend_vk_context * ctx, const
39293929
}
39303930
return nullptr;
39313931
case GGML_OP_SOFT_MAX:
3932-
GGML_ASSERT(!src1 || src1->type == GGML_TYPE_F32 || src1->type == GGML_TYPE_F16);
3933-
3934-
if (src0->type == GGML_TYPE_F32 && (src1 == nullptr || src1->type == GGML_TYPE_F32) && dst->type == GGML_TYPE_F32) {
3935-
return ctx->device->pipeline_soft_max_f32;
3936-
}
3937-
if (src0->type == GGML_TYPE_F32 && src1->type == GGML_TYPE_F16 && dst->type == GGML_TYPE_F32) {
3938-
return ctx->device->pipeline_soft_max_f32_f16;
3932+
if (src0->type == GGML_TYPE_F32 && dst->type == GGML_TYPE_F32) {
3933+
if (src1 == nullptr || src1->type == GGML_TYPE_F32) {
3934+
return ctx->device->pipeline_soft_max_f32;
3935+
}
3936+
else {
3937+
GGML_ASSERT(src1->type == GGML_TYPE_F16);
3938+
return ctx->device->pipeline_soft_max_f32_f16;
3939+
}
39393940
}
39403941
return nullptr;
39413942
case GGML_OP_ROPE:

0 commit comments

Comments
 (0)