Skip to content

Commit

Permalink
Convert barriers into copies during allocation (#19735)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rsuderman authored Jan 18, 2025
1 parent 6052a1d commit be8e3d2
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,17 @@ applyAsyncCollectiveOp(IREE::Stream::AsyncCollectiveOp asyncOp,
static LogicalResult applyAsyncBarrierOp(IREE::Stream::AsyncBarrierOp barrierOp,
AllocationScope &scope,
OpBuilder builder) {
// TODO: barriers are being treated as copies, they should just be metadata
// operations but currently it's causing failures to be removed.
auto sourceRange = scope.lookupResourceRange(barrierOp.getSource());
auto targetRange = scope.lookupResourceRange(barrierOp.getResult());

// Perform the copy.
builder.create<IREE::Stream::CmdCopyOp>(
barrierOp.getLoc(), sourceRange.resource, sourceRange.resourceSize,
sourceRange.offset, targetRange.resource, targetRange.resourceSize,
targetRange.offset, sourceRange.length);

barrierOp.erase();
return success();
}
Expand Down

0 comments on commit be8e3d2

Please sign in to comment.