Commit 51bf969
authored
[Wave] Enable async kernel execution with iree runtime and fully switch to Launchable (#11)
Drop our `invoke_vmfb` code entirely, use `turbine.runtime.Lauchable`
and udate dispatch codegen to support async launch.
Before:
```
func.func @isolated_benchmark(%arg0: tensor<8x?x128x6xf32>, %arg1: tensor<8x?x6xf32>, %arg2: tensor<?xi32>, %arg3: tensor<?x6x128xf16>, %arg4: index) -> tensor<?x6x128xf16> {
%0 = flow.dispatch @phase_1::@phase_1[%arg4](%arg0, %arg1, %arg2, %arg3, %arg4) : (tensor<8x?x128x6xf32>{%arg4}, tensor<8x?x6xf32>{%arg4}, tensor<?xi32>{%arg4}, tensor<?x6x128xf16>{%arg4}, index) -> %arg3{%arg4}
return %0 : tensor<?x6x128xf16>
}
```
After:
```
func.func @isolated_benchmark$async(%arg0: !hal.buffer_view, %arg1: !hal.buffer_view, %arg2: !hal.buffer_view, %arg3: !hal.buffer_view, %arg4: index, %arg5: !hal.fence, %arg6: !hal.fence) -> !hal.buffer_view {
%0 = hal.tensor.import wait(%arg5) => %arg0 : !hal.buffer_view -> tensor<8x?x128x6xf32>{%arg4}
%1 = hal.tensor.import wait(%arg5) => %arg1 : !hal.buffer_view -> tensor<8x?x6xf32>{%arg4}
%2 = hal.tensor.import wait(%arg5) => %arg2 : !hal.buffer_view -> tensor<?xi32>{%arg4}
%3 = hal.tensor.import wait(%arg5) => %arg3 : !hal.buffer_view -> tensor<?x6x128xf16>{%arg4}
%4 = flow.dispatch @phase_1::@phase_1[%arg4](%0, %1, %2, %3, %arg4) : (tensor<8x?x128x6xf32>{%arg4}, tensor<8x?x6xf32>{%arg4}, tensor<?xi32>{%arg4}, tensor<?x6x128xf16>{%arg4}, index) -> %3{%arg4}
%5 = hal.tensor.barrier join(%4 : tensor<?x6x128xf16>) => %arg6 : !hal.fence
%6 = hal.tensor.export %5 : tensor<?x6x128xf16>{%arg4} -> !hal.buffer_view
return %6 : !hal.buffer_view
}
```
Also, add some python profiling code to `WaveKernel` launch func.
Launch overhead for the iree runtime is still bad (around x5 of
`wave_runtime`) but ability to run kernels async is overall improvement.
---------
Signed-off-by: Ivan Butygin <[email protected]>1 parent 7050dc6 commit 51bf969
File tree
10 files changed
+207
-172
lines changed- lit_tests/kernel/wave
- wave_lang
- kernel
- compiler
- wave
- utils
- support
10 files changed
+207
-172
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2167 | 2167 | | |
2168 | 2168 | | |
2169 | 2169 | | |
| 2170 | + | |
| 2171 | + | |
2170 | 2172 | | |
2171 | 2173 | | |
2172 | 2174 | | |
| |||
2177 | 2179 | | |
2178 | 2180 | | |
2179 | 2181 | | |
| 2182 | + | |
| 2183 | + | |
| 2184 | + | |
2180 | 2185 | | |
2181 | | - | |
| 2186 | + | |
2182 | 2187 | | |
2183 | 2188 | | |
2184 | 2189 | | |
| |||
2220 | 2225 | | |
2221 | 2226 | | |
2222 | 2227 | | |
| 2228 | + | |
| 2229 | + | |
2223 | 2230 | | |
2224 | 2231 | | |
2225 | 2232 | | |
| |||
2230 | 2237 | | |
2231 | 2238 | | |
2232 | 2239 | | |
| 2240 | + | |
| 2241 | + | |
| 2242 | + | |
2233 | 2243 | | |
2234 | | - | |
| 2244 | + | |
2235 | 2245 | | |
2236 | 2246 | | |
2237 | 2247 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
101 | | - | |
| 101 | + | |
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
| 168 | + | |
168 | 169 | | |
169 | 170 | | |
170 | 171 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
| |||
31 | 33 | | |
32 | 34 | | |
33 | 35 | | |
34 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
35 | 40 | | |
36 | 41 | | |
37 | 42 | | |
| |||
41 | 46 | | |
42 | 47 | | |
43 | 48 | | |
44 | | - | |
| 49 | + | |
45 | 50 | | |
46 | 51 | | |
47 | 52 | | |
| |||
79 | 84 | | |
80 | 85 | | |
81 | 86 | | |
| 87 | + | |
82 | 88 | | |
83 | 89 | | |
84 | 90 | | |
85 | 91 | | |
86 | 92 | | |
87 | | - | |
| 93 | + | |
| 94 | + | |
88 | 95 | | |
89 | 96 | | |
90 | 97 | | |
| |||
93 | 100 | | |
94 | 101 | | |
95 | 102 | | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
96 | 108 | | |
97 | | - | |
| 109 | + | |
98 | 110 | | |
99 | 111 | | |
100 | 112 | | |
| |||
110 | 122 | | |
111 | 123 | | |
112 | 124 | | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
113 | 128 | | |
114 | 129 | | |
115 | 130 | | |
116 | 131 | | |
117 | 132 | | |
118 | 133 | | |
119 | 134 | | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
120 | 158 | | |
121 | 159 | | |
122 | 160 | | |
| |||
142 | 180 | | |
143 | 181 | | |
144 | 182 | | |
145 | | - | |
| 183 | + | |
146 | 184 | | |
147 | 185 | | |
148 | | - | |
| 186 | + | |
149 | 187 | | |
150 | 188 | | |
151 | 189 | | |
152 | 190 | | |
153 | 191 | | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
154 | 215 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
199 | 199 | | |
200 | 200 | | |
201 | 201 | | |
| 202 | + | |
202 | 203 | | |
203 | 204 | | |
204 | 205 | | |
| |||
0 commit comments