79 lines · plain
1// RUN: mlir-opt %s -split-input-file -test-acc-support | FileCheck %s2 3// Test private recipe with 2D memref4func.func @test_private_2d_memref() {5 // Create a 2D memref6 %0 = memref.alloca() {test.recipe_name = #acc.recipe_kind<private_recipe>} : memref<5x10xf32>7 8 // CHECK: op=%{{.*}} = memref.alloca() {test.recipe_name = #acc.recipe_kind<private_recipe>} : memref<5x10xf32>9 // CHECK-NEXT: getRecipeName(kind=private_recipe, type=memref<5x10xf32>)="privatization_memref_5x10xf32_"10 11 return12}13 14// -----15 16// Test firstprivate recipe with 2D memref17func.func @test_firstprivate_2d_memref() {18 // Create a 2D memref19 %0 = memref.alloca() {test.recipe_name = #acc.recipe_kind<firstprivate_recipe>} : memref<8x16xf64>20 21 // CHECK: op=%{{.*}} = memref.alloca() {test.recipe_name = #acc.recipe_kind<firstprivate_recipe>} : memref<8x16xf64>22 // CHECK-NEXT: getRecipeName(kind=firstprivate_recipe, type=memref<8x16xf64>)="firstprivatization_memref_8x16xf64_"23 24 return25}26 27// -----28 29// Test reduction recipe with 2D memref30func.func @test_reduction_2d_memref() {31 // Create a 2D memref32 %0 = memref.alloca() {test.recipe_name = #acc.recipe_kind<reduction_recipe>} : memref<4x8xi32>33 34 // CHECK: op=%{{.*}} = memref.alloca() {test.recipe_name = #acc.recipe_kind<reduction_recipe>} : memref<4x8xi32>35 // CHECK-NEXT: getRecipeName(kind=reduction_recipe, type=memref<4x8xi32>)="reduction_memref_4x8xi32_"36 37 return38}39 40// -----41 42// Test private recipe with dynamic memref43func.func @test_private_dynamic_memref(%arg0: memref<5x10xi32>) {44 // Cast to dynamic dimensions45 %0 = memref.cast %arg0 {test.recipe_name = #acc.recipe_kind<private_recipe>} : memref<5x10xi32> to memref<?x10xi32>46 47 // CHECK: op=%{{.*}} = memref.cast %{{.*}} {test.recipe_name = #acc.recipe_kind<private_recipe>} : memref<5x10xi32> to memref<?x10xi32>48 // CHECK-NEXT: getRecipeName(kind=private_recipe, type=memref<?x10xi32>)="privatization_memref_Ux10xi32_"49 50 return51}52 53// -----54 55// Test private recipe with scalar memref56func.func @test_private_scalar_memref() {57 // Create a scalar memref (no dimensions)58 %0 = memref.alloca() {test.recipe_name = #acc.recipe_kind<private_recipe>} : memref<i32>59 60 // CHECK: op=%{{.*}} = memref.alloca() {test.recipe_name = #acc.recipe_kind<private_recipe>} : memref<i32>61 // CHECK-NEXT: getRecipeName(kind=private_recipe, type=memref<i32>)="privatization_memref_i32_"62 63 return64}65 66// -----67 68// Test private recipe with unranked memref69func.func @test_private_unranked_memref(%arg0: memref<10xi32>) {70 // Cast to unranked memref71 %0 = memref.cast %arg0 {test.recipe_name = #acc.recipe_kind<private_recipe>} : memref<10xi32> to memref<*xi32>72 73 // CHECK: op=%{{.*}} = memref.cast %{{.*}} {test.recipe_name = #acc.recipe_kind<private_recipe>} : memref<10xi32> to memref<*xi32>74 // CHECK-NEXT: getRecipeName(kind=private_recipe, type=memref<*xi32>)="privatization_memref_Zxi32_"75 76 return77}78 79