33
44// This file tests some simple aspects of using liveness in the SME tile allocator.
55
6- // CHECK-LIVE-RANGE: ========== Coalesced Live Ranges:
7- // CHECK-LIVE-RANGE-NEXT: @constant_with_multiple_users
8- // CHECK-LIVE-RANGE: ^bb0:
9- // CHECK-LIVE-RANGE: S arm_sme.zero
10- // CHECK-LIVE-RANGE-NEXT: |S arm_sme.move_vector_to_tile_slice
11- // CHECK-LIVE-RANGE-NEXT: || arm_sme.move_vector_to_tile_slice
12- // CHECK-LIVE-RANGE-NEXT: |E test.some_use
13- // CHECK-LIVE-RANGE-NEXT: E test.some_use
6+ // CHECK-LIVE-RANGE-LABEL: @constant_with_multiple_users
7+ // CHECK-LIVE-RANGE: ========== Coalesced Live Ranges:
8+ // CHECK-LIVE-RANGE: ^bb0:
9+ // CHECK-LIVE-RANGE: S arm_sme.zero
10+ // CHECK-LIVE-RANGE-NEXT: |S arm_sme.move_vector_to_tile_slice
11+ // CHECK-LIVE-RANGE-NEXT: || arm_sme.move_vector_to_tile_slice
12+ // CHECK-LIVE-RANGE-NEXT: |E test.some_use
13+ // CHECK-LIVE-RANGE-NEXT: E test.some_use
1414
1515// CHECK-LABEL: @constant_with_multiple_users(
1616// CHECK-SAME: %[[VECTOR_A:.*]]: vector<[4]xf32>, %[[VECTOR_B:.*]]: vector<[4]xf32>
@@ -29,13 +29,13 @@ func.func @constant_with_multiple_users(%a: vector<[4]xf32>, %b: vector<[4]xf32>
2929
3030// -----
3131
32- // CHECK-LIVE-RANGE: ========== Coalesced Live Ranges:
33- // CHECK-LIVE-RANGE-NEXT: @value_with_multiple_users
34- // CHECK-LIVE-RANGE: ^bb0:
35- // CHECK-LIVE-RANGE-NEXT: |S arm_sme.move_vector_to_tile_slice
36- // CHECK-LIVE-RANGE-NEXT: || arm_sme.move_vector_to_tile_slice
37- // CHECK-LIVE-RANGE-NEXT: |E test.some_use
38- // CHECK-LIVE-RANGE-NEXT: E test.some_use
32+ // CHECK-LIVE-RANGE-LABEL: @value_with_multiple_users
33+ // CHECK-LIVE-RANGE: ========== Coalesced Live Ranges:
34+ // CHECK-LIVE-RANGE: ^bb0:
35+ // CHECK-LIVE-RANGE-NEXT: |S arm_sme.move_vector_to_tile_slice
36+ // CHECK-LIVE-RANGE-NEXT: || arm_sme.move_vector_to_tile_slice
37+ // CHECK-LIVE-RANGE-NEXT: |E test.some_use
38+ // CHECK-LIVE-RANGE-NEXT: E test.some_use
3939
4040func.func @value_with_multiple_users (%tile: vector <[4 ]x[4 ]xf32 >, %a: vector <[4 ]xf32 >, %b: vector <[4 ]xf32 >, %index: index ) {
4141 // expected-error@below {{op failed to rectify tile operand with tile result (move required)}}
@@ -48,31 +48,31 @@ func.func @value_with_multiple_users(%tile: vector<[4]x[4]xf32>, %a: vector<[4]x
4848
4949// -----
5050
51- // CHECK-LIVE-RANGE: ========== Coalesced Live Ranges:
52- // CHECK-LIVE-RANGE-NEXT: @reuse_tiles_after_initial_use
53- // CHECK-LIVE-RANGE: ^bb0:
54- // CHECK-LIVE-RANGE-NEXT: S arm_sme.get_tile
55- // CHECK-LIVE-RANGE-NEXT: |S arm_sme.get_tile
56- // CHECK-LIVE-RANGE-NEXT: ||S arm_sme.get_tile
57- // CHECK-LIVE-RANGE-NEXT: |||S arm_sme.get_tile
58- // CHECK-LIVE-RANGE-NEXT: |||| test.dummy
59- // CHECK-LIVE-RANGE-NEXT: |||| test.dummy
60- // CHECK-LIVE-RANGE-NEXT: |||| test.dummy
61- // CHECK-LIVE-RANGE-NEXT: E||| test.some_use
62- // CHECK-LIVE-RANGE-NEXT: E|| test.some_use
63- // CHECK-LIVE-RANGE-NEXT: E| test.some_use
64- // CHECK-LIVE-RANGE-NEXT: E test.some_use
65- // CHECK-LIVE-RANGE-NEXT: S arm_sme.zero
66- // CHECK-LIVE-RANGE-NEXT: |S arm_sme.zero
67- // CHECK-LIVE-RANGE-NEXT: ||S arm_sme.zero
68- // CHECK-LIVE-RANGE-NEXT: |||S arm_sme.zero
69- // CHECK-LIVE-RANGE-NEXT: |||| test.dummy
70- // CHECK-LIVE-RANGE-NEXT: |||| test.dummy
71- // CHECK-LIVE-RANGE-NEXT: |||| test.dummy
72- // CHECK-LIVE-RANGE-NEXT: E||| test.some_use
73- // CHECK-LIVE-RANGE-NEXT: E|| test.some_use
74- // CHECK-LIVE-RANGE-NEXT: E| test.some_use
75- // CHECK-LIVE-RANGE-NEXT: E test.some_use
51+ // CHECK-LIVE-RANGE-LABEL: @reuse_tiles_after_initial_use
52+ // CHECK-LIVE-RANGE: ========== Coalesced Live Ranges:
53+ // CHECK-LIVE-RANGE: ^bb0:
54+ // CHECK-LIVE-RANGE-NEXT: S arm_sme.get_tile
55+ // CHECK-LIVE-RANGE-NEXT: |S arm_sme.get_tile
56+ // CHECK-LIVE-RANGE-NEXT: ||S arm_sme.get_tile
57+ // CHECK-LIVE-RANGE-NEXT: |||S arm_sme.get_tile
58+ // CHECK-LIVE-RANGE-NEXT: |||| test.dummy
59+ // CHECK-LIVE-RANGE-NEXT: |||| test.dummy
60+ // CHECK-LIVE-RANGE-NEXT: |||| test.dummy
61+ // CHECK-LIVE-RANGE-NEXT: E||| test.some_use
62+ // CHECK-LIVE-RANGE-NEXT: E|| test.some_use
63+ // CHECK-LIVE-RANGE-NEXT: E| test.some_use
64+ // CHECK-LIVE-RANGE-NEXT: E test.some_use
65+ // CHECK-LIVE-RANGE-NEXT: S arm_sme.zero
66+ // CHECK-LIVE-RANGE-NEXT: |S arm_sme.zero
67+ // CHECK-LIVE-RANGE-NEXT: ||S arm_sme.zero
68+ // CHECK-LIVE-RANGE-NEXT: |||S arm_sme.zero
69+ // CHECK-LIVE-RANGE-NEXT: |||| test.dummy
70+ // CHECK-LIVE-RANGE-NEXT: |||| test.dummy
71+ // CHECK-LIVE-RANGE-NEXT: |||| test.dummy
72+ // CHECK-LIVE-RANGE-NEXT: E||| test.some_use
73+ // CHECK-LIVE-RANGE-NEXT: E|| test.some_use
74+ // CHECK-LIVE-RANGE-NEXT: E| test.some_use
75+ // CHECK-LIVE-RANGE-NEXT: E test.some_use
7676
7777// CHECK-LABEL: @reuse_tiles_after_initial_use
7878func.func @reuse_tiles_after_initial_use () {
@@ -111,16 +111,16 @@ func.func @reuse_tiles_after_initial_use() {
111111
112112// -----
113113
114- // CHECK-LIVE-RANGE: ========== Coalesced Live Ranges:
115- // CHECK-LIVE-RANGE-NEXT: @non_overlapping_branches
116- // CHECK-LIVE-RANGE: ^bb1:
117- // CHECK-LIVE-RANGE-NEXT: S arm_sme.zero
118- // CHECK-LIVE-RANGE-NEXT: | arm_sme.copy_tile
119- // CHECK-LIVE-RANGE-NEXT: E cf.br
120- // CHECK-LIVE-RANGE-NEXT: ^bb2:
121- // CHECK-LIVE-RANGE-NEXT: S arm_sme.get_tile
122- // CHECK-LIVE-RANGE-NEXT: | arm_sme.copy_tile
123- // CHECK-LIVE-RANGE-NEXT: E cf.br
114+ // CHECK-LIVE-RANGE-LABEL: @non_overlapping_branches
115+ // CHECK-LIVE-RANGE: ========== Coalesced Live Ranges:
116+ // CHECK-LIVE-RANGE: ^bb1:
117+ // CHECK-LIVE-RANGE-NEXT: S arm_sme.zero
118+ // CHECK-LIVE-RANGE-NEXT: | arm_sme.copy_tile
119+ // CHECK-LIVE-RANGE-NEXT: E cf.br
120+ // CHECK-LIVE-RANGE-NEXT: ^bb2:
121+ // CHECK-LIVE-RANGE-NEXT: S arm_sme.get_tile
122+ // CHECK-LIVE-RANGE-NEXT: | arm_sme.copy_tile
123+ // CHECK-LIVE-RANGE-NEXT: E cf.br
124124
125125// CHECK-LABEL: @non_overlapping_branches
126126func.func @non_overlapping_branches (%cond: i1 ) {
@@ -141,8 +141,20 @@ func.func @non_overlapping_branches(%cond: i1) {
141141
142142// -----
143143
144- // CHECK-LIVE-RANGE: ========== Coalesced Live Ranges:
145- // <deliberately omitted>
144+ // Here %vecA and %vecB are not merged into the same live range (as they are unknown values).
145+ // This means that %vecA and %vecB are both allocated to different tiles (which is not legal).
146+ func.func @overlapping_branches (%cond: i1 , %vecA: vector <[4 ]x[4 ]xf32 >, %vecB: vector <[4 ]x[4 ]xf32 >) {
147+ // expected-error@below {{op failed to rectify tile operand with tile result (move required)}}
148+ %tile = scf.if %cond -> vector <[4 ]x[4 ]xf32 > {
149+ scf.yield %vecA : vector <[4 ]x[4 ]xf32 >
150+ } else {
151+ scf.yield %vecB : vector <[4 ]x[4 ]xf32 >
152+ }
153+ " test.some_use" (%tile ) : (vector <[4 ]x[4 ]xf32 >) -> ()
154+ return
155+ }
156+
157+ // -----
146158
147159// CHECK-LABEL: @constant_loop_init_with_multiple_users
148160func.func @constant_loop_init_with_multiple_users (%a: vector <[4 ]xf32 >, %b: vector <[4 ]xf32 >) {
@@ -169,14 +181,14 @@ func.func @constant_loop_init_with_multiple_users(%a: vector<[4]xf32>, %b: vecto
169181
170182// -----
171183
172- // CHECK-LIVE-RANGE: ========== Coalesced Live Ranges:
173- // CHECK-LIVE-RANGE-NEXT: @run_out_of_tiles_but_avoid_spill
174- // CHECK-LIVE-RANGE: ^bb2:
175- // CHECK-LIVE-RANGE-NEXT: |S arm_sme.copy_tile
176- // CHECK-LIVE-RANGE-NEXT: ||S arm_sme.copy_tile
177- // CHECK-LIVE-RANGE-NEXT: |||S arm_sme.copy_tile
178- // CHECK-LIVE-RANGE-NEXT: ||||S arm_sme.copy_tile
179- // CHECK-LIVE-RANGE-NEXT: EEEEE cf.br
184+ // CHECK-LIVE-RANGE-LABEL: @run_out_of_tiles_but_avoid_spill
185+ // CHECK-LIVE-RANGE: ========== Coalesced Live Ranges:
186+ // CHECK-LIVE-RANGE: ^bb2:
187+ // CHECK-LIVE-RANGE-NEXT: |S arm_sme.copy_tile
188+ // CHECK-LIVE-RANGE-NEXT: ||S arm_sme.copy_tile
189+ // CHECK-LIVE-RANGE-NEXT: |||S arm_sme.copy_tile
190+ // CHECK-LIVE-RANGE-NEXT: ||||S arm_sme.copy_tile
191+ // CHECK-LIVE-RANGE-NEXT: EEEEE cf.br
180192
181193// Note in the live ranges (above) there is five tile values, but we only have four tiles.
182194
@@ -222,20 +234,20 @@ func.func @run_out_of_tiles_but_avoid_spill(%a: vector<[4]xf32>, %b: vector<[4]x
222234// We should be able to avoid spills like this, but logic handling this case is
223235// not implemented yet. Note tile ID >= 16 means a spill/in-memory tile.
224236
225- // CHECK-LIVE-RANGE: ========== Coalesced Live Ranges:
226- // CHECK-LIVE-RANGE-NEXT: @avoidable_spill
227- // CHECK-LIVE-RANGE: ^bb2:
228- // CHECK-LIVE-RANGE-NEXT: || test.some_use
229- // CHECK-LIVE-RANGE-NEXT: ||S arm_sme.move_vector_to_tile_slice
230- // CHECK-LIVE-RANGE-NEXT: |||S arm_sme.move_vector_to_tile_slice
231- // CHECK-LIVE-RANGE-NEXT: ||||S arm_sme.move_vector_to_tile_slice
232- // CHECK-LIVE-RANGE-NEXT: |||||S arm_sme.move_vector_to_tile_slice
233- // CHECK-LIVE-RANGE-NEXT: ||E||| test.some_use
234- // CHECK-LIVE-RANGE-NEXT: || E|| test.some_use
235- // CHECK-LIVE-RANGE-NEXT: || E| test.some_use
236- // CHECK-LIVE-RANGE-NEXT: || E test.some_use
237- // CHECK-LIVE-RANGE-NEXT: || arith.addi
238- // CHECK-LIVE-RANGE-NEXT: EE cf.br
237+ // CHECK-LIVE-RANGE-LABEL: @avoidable_spill
238+ // CHECK-LIVE-RANGE: ========== Coalesced Live Ranges:
239+ // CHECK-LIVE-RANGE: ^bb2:
240+ // CHECK-LIVE-RANGE-NEXT: || test.some_use
241+ // CHECK-LIVE-RANGE-NEXT: ||S arm_sme.move_vector_to_tile_slice
242+ // CHECK-LIVE-RANGE-NEXT: |||S arm_sme.move_vector_to_tile_slice
243+ // CHECK-LIVE-RANGE-NEXT: ||||S arm_sme.move_vector_to_tile_slice
244+ // CHECK-LIVE-RANGE-NEXT: |||||S arm_sme.move_vector_to_tile_slice
245+ // CHECK-LIVE-RANGE-NEXT: ||E||| test.some_use
246+ // CHECK-LIVE-RANGE-NEXT: || E|| test.some_use
247+ // CHECK-LIVE-RANGE-NEXT: || E| test.some_use
248+ // CHECK-LIVE-RANGE-NEXT: || E test.some_use
249+ // CHECK-LIVE-RANGE-NEXT: || arith.addi
250+ // CHECK-LIVE-RANGE-NEXT: EE cf.br
239251
240252// Note in the live ranges (above) there is two constant live-ins (first two ranges),
241253// which gives six overlapping live ranges. The allocator currently will spill the
0 commit comments