-
Notifications
You must be signed in to change notification settings - Fork 30
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
[BufferizeToAllocation] Handle pack operands dependent on other op types #972
Conversation
Looks good, minor suggestions in jtuyls#15 One question -- why is the default depth 2, shouldn't it be 1 because the the bufferization in the current pipeline is always on the closest pack op to the matmul? Or maybe there should just be no default. |
Yeah, maybe it's better to set default to |
15aa726
to
3844fc4
Compare
clEnumValN(mlir::iree_compiler::AMDAIE::BufferizeOperand::DefOp, "def-op", | ||
"Create new allocations for operands from the def ops of a linalg op.") | ||
)}]> | ||
clEnumValN(mlir::iree_compiler::AMDAIE::BufferizeOperand::Pack, "pack", |
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 feel pack
may not be a good name for this situation. Maybe we should rename these options to something like "LinalgInput"/"LinalgOutput"/"PackInput"?
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.
Done, renamed it.
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.
Thanks! I see you didn't change the other options. Do you think it's more clear if we change option "Input" to "LinalgInput" and "Output" to "LinalgOutput", etc? This is not critical, so can be addressed in the future if needed.
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.
Yeah, I think that makes sense, but I wanted to avoid convoluting this PR with those changes.
@@ -1,7 +1,7 @@ | |||
// RUN: iree-opt --pass-pipeline='builtin.module(func.func(iree-amdaie-bufferize-to-allocation{memory-space=2 bufferize-operand=input-output}))' --split-input-file %s | FileCheck %s --check-prefix=INPUT-OUTPUT | |||
// RUN: iree-opt --pass-pipeline='builtin.module(func.func(iree-amdaie-bufferize-to-allocation{memory-space=2 bufferize-operand=input}))' --split-input-file %s | FileCheck %s --check-prefix=INPUT | |||
// RUN: iree-opt --pass-pipeline='builtin.module(func.func(iree-amdaie-bufferize-to-allocation{memory-space=2 bufferize-operand=output}))' --split-input-file %s | FileCheck %s --check-prefix=OUTPUT | |||
// RUN: iree-opt --pass-pipeline='builtin.module(func.func(iree-amdaie-bufferize-to-allocation{memory-space=1 bufferize-operand=def-op}))' --split-input-file %s | FileCheck %s --check-prefix=DEF-OP | |||
// RUN: iree-opt --pass-pipeline='builtin.module(func.func(iree-amdaie-bufferize-to-allocation{memory-space=1 bufferize-operand=pack pack-depth=2}))' --split-input-file --verify-diagnostics %s | FileCheck %s --check-prefix=PACK |
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 think you need to add --verify-diagnostics
?
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.
Yeah, initially, I put all test cases in this file, but some fail for some of the runs commands.
if (!currentOp) { | ||
return linalgOp.emitOpError() | ||
<< "operand #" << input.index() << " only has pack ops to depth " | ||
<< currentLevel << ", but request is for a depth " << depthLevel | ||
<< " pack op."; |
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 know if it is easy to add a test for this.
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 think we may keep default as 2, as currently |
That's why I initially had it as |
3844fc4
to
6f66792
Compare
clEnumValN(mlir::iree_compiler::AMDAIE::BufferizeOperand::DefOp, "def-op", | ||
"Create new allocations for operands from the def ops of a linalg op.") | ||
)}]> | ||
clEnumValN(mlir::iree_compiler::AMDAIE::BufferizeOperand::PackInput, "pack", |
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 would change this to pack-input
.
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.
Done
b7cb01d
to
bcfcb4b
Compare
Refactor
getOperandsFromDefOp
to search for and returnpack
ops up to a certain depth away from the linalg op's inputs and rename togetPackOperands
. This enables more complex cases with intermediateextract_slice
operations, see the new test cases being added.