Vulkan: add GGML_OP_FUSED_MUL_UNARY

This commit is contained in:
Iwan Kawrakow
2025-07-03 18:02:31 +03:00
parent 9534461c01
commit e30c5d9841
6 changed files with 142 additions and 7 deletions

View File

@@ -9688,13 +9688,7 @@ static struct ggml_tensor * llm_build_ffn(
cur = tmp;
}
#ifdef GGML_USE_VULKAN
constexpr bool use_fused_mul_unary = false;
#else
constexpr bool use_fused_mul_unary = true;
#endif
if (use_fused_mul_unary && type_gate == LLM_FFN_PAR &&
if (type_gate == LLM_FFN_PAR &&
(type_op == LLM_FFN_SILU || type_op == LLM_FFN_RELU || (type_op == LLM_FFN_GELU && !act_scales))) {
cur = ggml_fused_mul_unary(ctx, cur, tmp, type_op == LLM_FFN_SILU ? GGML_UNARY_OP_SILU :
type_op == LLM_FFN_RELU ? GGML_UNARY_OP_RELU : GGML_UNARY_OP_GELU);