|
| 1 | +!===----------------------------------------------------------------------===! |
| 2 | +! This directory can be used to add Integration tests involving multiple |
| 3 | +! stages of the compiler (for eg. from Fortran to LLVM IR). It should not |
| 4 | +! contain executable tests. We should only add tests here sparingly and only |
| 5 | +! if there is no other way to test. Repeat this message in each test that is |
| 6 | +! added to this directory and sub-directories. |
| 7 | +!===----------------------------------------------------------------------===! |
| 8 | + |
| 9 | +!REQUIRES: amdgpu-registered-target |
| 10 | +!RUN: %flang_fc1 -triple amdgcn-amd-amdhsa -emit-llvm -fopenmp -fopenmp-version=50 -fopenmp-is-target-device %s -o - | FileCheck %s |
| 11 | + |
| 12 | +! CHECK-NOT: define void @nested_target_in_parallel |
| 13 | +! CHECK: define weak_odr protected amdgpu_kernel void @__omp_offloading_{{.*}}_nested_target_in_parallel_{{.*}}(ptr %{{.*}}, ptr %{{.*}}) |
| 14 | +subroutine nested_target_in_parallel(v) |
| 15 | + implicit none |
| 16 | + integer, intent(inout) :: v(10) |
| 17 | + |
| 18 | + !$omp parallel |
| 19 | + !$omp target map(tofrom: v) |
| 20 | + !$omp end target |
| 21 | + !$omp end parallel |
| 22 | +end subroutine |
| 23 | + |
| 24 | +! CHECK-NOT: define void @nested_target_in_wsloop |
| 25 | +! CHECK: define weak_odr protected amdgpu_kernel void @__omp_offloading_{{.*}}_nested_target_in_wsloop_{{.*}}(ptr %{{.*}}, ptr %{{.*}}) |
| 26 | +subroutine nested_target_in_wsloop(v) |
| 27 | + implicit none |
| 28 | + integer, intent(inout) :: v(10) |
| 29 | + integer :: i |
| 30 | + |
| 31 | + !$omp do |
| 32 | + do i=1, 10 |
| 33 | + !$omp target map(tofrom: v) |
| 34 | + !$omp end target |
| 35 | + end do |
| 36 | +end subroutine |
| 37 | + |
| 38 | +! CHECK-NOT: define void @nested_target_in_parallel_with_private |
| 39 | +! CHECK: define weak_odr protected amdgpu_kernel void @__omp_offloading_{{.*}}_nested_target_in_parallel_with_private_{{.*}}(ptr %{{.*}}, ptr %{{.*}}, ptr %{{.*}}) |
| 40 | +subroutine nested_target_in_parallel_with_private(v) |
| 41 | + implicit none |
| 42 | + integer, intent(inout) :: v(10) |
| 43 | + integer :: x |
| 44 | + x = 10 |
| 45 | + |
| 46 | + !$omp parallel firstprivate(x) |
| 47 | + !$omp target map(tofrom: v(1:x)) |
| 48 | + !$omp end target |
| 49 | + !$omp end parallel |
| 50 | +end subroutine |
| 51 | + |
| 52 | +! CHECK-NOT: define void @nested_target_in_task_with_private |
| 53 | +! CHECK: define weak_odr protected amdgpu_kernel void @__omp_offloading_{{.*}}_nested_target_in_task_with_private_{{.*}}(ptr %{{.*}}, ptr %{{.*}}, ptr %{{.*}}) |
| 54 | +subroutine nested_target_in_task_with_private(v) |
| 55 | + implicit none |
| 56 | + integer, intent(inout) :: v(10) |
| 57 | + integer :: x |
| 58 | + x = 10 |
| 59 | + |
| 60 | + !$omp task firstprivate(x) |
| 61 | + !$omp target map(tofrom: v(1:x)) |
| 62 | + !$omp end target |
| 63 | + !$omp end task |
| 64 | +end subroutine |
| 65 | + |
| 66 | +! CHECK-NOT: define void @target_and_atomic_update |
| 67 | +! CHECK: define weak_odr protected amdgpu_kernel void @__omp_offloading_{{.*}}_target_and_atomic_update_{{.*}}(ptr %{{.*}}) |
| 68 | +subroutine target_and_atomic_update(x, expr) |
| 69 | + implicit none |
| 70 | + integer, intent(inout) :: x, expr |
| 71 | + |
| 72 | + !$omp target |
| 73 | + !$omp end target |
| 74 | + |
| 75 | + !$omp atomic update |
| 76 | + x = x + expr |
| 77 | +end subroutine |
| 78 | + |
| 79 | +! CHECK-NOT: define void @nested_target_in_associate |
| 80 | +! CHECK: define weak_odr protected amdgpu_kernel void @__omp_offloading_{{.*}}_nested_target_in_associate_{{.*}}(ptr %{{.*}}, ptr %{{.*}}, ptr %{{.*}}) |
| 81 | +subroutine nested_target_in_associate(x) |
| 82 | + integer, pointer, contiguous :: x(:) |
| 83 | + associate(y => x) |
| 84 | + !$omp target map(tofrom: y) |
| 85 | + !$omp end target |
| 86 | + end associate |
| 87 | +end subroutine |
0 commit comments