25 lines · plain
1// RUN: mlir-opt %s --split-input-file --pass-pipeline="builtin.module(func.func(test-acc-pointer-like-interface{test-mode=alloc}))" 2>&1 | FileCheck %s2 3func.func @test_static_memref_alloc() {4 %0 = memref.alloca() {test.ptr} : memref<10x20xf32>5 // CHECK: Successfully generated alloc for operation: %[[ORIG:.*]] = memref.alloca() {test.ptr} : memref<10x20xf32>6 // CHECK: Generated: %{{.*}} = memref.alloca() {acc.var_name = #acc.var_name<"test_alloc">} : memref<10x20xf32>7 return8}9 10// -----11 12func.func @test_dynamic_memref_alloc() {13 %c10 = arith.constant 10 : index14 %c20 = arith.constant 20 : index15 %orig = memref.alloc(%c10, %c20) {test.ptr} : memref<?x?xf32>16 17 // CHECK: Successfully generated alloc for operation: %[[ORIG:.*]] = memref.alloc(%[[C10:.*]], %[[C20:.*]]) {test.ptr} : memref<?x?xf32>18 // CHECK: Generated: %[[C0:.*]] = arith.constant 0 : index19 // CHECK: Generated: %[[DIM0:.*]] = memref.dim %[[ORIG]], %[[C0]] : memref<?x?xf32>20 // CHECK: Generated: %[[C1:.*]] = arith.constant 1 : index21 // CHECK: Generated: %[[DIM1:.*]] = memref.dim %[[ORIG]], %[[C1]] : memref<?x?xf32>22 // CHECK: Generated: %{{.*}} = memref.alloc(%[[DIM0]], %[[DIM1]]) {acc.var_name = #acc.var_name<"test_alloc">} : memref<?x?xf32>23 return24}25