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

[TKW] Teach expansion to handle non direct acc and ReduceOp on reduction dim. #243

Merged
merged 9 commits into from
Oct 28, 2024

Conversation

raikonenfnu
Copy link
Contributor

In flash attention, we need to enable non direct acc matmul, and also expansion of reduceOp in reduction dimension. The former is needed in FA since we are applying some scaling to the acc of second MMA before feeding it in. The second case is required in FA because ReduceOp/MaxOp is in the backward slice of second MMA's LHS, which would require it to be expanded in K2/reduction dim as well.

Copy link
Contributor

@harsh-nod harsh-nod left a comment

Choose a reason for hiding this comment

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

Overall, looks good! Thanks I like the changes to expansion. Just some comments about documentation .

iree/turbine/kernel/ops/wave_ops.py Outdated Show resolved Hide resolved
iree/turbine/kernel/ops/wave_ops.py Show resolved Hide resolved
iree/turbine/kernel/wave/expansion.py Show resolved Hide resolved
iree/turbine/kernel/wave/expansion.py Show resolved Hide resolved
iree/turbine/kernel/wave/expansion.py Outdated Show resolved Hide resolved
iree/turbine/kernel/wave/expansion.py Show resolved Hide resolved
iree/turbine/kernel/wave/expansion.py Outdated Show resolved Hide resolved
fixes on the equal is required sometimes it's not equal if we do not do
this manual check of shape and type

Signed-off-by: Stanley Winata <[email protected]>
Signed-off-by: Stanley Winata <[email protected]>
@harsh-nod harsh-nod self-requested a review October 28, 2024 19:41
Copy link
Contributor

@harsh-nod harsh-nod left a comment

Choose a reason for hiding this comment

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

overall looks good and we can address the open questions later. Thanks!

@raikonenfnu raikonenfnu merged commit ddc8dbd into iree-org:main Oct 28, 2024
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants