Skip to content

Commit f50ca97

Browse files
committed
Add constraints
1 parent c97619f commit f50ca97

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

compiler/plugins/target/AMD-AIE/iree-amd-aie/Transforms/KernelDispatch.cpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -815,11 +815,19 @@ static LogicalResult setRootConfigForSoftmaxCopyPipeline(
815815
mlir::FunctionOpInterface entryPointFn, linalg::SoftmaxOp softmaxOp,
816816
AMDAIEDevice targetDevice, uint32_t numRows, uint32_t numCols,
817817
std::string enableAMDAIEUkernels) {
818-
// For now, we are targeting a single column of cores, and the tile sizes are
819-
// hardcoded. We don't tile the reduction dim as the softmax op is not a pure
820-
// reduction op.
818+
// For now, we are targeting a single column of cores, and the L1 tile sizes
819+
// are hardcoded. We don't tile the reduction dim as the softmax op is not a
820+
// pure reduction op.
821+
ArrayRef<int64_t> inputShape = softmaxOp.getInput().getType().getShape();
822+
int64_t m1Tile = std::min<int64_t>(inputShape[0], 32);
823+
int64_t m0Tile = std::min<int64_t>(inputShape[0], numRows * m1Tile);
824+
825+
SmallVector<int64_t> tileSizeLevel0 = {m0Tile, 0};
826+
SmallVector<int64_t> tileSizeLevel1 = {m1Tile, 0};
827+
SmallVector<int64_t> tileSizeLevel2 = {0, 0};
821828
if (failed(setOpConfigAndEntryPointFnTranslation(
822-
entryPointFn, softmaxOp, TileSizesListType{{128, 0}, {32, 0}, {0, 0}},
829+
entryPointFn, softmaxOp,
830+
TileSizesListType{tileSizeLevel0, tileSizeLevel1, tileSizeLevel2},
823831
IREE::Codegen::DispatchLoweringPassPipeline::Custom))) {
824832
return failure();
825833
}

0 commit comments

Comments
 (0)