Skip to content

Commit 8aeb104

Browse files
authored
[mlir][SME] Update E2E test to show optional loop optimisation (NFC) (#107585)
Introduces loop hoisting to ARM SME E2E tests to allow the hoisting of the tile load offering very important speedup. Discussed here : https://discourse.llvm.org/t/mlir-for-arm-sme-reducing-tile-data-transfers/80065/2
1 parent 7574042 commit 8aeb104

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/matmul-transpose-a.mlir

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,16 @@ module attributes {transform.with_named_sequence} {
8282
transform.apply_patterns to %func {
8383
transform.apply_patterns.vector.lower_contraction lowering_strategy = "outerproduct"
8484
transform.apply_patterns.vector.lower_masks
85+
transform.apply_patterns.canonicalization
8586
} : !transform.any_op
8687

88+
// Step 5 (optional optimization): Hoist accumulator load/store.
89+
%func_h = transform.structured.hoist_redundant_vector_transfers %func
90+
: (!transform.any_op) -> !transform.any_op
91+
%all_loops = transform.structured.match interface{LoopLikeInterface} in %module
92+
: (!transform.any_op) -> !transform.any_op
93+
transform.apply_licm to %all_loops : !transform.any_op
94+
transform.loop.hoist_loop_invariant_subsets %all_loops : !transform.any_op
8795
transform.yield
8896
}
8997
}

mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/matmul.mlir

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,16 @@ module attributes {transform.with_named_sequence} {
8888
transform.apply_patterns.vector.lower_contraction lowering_strategy = "outerproduct"
8989
transform.apply_patterns.vector.lower_masks
9090
transform.apply_patterns.vector.rank_reducing_subview_patterns
91+
transform.apply_patterns.canonicalization
9192
} : !transform.any_op
9293

94+
// Step 6 (optional optimization): Hoist accumulator load/store.
95+
%func_h = transform.structured.hoist_redundant_vector_transfers %func
96+
: (!transform.any_op) -> !transform.any_op
97+
%all_loops = transform.structured.match interface{LoopLikeInterface} in %bufferize
98+
: (!transform.any_op) -> !transform.any_op
99+
transform.apply_licm to %all_loops : !transform.any_op
100+
transform.loop.hoist_loop_invariant_subsets %all_loops : !transform.any_op
93101
transform.yield
94102
}
95103
}

0 commit comments

Comments
 (0)