Skip to content

Commit be8e3d2

Browse files
authored
Convert barriers into copies during allocation (iree-org#19735)
Content aliasing of barriers appears to be causing numerical issues. This operation should just be removed safely however that appears to be causing downstream issues. Swapping to a copy makes them go away however this should be aliasable in the future.
1 parent 6052a1d commit be8e3d2

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

compiler/src/iree/compiler/Dialect/Stream/Transforms/ScheduleAllocation.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,17 @@ applyAsyncCollectiveOp(IREE::Stream::AsyncCollectiveOp asyncOp,
668668
static LogicalResult applyAsyncBarrierOp(IREE::Stream::AsyncBarrierOp barrierOp,
669669
AllocationScope &scope,
670670
OpBuilder builder) {
671+
// TODO: barriers are being treated as copies, they should just be metadata
672+
// operations but currently it's causing failures to be removed.
673+
auto sourceRange = scope.lookupResourceRange(barrierOp.getSource());
674+
auto targetRange = scope.lookupResourceRange(barrierOp.getResult());
675+
676+
// Perform the copy.
677+
builder.create<IREE::Stream::CmdCopyOp>(
678+
barrierOp.getLoc(), sourceRange.resource, sourceRange.resourceSize,
679+
sourceRange.offset, targetRange.resource, targetRange.resourceSize,
680+
targetRange.offset, sourceRange.length);
681+
671682
barrierOp.erase();
672683
return success();
673684
}

0 commit comments

Comments
 (0)