Skip to content

Commit 3685770

Browse files
authored
[HINT] Fix DMA hint propagation (#30)
1 parent 3a86bf2 commit 3685770

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

lib/Conversion/StructuredToMemref/StructuredToMemref.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,11 @@ struct LoadConverter : public OpConversionPattern<tts::LoadOp> {
666666
true /* writable */);
667667
rewriter.replaceOp(op, tensor);
668668
} else {
669-
rewriter.create<memref::CopyOp>(loc, ptr, alloc);
669+
auto copyOp = rewriter.create<memref::CopyOp>(loc, ptr, alloc);
670+
auto strAttr = op->getAttrOfType<mlir::StringAttr>("flagtree_hints");
671+
if (strAttr && !strAttr.getValue().empty()) {
672+
copyOp->setAttr("flagtree_hints", strAttr);
673+
}
670674
}
671675
}
672676

@@ -808,7 +812,12 @@ struct LoadConverter : public OpConversionPattern<tts::LoadOp> {
808812
} else {
809813
memref::SubViewOp dstSubview =
810814
getSubview(tensorType.getRank(), mixedDims, alloc, loc, rewriter);
811-
rewriter.create<memref::CopyOp>(loc, srcSubview, dstSubview);
815+
auto copyOp =
816+
rewriter.create<memref::CopyOp>(loc, srcSubview, dstSubview);
817+
auto strAttr = op->getAttrOfType<mlir::StringAttr>("flagtree_hints");
818+
if (strAttr && !strAttr.getValue().empty()) {
819+
copyOp->setAttr("flagtree_hints", strAttr);
820+
}
812821
}
813822
}
814823
if (cast<MemRefType>(alloc.getType()).getMemorySpaceAsInt() != 8) {

0 commit comments

Comments
 (0)