-
Notifications
You must be signed in to change notification settings - Fork 51
[0035] Add missing SumAccumulate OpCode #690
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
base: main
Are you sure you want to change the base?
Conversation
| Three opcodes are available for this operation class: | ||
| * Matrix Matrix Multiply: `C = A * B` | ||
| * Matrix Matrix Multiply with Accumulation: `C += A * B` | ||
| * Matrix Matrix Addition with Accumulation: `C += A + B` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I look up for the operation class, I see it would be OpCodeClass::MatrixOp.
Isn't "MatrixOp" a little too generic? The operation is limited to accepting three matrix operands, where it overwrites or accumulates into the first one. On that note, I think the operation class should be all you need to know to reason about the type of memory accesses for each matrix, but they are different for multiply vs. multiply or add with accumulate.
I think I'd split this into MatrixBinaryOp and MatrixBinaryAccumulateOp.
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have any issues with that, but @llvm-beanz should confirm. Chris do you have any thoughts here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you mentioned that you aren't blocking this PR I'll go ahead and merge as is but would love to keep the conversation going about the details here!
Further thoughts after chatting a bit with Chris:
Regardless of if we split these up or not they'll actually both end up with the same memory access annotations. MatrixBinaryOp would be readwrite* (read from A,B, write to C) and MatrixBinaryAccumulateOp would be readwrite* (read from A,B,C, write to C).
Also if we do split them, MatrixBinaryAccumulateOp should be called something like MatrixTernaryOp because its actually more of shape C' = A * B + C
*: I use readwrite but iirc the actual annotation is none/the empty string which implies readwrite
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should clarify that my approval of this change isn't dependent on resolution of my comment about OpCodeClass::MatrixOp.
dx.op.matrixOpwas missing an opcode for Matrix Matrix Addition with Accumulation needed forMatrix::SumAccumulate.This PR adds it to the spec