Skip to content

Commit a43d893

Browse files
authored
[Dispatch] Disable scatter fusion with producers (#19565)
Backends don't currently support scatter fusion and will silently compile incorrect code. This should be turned off in order to prevent backends from generating incorrect results. I don't think any users are running into this currently, but its best to keep it off for now. Similar to #19535 but for both `indices` and `updates`. --------- Signed-off-by: Ian Wood <[email protected]>
1 parent d746a57 commit a43d893

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

compiler/src/iree/compiler/DispatchCreation/FormDispatchRegions.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,8 @@ isFusableWithProducer(OpOperand &operand,
651651
}
652652

653653
// Don't fuse attention with it's producer
654-
if (isa<IREE::LinalgExt::AttentionOp>(consumer)) {
654+
// TODO: Enable scatter fusion when supported by backends.
655+
if (isa<IREE::LinalgExt::AttentionOp, IREE::LinalgExt::ScatterOp>(consumer)) {
655656
return false;
656657
}
657658

compiler/src/iree/compiler/DispatchCreation/test/dispatch_linalg_ext_fusion.mlir

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ util.func public @linalgext_scatter_dispatch() -> tensor<8192x16x8x128xf32> {
3737
}
3838

3939
// CHECK-LABEL: util.func public @linalgext_scatter_dispatch
40+
// CHECK-DAG: %[[INDICES:.+]] = flow.dispatch.region
41+
// CHECK-DAG: %[[UPDATE:.+]] = flow.dispatch.region
4042
// CHECK: %[[RESULT:.+]] = flow.dispatch.region
41-
// CHECK: %[[INDICES:.+]] = linalg.generic
42-
// CHECK: %[[UPDATE:.+]] = linalg.generic
4343
// CHECK: %[[SCATTER_RESULT:.+]] = iree_linalg_ext.scatter
4444
// CHECK-SAME: ins(%[[UPDATE]], %[[INDICES]] : tensor<4x1x16x8x128xf32>, tensor<4x1xi32>)
4545
// CHECK: flow.return %[[SCATTER_RESULT]]

0 commit comments

Comments
 (0)