Skip to content

Commit 901b0a8

Browse files
committed
AIE: tests for dynamic objectFifo lock lowering
Update lock-bearing goldens for the new i32 SSA aie.use_lock value form, add dynamic_runtime_lock_* tests covering the runtime "held"-counter lock bookkeeping, add a bad-input test for a non-constant use_lock value where a constant is required, and drop the dynamic_cyclostatic_* goldens that exercised the removed static peel/held-before-loop lock accounting.
1 parent 1d4a361 commit 901b0a8

305 files changed

Lines changed: 10457 additions & 6159 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

test/Integration/julia_by_lines/aie.mlir

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,11 @@ module @test {
4343
%sum = scf.for %iv = %lb to %ub step %step
4444
iter_args(%Im = %MinIm) -> (f32) {
4545
%Im_next = arith.addf %Im, %StepIm : f32
46-
aie.use_lock(%lock13_3, "Acquire", 1) // acquire
46+
%c1_ul0 = arith.constant 1 : i32
47+
aie.use_lock(%lock13_3, "Acquire", %c1_ul0) // acquire
4748
func.call @do_line(%buf13_0, %MinRe, %StepRe, %Im, %size) : (memref<32x32xi32>, f32, f32, f32, i32) -> ()
48-
aie.use_lock(%lock13_3, "Release", 0) // release for write
49+
%c0_ul1 = arith.constant 0 : i32
50+
aie.use_lock(%lock13_3, "Release", %c0_ul1) // release for write
4951
scf.yield %Im_next : f32
5052
}
5153
aie.end

test/Passes/assign-bd-ids/bad_bd_assignments.mlir

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@ module {
1515
%lock_Y = aie.lock(%tile_0_2) {init = 0 : i32}
1616
%mem_0_2 = aie.mem(%tile_0_2) {
1717
%player_a = aie.dma(S2MM, 0) [{
18-
aie.use_lock(%lock_Y, Acquire, 0)
18+
%c0_ul0 = arith.constant 0 : i32
19+
aie.use_lock(%lock_Y, Acquire, %c0_ul0)
1920
// expected-error@+1 {{'aie.dma_bd' op bdId attribute exceeds max: 15}}
2021
aie.dma_bd(%double_buffer : memref<32xi32>, 0) {bd_id = 16 : i32, next_bd_id = 1 : i32}
21-
aie.use_lock(%lock_Y, Release, 0)
22+
%c0_ul1 = arith.constant 0 : i32
23+
aie.use_lock(%lock_Y, Release, %c0_ul1)
2224
}]
2325
aie.end
2426
}
@@ -34,10 +36,12 @@ module {
3436
%lock_X = aie.lock(%tile_0_2) {init = 0 : i32}
3537
%mem_0_2 = aie.mem(%tile_0_2) {
3638
%player_a = aie.dma(S2MM, 0) [{
37-
aie.use_lock(%lock_X, Acquire, 1)
39+
%c1_ul2 = arith.constant 1 : i32
40+
aie.use_lock(%lock_X, Acquire, %c1_ul2)
3841
// expected-error@+1 {{'aie.dma_bd' op nextBdId attribute exceeds max: 15}}
3942
aie.dma_bd(%double_buffer : memref<32xi32>) {bd_id = 1 : i32, next_bd_id = 16 : i32}
40-
aie.use_lock(%lock_X, Release, -1)
43+
%cn1_ul3 = arith.constant -1 : i32
44+
aie.use_lock(%lock_X, Release, %cn1_ul3)
4145
}]
4246
aie.end
4347
}
@@ -54,10 +58,12 @@ module {
5458
%lock_0_1 = aie.lock(%tile_0_1) {init = 1 : i32}
5559
%lock_0_1_0 = aie.lock(%tile_0_1) {init = 0 : i32}
5660
%0 = aie.dma(S2MM, 0) [{
57-
aie.use_lock(%lock_0_1, AcquireGreaterEqual)
61+
%c1_ul4 = arith.constant 1 : i32
62+
aie.use_lock(%lock_0_1, AcquireGreaterEqual, %c1_ul4)
5863
// expected-error@+1 {{'aie.dma_bd' op bdId attribute exceeds max: 47}}
5964
aie.dma_bd(%buffer_0_1 : memref<32xi32>) {bd_id = 48 : i32, next_bd_id = 1 : i32}
60-
aie.use_lock(%lock_0_1_0, Release)
65+
%c1_ul5 = arith.constant 1 : i32
66+
aie.use_lock(%lock_0_1_0, Release, %c1_ul5)
6167
}]
6268
aie.end
6369
}
@@ -74,10 +80,12 @@ module {
7480
%lock_0_1_0 = aie.lock(%tile_0_1) {init = 0 : i32}
7581
%buffer_0_1 = aie.buffer(%tile_0_1) : memref<32xi32>
7682
%0 = aie.dma(S2MM, 0) [{
77-
aie.use_lock(%lock_0_1, AcquireGreaterEqual)
83+
%c1_ul6 = arith.constant 1 : i32
84+
aie.use_lock(%lock_0_1, AcquireGreaterEqual, %c1_ul6)
7885
// expected-error@+1 {{'aie.dma_bd' op nextBdId attribute exceeds max: 47}}
7986
aie.dma_bd(%buffer_0_1 : memref<32xi32>) {bd_id = 1 : i32, next_bd_id = 48 : i32}
80-
aie.use_lock(%lock_0_1_0, Release)
87+
%c1_ul7 = arith.constant 1 : i32
88+
aie.use_lock(%lock_0_1_0, Release, %c1_ul7)
8189
}]
8290
aie.end
8391
}
@@ -95,10 +103,12 @@ module {
95103
%lock_0_1_0 = aie.lock(%tile_0_1) {init = 0 : i32}
96104
%buffer_0_1 = aie.buffer(%tile_0_1) : memref<32xi32>
97105
%0 = aie.dma(S2MM, 0) [{
98-
aie.use_lock(%lock_0_1, AcquireGreaterEqual)
106+
%c1_ul8 = arith.constant 1 : i32
107+
aie.use_lock(%lock_0_1, AcquireGreaterEqual, %c1_ul8)
99108
// expected-error@+1 {{'aie.dma_bd' op nextBdId attribute exceeds max: 47}}
100109
aie.dma_bd(%buffer_0_1 : memref<32xi32>) {bd_id = 1 : i32, next_bd_id = 48 : i32}
101-
aie.use_lock(%lock_0_1_0, Release)
110+
%c1_ul9 = arith.constant 1 : i32
111+
aie.use_lock(%lock_0_1_0, Release, %c1_ul9)
102112
}]
103113
aie.end
104114
}
@@ -115,10 +125,12 @@ module {
115125
%lock_0_1_0 = aie.lock(%tile_0_1) {init = 0 : i32}
116126
%buffer_0_1 = aie.buffer(%tile_0_1) : memref<128xi16>
117127
%0 = aie.dma(S2MM, 0) [{
118-
aie.use_lock(%lock_0_1, AcquireGreaterEqual)
128+
%c1_ul10 = arith.constant 1 : i32
129+
aie.use_lock(%lock_0_1, AcquireGreaterEqual, %c1_ul10)
119130
// expected-error@+1 {{'aie.dma_bd' op transfer length must be multiple of 4 (i.e., represent 4 byte aligned address)}}
120131
aie.dma_bd(%buffer_0_1 : memref<128xi16>, 0, 129)
121-
aie.use_lock(%lock_0_1_0, Release)
132+
%c1_ul11 = arith.constant 1 : i32
133+
aie.use_lock(%lock_0_1_0, Release, %c1_ul11)
122134
}]
123135
aie.end
124136
}

test/Passes/assign-bd-ids/basic.mlir

Lines changed: 56 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -37,57 +37,77 @@ module {
3737
%lock_Y = aie.lock(%tile_0_2) {init = 0 : i32, sym_name = "lock_Y"}
3838
%mem_0_2 = aie.mem(%tile_0_2) {
3939
%player_a = aie.dma(S2MM, 0) {sym_name = "player_a"} [{
40-
aie.use_lock(%lock_Y, Acquire, 0)
40+
%c0_ul0 = arith.constant 0 : i32
41+
aie.use_lock(%lock_Y, Acquire, %c0_ul0)
4142
aie.dma_bd(%double_buffer : memref<32xi32>, 0)
42-
aie.use_lock(%lock_Y, Release, 0)
43+
%c0_ul1 = arith.constant 0 : i32
44+
aie.use_lock(%lock_Y, Release, %c0_ul1)
4345
}, {
44-
aie.use_lock(%lock_X, Acquire, 1)
46+
%c1_ul2 = arith.constant 1 : i32
47+
aie.use_lock(%lock_X, Acquire, %c1_ul2)
4548
aie.dma_bd(%double_buffer : memref<32xi32>)
46-
aie.use_lock(%lock_X, Release, -1)
49+
%cn1_ul3 = arith.constant -1 : i32
50+
aie.use_lock(%lock_X, Release, %cn1_ul3)
4751
}, {
48-
aie.use_lock(%lock_Y, Acquire) {acq_en = false}
52+
%c1_ul4 = arith.constant 1 : i32
53+
aie.use_lock(%lock_Y, Acquire, %c1_ul4) {acq_en = false}
4954
aie.dma_bd(%double_buffer : memref<32xi32>)
50-
aie.use_lock(%lock_Y, Release, 1)
55+
%c1_ul5 = arith.constant 1 : i32
56+
aie.use_lock(%lock_Y, Release, %c1_ul5)
5157
}]
5258
%player_b = aie.dma(S2MM, 1) {sym_name = "player_b"} [{
53-
aie.use_lock(%lock_Y, Acquire, 1)
59+
%c1_ul6 = arith.constant 1 : i32
60+
aie.use_lock(%lock_Y, Acquire, %c1_ul6)
5461
aie.dma_bd(%double_buffer : memref<32xi32>, 0)
55-
aie.use_lock(%lock_Y, Release, 0)
62+
%c0_ul7 = arith.constant 0 : i32
63+
aie.use_lock(%lock_Y, Release, %c0_ul7)
5664
}, {
57-
aie.use_lock(%lock_X, Acquire, 1)
65+
%c1_ul8 = arith.constant 1 : i32
66+
aie.use_lock(%lock_X, Acquire, %c1_ul8)
5867
aie.dma_bd(%double_buffer : memref<32xi32>)
59-
aie.use_lock(%lock_X, Release, -1)
68+
%cn1_ul9 = arith.constant -1 : i32
69+
aie.use_lock(%lock_X, Release, %cn1_ul9)
6070
}, {
61-
aie.use_lock(%lock_Y, Acquire) {acq_en = false}
71+
%c1_ul10 = arith.constant 1 : i32
72+
aie.use_lock(%lock_Y, Acquire, %c1_ul10) {acq_en = false}
6273
aie.dma_bd(%double_buffer : memref<32xi32>)
63-
aie.use_lock(%lock_Y, Release, -1)
74+
%cn1_ul11 = arith.constant -1 : i32
75+
aie.use_lock(%lock_Y, Release, %cn1_ul11)
6476
}]
6577
aie.end
6678
}
6779
%memtile_dma_0_1 = aie.memtile_dma(%tile_0_1) {
6880
%lock_0_1 = aie.lock(%tile_0_1) {init = 1 : i32}
6981
%lock_0_1_0 = aie.lock(%tile_0_1) {init = 0 : i32}
7082
%0 = aie.dma(S2MM, 0) {loop = false, repeat_count = 10 : i32} [{
71-
aie.use_lock(%lock_0_1, AcquireGreaterEqual)
83+
%c1_ul12 = arith.constant 1 : i32
84+
aie.use_lock(%lock_0_1, AcquireGreaterEqual, %c1_ul12)
7285
aie.dma_bd(%buffer_0_1 : memref<32xi32>)
73-
aie.use_lock(%lock_0_1_0, Release)
86+
%c1_ul13 = arith.constant 1 : i32
87+
aie.use_lock(%lock_0_1_0, Release, %c1_ul13)
7488
}]
7589
%1 = aie.dma(MM2S, 0) {loop = false, repeat_count = 10 : i32} [{
76-
aie.use_lock(%lock_0_1_0, AcquireGreaterEqual)
90+
%c1_ul14 = arith.constant 1 : i32
91+
aie.use_lock(%lock_0_1_0, AcquireGreaterEqual, %c1_ul14)
7792
aie.dma_bd(%buffer_0_1 : memref<32xi32>)
78-
aie.use_lock(%lock_0_1, Release)
93+
%c1_ul15 = arith.constant 1 : i32
94+
aie.use_lock(%lock_0_1, Release, %c1_ul15)
7995
}]
8096
%lock_0_1_1 = aie.lock(%tile_0_1) {init = 1 : i32}
8197
%lock_0_1_2 = aie.lock(%tile_0_1) {init = 0 : i32}
8298
%2 = aie.dma(S2MM, 1) {loop = false, repeat_count = 10 : i32} [{
83-
aie.use_lock(%lock_0_1_1, AcquireGreaterEqual)
99+
%c1_ul16 = arith.constant 1 : i32
100+
aie.use_lock(%lock_0_1_1, AcquireGreaterEqual, %c1_ul16)
84101
aie.dma_bd(%buffer_0_1 : memref<32xi32>)
85-
aie.use_lock(%lock_0_1_2, Release)
102+
%c1_ul17 = arith.constant 1 : i32
103+
aie.use_lock(%lock_0_1_2, Release, %c1_ul17)
86104
}]
87105
%3 = aie.dma(MM2S, 1) {loop = false, repeat_count = 10 : i32} [{
88-
aie.use_lock(%lock_0_1_2, AcquireGreaterEqual)
106+
%c1_ul18 = arith.constant 1 : i32
107+
aie.use_lock(%lock_0_1_2, AcquireGreaterEqual, %c1_ul18)
89108
aie.dma_bd(%buffer_0_1 : memref<32xi32>)
90-
aie.use_lock(%lock_0_1_1, Release)
109+
%c1_ul19 = arith.constant 1 : i32
110+
aie.use_lock(%lock_0_1_1, Release, %c1_ul19)
91111
}]
92112
aie.end
93113
}
@@ -126,24 +146,32 @@ module @aie_module {
126146
^dma2:
127147
%dstDma = aie.dma_start(MM2S, 0, ^bd3, ^end)
128148
^bd0:
129-
aie.use_lock(%l01_0, "AcquireGreaterEqual", 1)
149+
%c1_ul20 = arith.constant 1 : i32
150+
aie.use_lock(%l01_0, "AcquireGreaterEqual", %c1_ul20)
130151
aie.dma_bd(%buf01_0 : memref<16xi32>, 0, 128, [<size = 2, stride = 1>, <size = 3, stride = 2>, <size = 2, stride = 4>, <size = 1, stride = 1>])
131-
aie.use_lock(%l01_1, "Release", 1)
152+
%c1_ul21 = arith.constant 1 : i32
153+
aie.use_lock(%l01_1, "Release", %c1_ul21)
132154
aie.next_bd ^bd0
133155
^bd1:
134-
aie.use_lock(%l01_1, "AcquireGreaterEqual", 1)
156+
%c1_ul22 = arith.constant 1 : i32
157+
aie.use_lock(%l01_1, "AcquireGreaterEqual", %c1_ul22)
135158
aie.dma_bd(%buf01_0 : memref<16xi32>, 0, 16)
136-
aie.use_lock(%l01_0, "Release", 1)
159+
%c1_ul23 = arith.constant 1 : i32
160+
aie.use_lock(%l01_0, "Release", %c1_ul23)
137161
aie.next_bd ^bd1
138162
^bd2:
139-
aie.use_lock(%l01_2, "AcquireGreaterEqual", 1)
163+
%c1_ul24 = arith.constant 1 : i32
164+
aie.use_lock(%l01_2, "AcquireGreaterEqual", %c1_ul24)
140165
aie.dma_bd(%buf01_1 : memref<16xi32>, 0, 16)
141-
aie.use_lock(%l01_3, "Release", 1)
166+
%c1_ul25 = arith.constant 1 : i32
167+
aie.use_lock(%l01_3, "Release", %c1_ul25)
142168
aie.next_bd ^bd2
143169
^bd3:
144-
aie.use_lock(%l01_3, "AcquireGreaterEqual", 1)
170+
%c1_ul26 = arith.constant 1 : i32
171+
aie.use_lock(%l01_3, "AcquireGreaterEqual", %c1_ul26)
145172
aie.dma_bd(%buf01_1 : memref<16xi32>, 0, 16)
146-
aie.use_lock(%l01_2, "Release", 1)
173+
%c1_ul27 = arith.constant 1 : i32
174+
aie.use_lock(%l01_2, "Release", %c1_ul27)
147175
aie.next_bd ^bd3
148176
^end:
149177
aie.end

0 commit comments

Comments
 (0)