xref: /llvm-project/mlir/test/Dialect/GPU/bufferization-buffer-deallocation.mlir (revision fbb62d449c47bb0b49c0727c926373b41a8183c5)
1// RUN: mlir-opt %s -buffer-deallocation-pipeline --allow-unregistered-dialect | FileCheck %s
2
3func.func @gpu_launch() {
4  %c1 = arith.constant 1 : index
5  gpu.launch blocks(%arg0, %arg1, %arg2) in (%arg6 = %c1, %arg7 = %c1, %arg8 = %c1)
6    threads(%arg3, %arg4, %arg5) in (%arg9 = %c1, %arg10 = %c1, %arg11 = %c1) {
7    %alloc = memref.alloc() : memref<2xf32>
8    "test.read_buffer"(%alloc) : (memref<2xf32>) -> ()
9    gpu.terminator
10  }
11  return
12}
13
14// CHECK-LABEL: func @gpu_launch
15//       CHECK:   gpu.launch
16//       CHECK:     [[ALLOC:%.+]] = memref.alloc(
17//       CHECK:     memref.dealloc [[ALLOC]]
18//       CHECK:     gpu.terminator
19