aboutsummaryrefslogtreecommitdiff
path: root/mlir/test/Dialect/OpenACC/pointer-like-interface-alloc.mlir
blob: 603ace85072ac9ccfbd6b38bb94940f3698e467d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// RUN: mlir-opt %s --split-input-file --pass-pipeline="builtin.module(func.func(test-acc-pointer-like-interface{test-mode=alloc}))" 2>&1 | FileCheck %s

func.func @test_static_memref_alloc() {
  %0 = memref.alloca() {test.ptr} : memref<10x20xf32>
  // CHECK: Successfully generated alloc for operation: %[[ORIG:.*]] = memref.alloca() {test.ptr} : memref<10x20xf32>
  // CHECK: Generated: %{{.*}} = memref.alloca() : memref<10x20xf32>
  return
}

// -----

func.func @test_dynamic_memref_alloc() {
  %c10 = arith.constant 10 : index
  %c20 = arith.constant 20 : index
  %orig = memref.alloc(%c10, %c20) {test.ptr} : memref<?x?xf32>
  
  // CHECK: Successfully generated alloc for operation: %[[ORIG:.*]] = memref.alloc(%[[C10:.*]], %[[C20:.*]]) {test.ptr} : memref<?x?xf32>
  // CHECK: Generated: %[[C0:.*]] = arith.constant 0 : index
  // CHECK: Generated: %[[DIM0:.*]] = memref.dim %[[ORIG]], %[[C0]] : memref<?x?xf32>
  // CHECK: Generated: %[[C1:.*]] = arith.constant 1 : index
  // CHECK: Generated: %[[DIM1:.*]] = memref.dim %[[ORIG]], %[[C1]] : memref<?x?xf32>
  // CHECK: Generated: %{{.*}} = memref.alloc(%[[DIM0]], %[[DIM1]]) : memref<?x?xf32>
  return
}