[xegpu] Generalize fused attention schedule for KernelBench - #272
Open
tkarna wants to merge 4 commits into
Open
Conversation
Contributor
Author
|
Ping @charithaintc |
There was a problem hiding this comment.
Pull request overview
This PR updates the xegpu fused-attention transform schedule and transform_ext utilities to more flexibly match attention patterns (including KernelBench ScaledAttention), while fixing producer-tracing handle duplication and adding a new contraction-op filtering transform.
Changes:
- Generalize
fused_attention_scheduleop matching by convertinglinalg.mul/linalg.batch_matmultolinalg.genericand using a new contraction filter to identify matmul-like ops. - Fix
trace_producersde-duplication logic so the producer chain doesn’t return repeated handles. - Add
filter_contraction_opstransform_ext op to identify contraction ops (named or generic) via indexing-map structure, and export it viatransform_ext/__init__.py.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| lighthouse/schedule/xegpu/fused_attention_schedule.py | Generalizes matching and rewires Q/K/V/scale handle discovery using contraction filtering + producer tracing. |
| lighthouse/dialects/transform/transform_ext/ops/trace_producers.py | Adjusts visited tracking to prevent duplicated producer handles. |
| lighthouse/dialects/transform/transform_ext/ops/filter_contraction_ops.py | Introduces new transform op to filter contraction (matmul-like) ops, including structural detection for linalg.generic. |
| lighthouse/dialects/transform/transform_ext/init.py | Exports the new filter_contraction_ops helper from transform_ext. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fused_attention_scheduleso that it also applies to KernelBench level1 97 ScaledAttention kernel.trace_producerstrasform ext op.filter_contraction_opstransform ext op to match batch_matmul with optionally fused elementwise ops.