Removing affinity from stream.timepoint.await.
diff --git a/compiler/src/iree/compiler/Dialect/Stream/IR/StreamOpFolders.cpp b/compiler/src/iree/compiler/Dialect/Stream/IR/StreamOpFolders.cpp index 24d939a..84cf1eb 100644 --- a/compiler/src/iree/compiler/Dialect/Stream/IR/StreamOpFolders.cpp +++ b/compiler/src/iree/compiler/Dialect/Stream/IR/StreamOpFolders.cpp
@@ -3263,16 +3263,8 @@ if (dominanceInfo.dominates(use.getOwner(), op)) continue; auto awaitOp = dyn_cast<TimepointAwaitOp>(use.getOwner()); - if (!awaitOp || - !AffinityAttr::areCompatible( - llvm::dyn_cast_if_present<AffinityAttr>(op.getAffinityAttr()), - llvm::dyn_cast_if_present<AffinityAttr>( - awaitOp.getAffinityAttr()))) { - // Can't combine if the affinities differ as the wait semantics are - // load-bearing. Probably. They really shouldn't be. - // TODO(benvanik): remove affinity from stream.timepoint.await. + if (!awaitOp) continue; - } // Ensure all dependencies of the await op are available. if (!areAllOperandsDefinedBy(awaitOp, op, dominanceInfo)) { // One or more operands is defined after op so we can't merge. @@ -3299,9 +3291,6 @@ } auto newOp = rewriter.create<TimepointAwaitOp>( op.getLoc(), newOperands, newOperandSizes, op.getAwaitTimepoint()); - if (op.getAffinity().has_value()) { - newOp.setAffinityAttr(op.getAffinityAttr()); - } // Replace covered ops with the new results. unsigned resultIdx = 0; @@ -3349,9 +3338,6 @@ // Create replacement op with deduped operands/results. auto newOp = rewriter.create<IREE::Stream::TimepointAwaitOp>( op.getLoc(), newOperands, newOperandSizes, op.getAwaitTimepoint()); - if (op.getAffinity().has_value()) { - newOp.setAffinityAttr(op.getAffinityAttr()); - } // Replace all duplicate results with the base results. for (auto &replacement : replacements) {
diff --git a/compiler/src/iree/compiler/Dialect/Stream/IR/StreamOps.td b/compiler/src/iree/compiler/Dialect/Stream/IR/StreamOps.td index cb36271..99e793a 100644 --- a/compiler/src/iree/compiler/Dialect/Stream/IR/StreamOps.td +++ b/compiler/src/iree/compiler/Dialect/Stream/IR/StreamOps.td
@@ -3753,7 +3753,6 @@ def Stream_TimepointAwaitOp : Stream_PureOp<"timepoint.await", [ AttrSizedOperandSegments, - Stream_AffinityOp, Stream_TimelineOp, Util_SizeAwareOp, DeclareOpInterfaceMethods<Util_TiedOpInterface, [ @@ -3777,8 +3776,7 @@ Stream_StagingResource, ]>>:$resource_operands, Variadic<Stream_Size>:$resource_operand_sizes, - Stream_Timepoint:$await_timepoint, - OptionalAttr<Stream_AffinityAttr>:$affinity + Stream_Timepoint:$await_timepoint ); let results = (outs Variadic<AnyTypeOf<[ @@ -3788,7 +3786,6 @@ ); let assemblyFormat = [{ - (`on` `(` $affinity^ `)`)? $await_timepoint `=` `` `>` $resource_operands `:` custom<ShapedTypeList>(type($resource_operands),
diff --git a/compiler/src/iree/compiler/Dialect/Stream/Transforms/ScheduleExecution.cpp b/compiler/src/iree/compiler/Dialect/Stream/Transforms/ScheduleExecution.cpp index f8278ff..9c5e3d4 100644 --- a/compiler/src/iree/compiler/Dialect/Stream/Transforms/ScheduleExecution.cpp +++ b/compiler/src/iree/compiler/Dialect/Stream/Transforms/ScheduleExecution.cpp
@@ -275,9 +275,6 @@ auto awaitOp = builder.create<IREE::Stream::TimepointAwaitOp>( executeOp.getLoc(), newResult, newResultSize, executeOp.getResultTimepoint()); - if (executeOp.getAffinity().has_value()) { - awaitOp.setAffinityAttr(executeOp.getAffinityAttr()); - } // Explicitly copy the Value since it is marked as const. Value toBeDeleted = oldResult;
diff --git a/compiler/src/iree/compiler/Dialect/Stream/Transforms/test/schedule_execution.mlir b/compiler/src/iree/compiler/Dialect/Stream/Transforms/test/schedule_execution.mlir index 0f33b51..dcdc586 100644 --- a/compiler/src/iree/compiler/Dialect/Stream/Transforms/test/schedule_execution.mlir +++ b/compiler/src/iree/compiler/Dialect/Stream/Transforms/test/schedule_execution.mlir
@@ -75,7 +75,6 @@ // CHECK-NEXT: } => !stream.timepoint // CHECK-NEXT: %[[READY:.+]] = stream.timepoint.await - // CHECK-SAME: on(#hal.device.affinity<@device_b>) // CHECK-SAME: %[[TIMEPOINT1]] => %[[RESULT]] : !stream.resource<external>{%c20} // CHECK-NEXT: util.return %[[READY]] util.return %dispatch2 : !stream.resource<external> @@ -133,7 +132,6 @@ // CHECK-NEXT: } => !stream.timepoint // CHECK-NEXT: %[[READY:.+]] = stream.timepoint.await - // CHECK-SAME: on(#hal.device.affinity<@device_c>) // CHECK-SAME: %[[TIMEPOINT2]] => %[[RESULT]] : !stream.resource<external>{%c20} // CHECK-NEXT: util.return %[[READY]] util.return %dispatch2 : !stream.resource<external>