Skip to content

Commit

Permalink
Remove redundant copy
Browse files Browse the repository at this point in the history
  • Loading branch information
yzhang93 committed Dec 7, 2024
1 parent 168414b commit e102fe7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,17 @@ MemRefType getDistributedType(memref::AllocOp alloc,
// Check that all offsets are either constants or thread ids. We assume
// that if a subview has an offset which is not a constant and not a
// thread id, it's not 'distributing'.
Operation::operand_range offsets = subview.getOffsets();
int nIndVars{0};
for (Value offset : offsets) {
bool isConst = matchPattern(offset, m_Constant());
bool isIndVar = llvm::is_contained(indVars, offset);
nIndVars += isIndVar;
if (!isConst && !isIndVar) return {};
}

// If there are no thread ids, this subview is not distributing.
if (nIndVars == 0) return {};
// Operation::operand_range offsets = subview.getOffsets();
// int nIndVars{0};
// for (Value offset : offsets) {
// bool isConst = matchPattern(offset, m_Constant());
// bool isIndVar = llvm::is_contained(indVars, offset);
// nIndVars += isIndVar;
// if (!isConst && !isIndVar) return {};
// }
//
// // If there are no thread ids, this subview is not distributing.
// if (nIndVars == 0) return {};

auto nextType = cast<MemRefType>(subview.getResult().getType());
if (!type) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ static LogicalResult aieComprehensiveBufferizeCopyFn(OpBuilder &builder,
// post-bufferization copies do not trigger properly.
// So we keep using `createLinalgCopyOp` which builds a GenericOp.
// builder.create<linalg::CopyOp>(loc, from, to);
// mlir::iree_compiler::createLinalgCopyOp(builder, loc, from, to);
mlir::iree_compiler::createLinalgCopyOp(builder, loc, from, to);
return success();
}

Expand Down Expand Up @@ -182,14 +182,14 @@ void addPackPeelBasedPassPipeline(OpPassManager &funcPassManager,
funcPassManager.addPass(createCanonicalizerPass());
funcPassManager.addPass(createCSEPass());

// Promote the matmul output to local memory
{
AMDAIEBufferizeToAllocationOptions bufferizeOptions;
bufferizeOptions.memorySpace = 2;
bufferizeOptions.bufferizeOperand = BufferizeOperand::Output;
funcPassManager.addPass(
createAMDAIEBufferizeToAllocationPass(bufferizeOptions));
}
// // Promote the matmul output to local memory
// {
// AMDAIEBufferizeToAllocationOptions bufferizeOptions;
// bufferizeOptions.memorySpace = 2;
// bufferizeOptions.bufferizeOperand = BufferizeOperand::Output;
// funcPassManager.addPass(
// createAMDAIEBufferizeToAllocationPass(bufferizeOptions));
// }

{
AMDAIETileAndFuseOptions tileFuseOptions;
Expand Down

0 comments on commit e102fe7

Please sign in to comment.