Skip to content

Commit 1ce5c7b

Browse files
committed
Check for invalid tile allocations
1 parent 6df97ad commit 1ce5c7b

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

mlir/lib/Dialect/ArmSME/Transforms/TileAllocation.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,13 @@ struct AssignTileIDsPattern
243243
auto tileIDAttr = rewriter.getI32IntegerAttr(*tileId);
244244
tileOp.setTileId(tileIDAttr);
245245
for (auto *op : dependantOps) {
246-
if (auto tileOp = llvm::dyn_cast<ArmSMETileOpInterface>(op))
246+
if (auto tileOp = llvm::dyn_cast<ArmSMETileOpInterface>(op)) {
247+
auto currentTileId = tileOp.getTileId();
248+
if (currentTileId && unsigned(currentTileId.getInt()) != tileId)
249+
return tileOp.emitOpError(
250+
"already assigned different SME virtual tile!");
247251
tileOp.setTileId(tileIDAttr);
252+
}
248253
}
249254

250255
return success();
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// RUN: mlir-opt %s -allocate-arm-sme-tiles -split-input-file -verify-diagnostics
2+
3+
// -----
4+
5+
func.func @selecting_between_different_tiles_is_unsupported(%dest : memref<?x?xi32>, %cond: i1) {
6+
%c0 = arith.constant 0 : index
7+
%tileA = arm_sme.get_tile : vector<[4]x[4]xi32>
8+
%tileB = arm_sme.get_tile : vector<[4]x[4]xi32>
9+
// Select between tileA and tileB. This is currently unsupported as it would
10+
// require inserting tile move operations during tile allocation.
11+
%tile = scf.if %cond -> vector<[4]x[4]xi32> {
12+
scf.yield %tileA : vector<[4]x[4]xi32>
13+
} else {
14+
scf.yield %tileB : vector<[4]x[4]xi32>
15+
}
16+
// expected-error@+1 {{op already assigned different SME virtual tile!}}
17+
arm_sme.tile_store %tile, %dest[%c0, %c0] : memref<?x?xi32>, vector<[4]x[4]xi32>
18+
return
19+
}

0 commit comments

Comments
 (0)