Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

graph, example, benchdnn: add int4 gated mlp #2252

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

TaoLv
Copy link
Contributor

@TaoLv TaoLv commented Dec 12, 2024

  1. Define Gated MLP patterns with int4 compressed weights.
  2. Add the example and benchdnn test file accordingly.

@TaoLv TaoLv requested review from a team as code owners December 12, 2024 07:38
Comment on lines +134 to +137
pm::pb_op_t *deq_up = pgraph->append_op(
graph::op_kind::DynamicDequantize);
pm::pb_op_t *deq_gate = pgraph->append_op(
graph::op_kind::DynamicDequantize);
Copy link
Contributor

Choose a reason for hiding this comment

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

Should those be restricted to that same in_edge?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi Mourad, the dequantize ops here are for weights which are different for the two matmul ops (up and gate). But I guess you meant the src should be same for the two matmul ops. Currently, the pattern and the primitive based implementation support different src inputs for the two matmul ops. Do you think we'd better add a restriction for that?

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks Tao. Yes I meant the src. IIRC, the gated MLP pattern always have shared src, correct?
I guess the question is hence the actual pattern definition: if optimizations can leverage that src is shared by both matmul (e.g. by keeping reordered buffer in SLM on GPU), it would be safer to define the pattern as such IMHO (and reflect that in tests as well).

@TaoLv
Copy link
Contributor Author

TaoLv commented Dec 13, 2024

make test
enable benchdnn_nightly
disable benchdnn_all
enable benchdnn_graph

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants