Lines Matching +full:- +full:- +full:token

1 // RUN: mlir-opt %s -split-input-file -async-func-to-async-runtime             \
2 // RUN: -async-to-async-runtime | FileCheck %s --dump-input=always
4 // CHECK-LABEL: @execute_no_async_args
6 %token = async.execute {
11 async.await %token : !async.token
16 // CHECK-LABEL: func private @async_execute_fn
17 // CHECK-SAME: -> !async.token
19 // Create token for return op, and mark a function as a coroutine.
20 // CHECK: %[[TOKEN:.*]] = async.runtime.create : !async.token
28 // CHECK-SAME: ^[[SUSPEND:.*]], ^[[RESUME:.*]], ^[[DESTROY:.*]]
33 // CHECK: async.runtime.set_available %[[TOKEN]]
47 // CHECK: return %[[TOKEN]]
49 // -----
51 // CHECK-LABEL: @nested_async_execute
53 // CHECK: %[[TOKEN:.*]] = call @async_execute_fn_0(%arg0, %arg2, %arg1)
62 async.await %token1 : !async.token
67 // CHECK: async.runtime.await %[[TOKEN]]
68 // CHECK: %[[IS_ERROR:.*]] = async.runtime.is_error %[[TOKEN]]
72 // CHECK-NEXT: return
73 async.await %token0 : !async.token
78 // CHECK-LABEL: func private @async_execute_fn
79 // CHECK-SAME: -> !async.token
81 // CHECK: %[[TOKEN:.*]] = async.runtime.create : !async.token
87 // CHECK-SAME: ^[[SUSPEND:.*]], ^[[RESUME:.*]], ^[[DESTROY:.*]]
91 // CHECK: async.runtime.set_available %[[TOKEN]]
98 // CHECK-LABEL: func private @async_execute_fn_0
99 // CHECK-SAME: -> !async.token
101 // CHECK: %[[TOKEN:.*]] = async.runtime.create : !async.token
108 // CHECK-SAME: ^[[SUSPEND:.*]], ^[[RESUME_0:.*]], ^[[DESTROY_0:.*]]
116 // CHECK-SAME: ^[[SUSPEND]], ^[[RESUME_1:.*]], ^[[DESTROY_0]]
118 // Check the error of the awaited token after resumption.
123 // Set token available if the token is not in the error state.
126 // CHECK: async.runtime.set_available %[[TOKEN]]
134 // -----
136 // CHECK-LABEL: @async_execute_token_dependency
138 // CHECK: %[[TOKEN:.*]] = call @async_execute_fn
139 %token = async.execute {
144 // CHECK: call @async_execute_fn_0(%[[TOKEN]], %arg0, %arg1)
145 %token_0 = async.execute [%token] {
154 // CHECK-LABEL: func private @async_execute_fn
155 // CHECK-SAME: -> !async.token
156 // CHECK: %[[TOKEN:.*]] = async.runtime.create : !async.token
157 // CHECK: return %[[TOKEN]] : !async.token
160 // CHECK-LABEL: func private @async_execute_fn_0
161 // CHECK-SAME: %[[ARG0:.*]]: !async.token
162 // CHECK-SAME: %[[ARG1:.*]]: f32
163 // CHECK-SAME: %[[ARG2:.*]]: memref<1xf32>
164 // CHECK-SAME: -> !async.token
165 // CHECK: %[[TOKEN:.*]] = async.runtime.create : !async.token
171 // CHECK-SAME: ^[[SUSPEND:.*]], ^[[RESUME_0:.*]], ^[[CLEANUP:.*]]
173 // Suspend coroutine second time waiting for the completion of token dependency.
178 // CHECK-SAME: ^[[SUSPEND]], ^[[RESUME_1:.*]], ^[[CLEANUP]]
180 // Check the error of the awaited token after resumption.
185 // Emplace result token after second resumption and error checking.
188 // CHECK: async.runtime.set_available %[[TOKEN]]
193 // -----
195 // CHECK-LABEL: @async_group_await_all
202 // CHECK: %[[TOKEN:.*]] = call @async_execute_fn
203 %token = async.execute { async.yield }
204 // CHECK: async.runtime.add_to_group %[[TOKEN]], %[[GROUP]]
205 async.add_to_group %token, %0 : !async.token
219 // CHECK-LABEL: func private @async_execute_fn_0
220 // CHECK-SAME: (%[[ARG:.*]]: !async.group) -> !async.token
222 // CHECK: %[[TOKEN:.*]] = async.runtime.create : !async.token
228 // CHECK-SAME: ^[[SUSPEND:.*]], ^[[RESUME_0:.*]], ^[[CLEANUP:.*]]
234 // CHECK-SAME: ^[[SUSPEND]], ^[[RESUME_1:.*]], ^[[CLEANUP]]
236 // Check the error of the awaited token after resumption.
241 // Emplace result token after error checking.
243 // CHECK: async.runtime.set_available %[[TOKEN]]
248 // -----
250 // CHECK-LABEL: @execute_and_return_f32
251 func.func @execute_and_return_f32() -> f32 {
253 %token, %result = async.execute -> !async.value<f32> {
267 // CHECK-LABEL: func private @async_execute_fn()
268 // CHECK: %[[TOKEN:.*]] = async.runtime.create : !async.token
275 // CHECK-SAME: ^[[SUSPEND:.*]], ^[[RESUME:.*]], ^[[CLEANUP:.*]]
282 // CHECK: async.runtime.set_available %[[TOKEN]]
287 // -----
289 // CHECK-LABEL: @async_value_operands
292 %token, %result = async.execute -> !async.value<f32> {
297 // CHECK: %[[TOKEN:.*]] = call @async_execute_fn_0(%[[RET]]#1)
303 // CHECK: async.runtime.await %[[TOKEN]] : !async.token
304 async.await %token0 : !async.token
310 // CHECK-LABEL: func private @async_execute_fn()
313 // CHECK-LABEL: func private @async_execute_fn_0
314 // CHECK-SAME: (%[[ARG:.*]]: !async.value<f32>) -> !async.token
316 // CHECK: %[[TOKEN:.*]] = async.runtime.create : !async.token
322 // CHECK-SAME: ^[[SUSPEND:.*]], ^[[RESUME_0:.*]], ^[[CLEANUP:.*]]
328 // CHECK-SAME: ^[[SUSPEND]], ^[[RESUME_1:.*]], ^[[CLEANUP]]
330 // Check the error of the awaited token after resumption.
339 // CHECK: async.runtime.set_available %[[TOKEN]]
344 // -----
346 // CHECK-LABEL: @execute_assertion
348 %token = async.execute {
352 async.await %token : !async.token
357 // CHECK-LABEL: func private @async_execute_fn(
358 // CHECK-SAME: %[[ARG0:.*]]: i1
359 // CHECK-SAME: -> !async.token
361 // Create token for return op, and mark a function as a coroutine.
362 // CHECK: %[[TOKEN:.*]] = async.runtime.create : !async.token
368 // CHECK-SAME: ^[[SUSPEND:.*]], ^[[RESUME:.*]], ^[[DESTROY:.*]]
374 // Set coroutine completion token to available state.
376 // CHECK: async.runtime.set_available %[[TOKEN]]
379 // Set coroutine completion token to error state.
381 // CHECK: async.runtime.set_error %[[TOKEN]]
395 // CHECK: return %[[TOKEN]]
397 // -----
399 // lowered to branch-based control flow to enable coroutine CFG rewrite.
401 // CHECK-LABEL: @lower_scf_to_cfg
406 async.await %token0 : !async.token
408 async.await %token0 : !async.token
416 // CHECK-LABEL: func private @async_execute_fn(
417 // CHECK-SAME: -> !async.token
420 // CHECK-LABEL: func private @async_execute_fn_0(
421 // CHECK: %[[TOKEN:.*]]: !async.token
423 // CHECK-SAME: -> !async.token
426 // CHECK-NOT: scf.if
429 // -----
433 // CHECK-LABEL: @clone_constants
436 %token = async.execute {
440 async.await %token : !async.token
445 // CHECK-LABEL: func private @async_execute_fn(
446 // CHECK-SAME: %[[VALUE:arg[0-9]+]]: f32,
447 // CHECK-SAME: %[[MEMREF:arg[0-9]+]]: memref<1xf32>
448 // CHECK-SAME: ) -> !async.token
452 // -----
455 // CHECK-LABEL: @async_func_await
457 -> !async.token {
461 // Create token for return op, and mark a function as a coroutine.
462 // CHECK: %[[TOKEN:.*]] = async.runtime.create : !async.token
470 // CHECK-SAME: !async.value<f32>
472 // CHECK-SAME: ^[[SUSPEND:.*]], ^[[RESUME:.*]], ^[[CLEANUP:.*]]
474 // -----
477 // CHECK-LABEL: @execute_in_async_func
479 -> !async.token {
480 %token = async.execute {
485 async.await %token : !async.token
490 // CHECK-SAME: %[[VALUE:arg[0-9]+]],
491 // CHECK-SAME: %[[MEMREF:arg[0-9]+]]
492 // CHECK-SAME: ) : (f32, memref<1xf32>) -> !async.token
495 // CHECK-LABEL: func private @async_execute_fn(
496 // CHECK-SAME: %[[VALUE:arg[0-9]+]]: f32,
497 // CHECK-SAME: %[[MEMREF:arg[0-9]+]]: memref<1xf32>
498 // CHECK-SAME: ) -> !async.token