1 // This is crashing in CI "most of the time" on a AMD Rome CPU VM on GCP with:
2 // Tracer caught signal 11: addr=0x7a800028 pc=0x2e81ba sp=0x7efd2a7ffd50
3 // LeakSanitizer has encountered a fatal error.
4 // This is hard to reproduce locally unfortunately. Disable it with ASAN/LSAN
5 // to keep the bot green for now.
6 // RUN: export LSAN_OPTIONS=detect_leaks=0
8 // RUN: mlir-opt %s -pass-pipeline="builtin.module(async-to-async-runtime,func.func(async-runtime-ref-counting,async-runtime-ref-counting-opt),convert-async-to-llvm,func.func(convert-arith-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)" \
9 // RUN: | mlir-cpu-runner \
10 // RUN: -e main -entry-point-result=void -O0 \
11 // RUN: -shared-libs=%mlir_c_runner_utils \
12 // RUN: -shared-libs=%mlir_runner_utils \
13 // RUN: -shared-libs=%mlir_async_runtime \
14 // RUN: | FileCheck %s
16 // FIXME: https://github.com/llvm/llvm-project/issues/57231
17 // UNSUPPORTED: hwasan
18 // FIXME: Windows does not have aligned_alloc
19 // UNSUPPORTED: system-windows
22 %c1 = arith.constant 1 : index
23 %c5 = arith.constant 5 : index
25 %group = async.create_group %c5 : !async.group
27 %token0 = async.execute { async.yield }
28 %token1 = async.execute { async.yield }
29 %token2 = async.execute { async.yield }
30 %token3 = async.execute { async.yield }
31 %token4 = async.execute { async.yield }
33 %0 = async.add_to_group %token0, %group : !async.token
34 %1 = async.add_to_group %token1, %group : !async.token
35 %2 = async.add_to_group %token2, %group : !async.token
36 %3 = async.add_to_group %token3, %group : !async.token
37 %4 = async.add_to_group %token4, %group : !async.token
39 %token5 = async.execute {
40 async.await_all %group
44 %group0 = async.create_group %c1 : !async.group
45 %5 = async.add_to_group %token5, %group0 : !async.token
46 async.await_all %group0
48 // CHECK: Current thread id: [[THREAD:.*]]
49 call @mlirAsyncRuntimePrintCurrentThreadId(): () -> ()
54 func.func private @mlirAsyncRuntimePrintCurrentThreadId() -> ()