Skip to content

[mlir][ArmSME][NFC] Check early for unsupported mask ops #135955

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions mlir/lib/Conversion/ArmSMEToSCF/ArmSMEToSCF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,6 @@ FailureOr<scf::ForOp> createLoadStoreForOverTileSlices(
Value upperBound;
if (mask) {
auto createMaskOp = mask.getDefiningOp<vector::CreateMaskOp>();
if (!createMaskOp)
return rewriter.notifyMatchFailure(
loc, "unsupported mask op, only 'vector.create_mask' is "
"currently supported");

auto maskDim0 = createMaskOp.getOperands()[0];
auto maskDim1 = createMaskOp.getOperands()[1];

Expand Down Expand Up @@ -184,6 +179,10 @@ struct TileLoadOpConversion : public OpRewritePattern<arm_sme::TileLoadOp> {

Value initTile;
if (mask) {
if (!mask.getDefiningOp<vector::CreateMaskOp>())
return rewriter.notifyMatchFailure(
loc, "unsupported mask op, only 'vector.create_mask' is "
"currently supported");
auto padOp = tileLoadOp.getPadding();
assert(padOp && "expected padding when masking!");

Expand Down Expand Up @@ -373,6 +372,14 @@ struct TileStoreOpConversion : public OpRewritePattern<arm_sme::TileStoreOp> {

LogicalResult matchAndRewrite(arm_sme::TileStoreOp tileStoreOp,
PatternRewriter &rewriter) const override {
if (Value mask = tileStoreOp.getMask()) {
if (!mask.getDefiningOp<vector::CreateMaskOp>())
return rewriter.notifyMatchFailure(
tileStoreOp.getLoc(),
"unsupported mask op, only 'vector.create_mask' is "
"currently supported");
}

// Create a loop that stores each active ZA tile slice from memory.
return createLoadStoreForOverTileSlices(
rewriter, tileStoreOp.getLoc(), tileStoreOp.getVectorType(),
Expand Down
Loading