[Mlir-commits] [mlir] [mlir][linalg] Add more precise memory effects to linalg op (PR #92079)
Oleksandr Alex Zinenko
llvmlistbot at llvm.org
Fri May 17 04:52:26 PDT 2024
================
@@ -1103,29 +1103,35 @@ ParseResult GenericOp::parse(OpAsmParser &parser, OperationState &result) {
static void getGenericEffectsImpl(
SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>>
&effects,
- ValueRange results, const ValueRange inputOperands,
- ValueRange outputOperands) {
- for (auto operand : inputOperands) {
+ LinalgOp linalgOp) {
+ SmallVector<Value> inputOperands = linalgOp.getDpsInputs();
+ for (auto [index, operand] : llvm::enumerate(inputOperands)) {
if (!llvm::isa<MemRefType>(operand.getType()))
continue;
- effects.emplace_back(MemoryEffects::Read::get(), operand,
- SideEffects::DefaultResource::get());
+ if (linalgOp.payloadUsesValueFromOperand(&linalgOp->getOpOperand(index))) {
+ effects.emplace_back(MemoryEffects::Read::get(), operand, 0, true,
----------------
ftynse wrote:
Nit: please use this style `/*argumentName=*/value` so `0` and `true` don't appear as magic constants here.
https://github.com/llvm/llvm-project/pull/92079
More information about the Mlir-commits
mailing list