From e3a72538111219a78d2b98a9b6f074bb4d2e7cd7 Mon Sep 17 00:00:00 2001 From: erwei-xilinx Date: Fri, 1 Nov 2024 12:01:23 +0800 Subject: [PATCH] Populate default wraps, if wraps list is empty (#757) --- mlir/lib/Transform/AIRMiscPasses.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/mlir/lib/Transform/AIRMiscPasses.cpp b/mlir/lib/Transform/AIRMiscPasses.cpp index c7507045d..1742e1f7d 100644 --- a/mlir/lib/Transform/AIRMiscPasses.cpp +++ b/mlir/lib/Transform/AIRMiscPasses.cpp @@ -1550,7 +1550,13 @@ void AIRSplitL2MemrefForBufferConstraintPass::runOnOperation() { // Account for cases where rank reduction results from at least // of the dimensions being equal to one. - auto wraps = theOtherChanOp[0].getSizes(); + SmallVector wraps = theOtherChanOp[0].getSizes(); + if (wraps.empty()) { + // Populate default wraps, if wraps is an empty vector. + SmallVector offsets, strides; + air::populateDefaultWrapsAndStrides( + builder, theOtherChanOp[0].getMemref(), offsets, wraps, strides); + } auto adjustedDimIdx = dim; if (wraps.size() != memrefShape.size()) { // Make sure that the number of rank-reducing dimensions and/or @@ -1613,6 +1619,13 @@ void AIRSplitL2MemrefForBufferConstraintPass::runOnOperation() { } } + if (adjustedDimIdx >= (int)wraps.size()) { + theOtherChanOp[0]->emitOpError( + "Failed to split data access pattern due to air.channel op " + "having mismatching wraps rank."); + return; + } + Value newWaitAll1 = tileChannelOpByFactor(theOtherChanOp[0], targetColTilingFactor, *getConstantIntValue(wraps[adjustedDimIdx]),