Skip to content

Commit d5cabf8

Browse files
authored
Keep attribute when bufferizing scf.forall op (#91236)
1 parent 45fed80 commit d5cabf8

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1267,6 +1267,9 @@ struct ForallOpInterface
12671267
forallOp.getMixedUpperBound(), forallOp.getMixedStep(),
12681268
/*outputs=*/ValueRange(), forallOp.getMapping());
12691269

1270+
// Keep discardable attributes from the original op.
1271+
newForallOp->setDiscardableAttrs(op->getDiscardableAttrDictionary());
1272+
12701273
rewriter.eraseOp(newForallOp.getBody()->getTerminator());
12711274

12721275
// Move over block contents of the old op.

mlir/test/Dialect/SCF/one-shot-bufferize.mlir

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,8 @@ func.func @parallel_insert_slice_no_conflict(
499499
tensor.parallel_insert_slice %8 into %o[5] [%idx] [%c1] :
500500
tensor<?xf32> into tensor<?xf32>
501501
}
502-
}
502+
} {keep_this_attribute}
503+
// CHECK: keep_this_attribute
503504

504505
// CHECK: %[[load:.*]] = memref.load %[[arg2]]
505506
%f = tensor.extract %2[%c0] : tensor<?xf32>

0 commit comments

Comments
 (0)