2
2
3
3
// expected-error @+1 {{has no AMDAIEDevice in the target attribute configuration}}
4
4
module {
5
- func.func @assign_packet_ids ( %arg0: memref < 8 x 16 x i32 >, %arg1: memref < 1 x 1 x 8 x 16 x i32 , 1 >, %arg2: memref < 1 x 1 x 8 x 16 x i32 , 2 > ) {
5
+ func.func @no_device ( ) {
6
6
%c0 = arith.constant 0 : index
7
7
%c1 = arith.constant 1 : index
8
8
amdaie.workgroup {
@@ -21,6 +21,69 @@ module {
21
21
22
22
// -----
23
23
24
+ #executable_target_amdaie_xclbin_fb = #hal.executable.target <" amd-aie" , " amdaie-xclbin-fb" , {target_device = " npu1_4col" , ukernels = " none" }>
25
+ module attributes {hal.executable.target = #executable_target_amdaie_xclbin_fb } {
26
+ func.func @no_source_channel () {
27
+ %c0 = arith.constant 0 : index
28
+ %c1 = arith.constant 1 : index
29
+ amdaie.workgroup {
30
+ %tile_0_1 = amdaie.tile (%c0 , %c1 )
31
+ %channel = amdaie.channel (%tile_0_1 , 0 , port_type = DMA , direction = S2MM )
32
+ // expected-error @+1 {{with no source channel is unsupported}}
33
+ %0 = amdaie.flow ({} -> {%channel }) {is_packet_flow = true }
34
+ amdaie.controlcode {
35
+ amdaie.end
36
+ }
37
+ }
38
+ return
39
+ }
40
+ }
41
+
42
+ // -----
43
+
44
+ #executable_target_amdaie_xclbin_fb = #hal.executable.target <" amd-aie" , " amdaie-xclbin-fb" , {target_device = " npu1_4col" , ukernels = " none" }>
45
+ module attributes {hal.executable.target = #executable_target_amdaie_xclbin_fb } {
46
+ func.func @no_channel () {
47
+ %c0 = arith.constant 0 : index
48
+ %c1 = arith.constant 1 : index
49
+ amdaie.workgroup {
50
+ %tile_0_1 = amdaie.tile (%c0 , %c1 )
51
+ %channel = amdaie.channel (%tile_0_1 , 0 , port_type = DMA , direction = S2MM )
52
+ // expected-error @+1 {{source should be an `amdaie.channel` op}}
53
+ %0 = amdaie.flow ({%c0 } -> {%channel }) {is_packet_flow = true }
54
+ amdaie.controlcode {
55
+ amdaie.end
56
+ }
57
+ }
58
+ return
59
+ }
60
+ }
61
+
62
+ // -----
63
+
64
+ #executable_target_amdaie_xclbin_fb = #hal.executable.target <" amd-aie" , " amdaie-xclbin-fb" , {target_device = " npu1_4col" , ukernels = " none" }>
65
+ module attributes {hal.executable.target = #executable_target_amdaie_xclbin_fb } {
66
+ func.func @multiple_source_channels () {
67
+ %c0 = arith.constant 0 : index
68
+ %c1 = arith.constant 1 : index
69
+ amdaie.workgroup {
70
+ %tile_0_0 = amdaie.tile (%c0 , %c0 )
71
+ %tile_0_1 = amdaie.tile (%c0 , %c1 )
72
+ %channel = amdaie.channel (%tile_0_0 , 0 , port_type = DMA , direction = MM2S )
73
+ %channel_1 = amdaie.channel (%tile_0_0 , 1 , port_type = DMA , direction = MM2S )
74
+ %channel_2 = amdaie.channel (%tile_0_1 , 0 , port_type = DMA , direction = S2MM )
75
+ // expected-error @+1 {{with multiple source channels is unsupported}}
76
+ %0 = amdaie.flow ({%channel , %channel_1 } -> {%channel_2 }) {is_packet_flow = true }
77
+ amdaie.controlcode {
78
+ amdaie.end
79
+ }
80
+ }
81
+ return
82
+ }
83
+ }
84
+
85
+ // -----
86
+
24
87
// CHECK-LABEL: @assign_packet_ids
25
88
// CHECK: %[[C0:.*]] = arith.constant 0 : index
26
89
// CHECK: %[[C1:.*]] = arith.constant 1 : index
@@ -35,10 +98,10 @@ module {
35
98
// CHECK: %[[CHANNEL_3:.*]] = amdaie.channel(%[[TILE_0_1]], 1, port_type = DMA, direction = S2MM)
36
99
// CHECK: amdaie.flow({%[[CHANNEL]]} -> {%[[CHANNEL_1]]}) {is_packet_flow = false}
37
100
// CHECK: amdaie.flow({%[[CHANNEL]]} -> {%[[CHANNEL_1]]}) {is_packet_flow = true, packet_id = 0 : ui8}
38
- // CHECK: amdaie.flow({%[[CHANNEL_2]]} -> {%[[CHANNEL_3]]}) {is_packet_flow = true, packet_id = 1 : ui8}
101
+ // CHECK: amdaie.flow({%[[CHANNEL_2]]} -> {%[[CHANNEL_3]]}) {is_packet_flow = true, packet_id = 0 : ui8}
39
102
#executable_target_amdaie_xclbin_fb = #hal.executable.target <" amd-aie" , " amdaie-xclbin-fb" , {target_device = " npu1_4col" , ukernels = " none" }>
40
103
module attributes {hal.executable.target = #executable_target_amdaie_xclbin_fb } {
41
- func.func @assign_packet_ids (%arg0: memref < 8 x 16 x i32 >, %arg1: memref < 1 x 1 x 8 x 16 x i32 , 1 >, %arg2: memref < 1 x 1 x 8 x 16 x i32 , 2 > ) {
104
+ func.func @assign_packet_ids () {
42
105
%c0 = arith.constant 0 : index
43
106
%c1 = arith.constant 1 : index
44
107
%c2 = arith.constant 2 : index
@@ -63,9 +126,44 @@ module attributes {hal.executable.target = #executable_target_amdaie_xclbin_fb}
63
126
64
127
// -----
65
128
129
+ // Test that different packet IDs are used for flows with the same source channel.
130
+ // CHECK-LABEL: @assign_packet_ids_same_source_channel
131
+ // CHECK: %[[C0:.*]] = arith.constant 0 : index
132
+ // CHECK: %[[C1:.*]] = arith.constant 1 : index
133
+ // CHECK: amdaie.workgroup
134
+ // CHECK: %[[TILE_0_0:.*]] = amdaie.tile(%[[C0]], %[[C0]])
135
+ // CHECK: %[[TILE_0_1:.*]] = amdaie.tile(%[[C0]], %[[C1]])
136
+ // CHECK: %[[CHANNEL:.*]] = amdaie.channel(%[[TILE_0_0]], 0, port_type = DMA, direction = MM2S)
137
+ // CHECK: %[[CHANNEL_1:.*]] = amdaie.channel(%[[TILE_0_1]], 0, port_type = DMA, direction = S2MM)
138
+ // CHECK: %[[CHANNEL_2:.*]] = amdaie.channel(%[[TILE_0_1]], 1, port_type = DMA, direction = S2MM)
139
+ // CHECK: amdaie.flow({%[[CHANNEL]]} -> {%[[CHANNEL_1]]}) {is_packet_flow = true, packet_id = 0 : ui8}
140
+ // CHECK: amdaie.flow({%[[CHANNEL]]} -> {%[[CHANNEL_2]]}) {is_packet_flow = true, packet_id = 1 : ui8}
141
+ #executable_target_amdaie_xclbin_fb = #hal.executable.target <" amd-aie" , " amdaie-xclbin-fb" , {target_device = " npu1_4col" , ukernels = " none" }>
142
+ module attributes {hal.executable.target = #executable_target_amdaie_xclbin_fb } {
143
+ func.func @assign_packet_ids_same_source_channel () {
144
+ %c0 = arith.constant 0 : index
145
+ %c1 = arith.constant 1 : index
146
+ amdaie.workgroup {
147
+ %tile_0_0 = amdaie.tile (%c0 , %c0 )
148
+ %tile_0_1 = amdaie.tile (%c0 , %c1 )
149
+ %channel = amdaie.channel (%tile_0_0 , 0 , port_type = DMA , direction = MM2S )
150
+ %channel_1 = amdaie.channel (%tile_0_1 , 0 , port_type = DMA , direction = S2MM )
151
+ %channel_2 = amdaie.channel (%tile_0_1 , 1 , port_type = DMA , direction = S2MM )
152
+ %0 = amdaie.flow ({%channel } -> {%channel_1 }) {is_packet_flow = true }
153
+ %1 = amdaie.flow ({%channel } -> {%channel_2 }) {is_packet_flow = true }
154
+ amdaie.controlcode {
155
+ amdaie.end
156
+ }
157
+ }
158
+ return
159
+ }
160
+ }
161
+
162
+ // -----
163
+
66
164
#executable_target_amdaie_xclbin_fb = #hal.executable.target <" amd-aie" , " amdaie-xclbin-fb" , {target_device = " npu1_4col" , ukernels = " none" }>
67
165
module attributes {hal.executable.target = #executable_target_amdaie_xclbin_fb } {
68
- func.func @assign_packet_ids (%arg0: memref < 8 x 16 x i32 >, %arg1: memref < 1 x 1 x 8 x 16 x i32 , 1 >, %arg2: memref < 1 x 1 x 8 x 16 x i32 , 2 > ) {
166
+ func.func @assign_packet_ids () {
69
167
%c0 = arith.constant 0 : index
70
168
%c1 = arith.constant 1 : index
71
169
amdaie.workgroup {
0 commit comments