Skip to content

Conversation

@jeffbolznv
Copy link
Collaborator

This comes up in qwen3 moe. Worth 1-2% on Qwen3 MoE.

I'd eventually like to generalize this, to be able to handle things like MUL_MAT_ID + ADD_ID + MUL (which comes up in gpt-oss).

@github-actions github-actions bot added testing Everything test related Vulkan Issues specific to the Vulkan backend ggml changes relating to the ggml tensor library for machine learning labels Nov 8, 2025
@0cc4m
Copy link
Collaborator

0cc4m commented Nov 8, 2025

Please fix the conflict.

This comes up in qwen3 moe.
@jeffbolznv
Copy link
Collaborator Author

Rebased.

Comment on lines +3619 to +3624
if (mul) {
std::array<int64_t, 4> ne { 1, out->ne[1], out->ne[2], out->ne[3] };
ne[0] = 1;
ggml_tensor * m = ggml_new_tensor(ctx, out->type, 4, ne.data());
out = ggml_mul(ctx, out, m);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really don't like how we keep making the basic, single op test cases more complex by adding flags to change the behavior completely. Can you move the fusion cases to a different class?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, done.

Copy link
Collaborator

@0cc4m 0cc4m left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@0cc4m 0cc4m merged commit 80a6cf6 into ggml-org:master Nov 9, 2025
71 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ggml changes relating to the ggml tensor library for machine learning testing Everything test related Vulkan Issues specific to the Vulkan backend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants