|
1 | 1 | ! RUN: bbc -emit-hlfir -fcuda %s -o - | FileCheck %s |
2 | 2 |
|
3 | | -! Check insertion of runtime checks |
| 3 | +! Check insertion of runtime checks in host side only |
| 4 | + |
| 5 | +module section_test |
| 6 | + |
| 7 | +contains |
4 | 8 |
|
5 | | -interface |
6 | 9 | subroutine foo(a) |
7 | 10 | real, device, dimension(:,:) :: a |
8 | 11 | end subroutine |
9 | | -end interface |
10 | 12 |
|
11 | | - real, device, allocatable, dimension(:,:) :: a |
12 | | - allocate(a(10,10)) |
13 | | - call foo(a(1:10,1:10:2)) |
14 | | -end |
| 13 | + subroutine test_host() |
| 14 | + real, device, allocatable, dimension(:,:) :: a |
| 15 | + allocate(a(10,10)) |
| 16 | + call foo(a(1:10,1:10:2)) |
| 17 | + end subroutine |
| 18 | + |
| 19 | + attributes(device) subroutine zoo(a) |
| 20 | + real, device, dimension(:,:) :: a |
| 21 | + end subroutine |
15 | 22 |
|
16 | | -subroutine foo(a) |
17 | | - real, device, dimension(:,:) :: a |
18 | | -end subroutine |
| 23 | + attributes(global) subroutine test_device() |
| 24 | + real, device, allocatable, dimension(:,:) :: a |
| 25 | + allocate(a(10,10)) |
| 26 | + call zoo(a(1:10,1:10:2)) |
| 27 | + end subroutine |
| 28 | +end module |
19 | 29 |
|
20 | | -! CHECK-LABEL: func.func @_QQmain() |
| 30 | +! CHECK-LABEL: func.func @_QMsection_testPtest_host() |
21 | 31 | ! CHECK: fir.call @_FortranACUFDescriptorCheckSection |
22 | | -! CHECK: fir.call @_QPfoo |
| 32 | +! CHECK: fir.call @_QMsection_testPfoo |
| 33 | + |
| 34 | +! CHECK-LABEL: func.func @_QMsection_testPtest_device() |
| 35 | +! CHECK-NOT: fir.call @_FortranACUFDescriptorCheckSection |
| 36 | +! CHECK: fir.call @_QMsection_testPzoo |
0 commit comments