brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.5 KiB · ece32bb Raw
54 lines · plain
1// RUN: mlir-translate -mlir-to-llvmir %s | FileCheck %s2 3module attributes {omp.is_target_device = false} {4  llvm.func @omp_target_depend_() {5    %0 = llvm.mlir.constant(39 : index) : i646    %1 = llvm.mlir.constant(1 : index) : i647    %2 = llvm.mlir.constant(40 : index) : i648    %3 = omp.map.bounds lower_bound(%1 : i64) upper_bound(%0 : i64) extent(%2 : i64) stride(%1 : i64) start_idx(%1 : i64)9    %4 = llvm.mlir.addressof @_QFEa : !llvm.ptr10    %5 = omp.map.info var_ptr(%4 : !llvm.ptr, !llvm.array<40 x i32>) map_clauses(from) capture(ByRef) bounds(%3) -> !llvm.ptr {name = "a"}11    omp.target depend(taskdependin -> %4 : !llvm.ptr) map_entries(%5 -> %arg0 : !llvm.ptr) {12      %6 = llvm.mlir.constant(100 : index) : i3213      llvm.store %6, %arg0 : i32, !llvm.ptr14      omp.terminator15    }16    llvm.return17  }18 19  llvm.mlir.global internal @_QFEa() {addr_space = 0 : i32} : !llvm.array<40 x i32> {20    %0 = llvm.mlir.zero : !llvm.array<40 x i32>21    llvm.return %0 : !llvm.array<40 x i32>22  }23}24 25// CHECK: define void @omp_target_depend_()26// CHECK-NOT: define {{.*}} @27// CHECK-NOT: call i32 @__tgt_target_kernel({{.*}})28// CHECK:  call void @__kmpc_omp_task_begin_if029// CHECK-NEXT: call void @.omp_target_task_proxy_func30// CHECK: call void @__kmpc_omp_task_complete_if031// https://github.com/llvm/llvm-project/issues/126949 exposes two issues32// 1. Empty target task proxy functions33// 2. When 1 fixed, it leads to a second problem of calling the omp target kernel twice34//    Once via the target task proxy function and a second time after the target task is done.35// The following checks check problem #2.36// functions. The following checks tests the fix for this issue.37// CHECK-NEXT:  br label %[[BLOCK_AFTER_OUTLINED_TARGET_TASK_BODY:.*]]38// CHECK:[[BLOCK_AFTER_OUTLINED_TARGET_TASK_BODY]]:39// CHECK-NEXT:  ret void40 41// CHECK: define internal void @omp_target_depend_..omp_par42// CHECK: call void @__omp_offloading_[[DEV:.*]]_[[FIL:.*]]_omp_target_depend__l[[LINE:.*]](ptr {{.*}})43// CHECK-NEXT: br label %[[BLOCK_AFTER_TARGET_TASK_BODY:.*]]44// CHECK: [[BLOCK_AFTER_TARGET_TASK_BODY]]:45// CHECK-NEXT: ret void46 47 48// CHECK: define internal void @__omp_offloading_[[DEV]]_[[FIL]]_omp_target_depend__l[[LINE]](ptr %[[ADDR_A:.*]])49// CHECK: store i32 100, ptr %[[ADDR_A]], align 450 51// The following check test for the fix of problem #1 as described in https://github.com/llvm/llvm-project/issues/12694952// CHECK: define internal void @.omp_target_task_proxy_func53// CHECK: call void @omp_target_depend_..omp_par54