| 1 |
! RUN: bbc -emit-hlfir -fcuda %s -o - | FileCheck %s |
| 2 |
! RUN: bbc -emit-hlfir -fcuda %s -o - | fir-opt -convert-hlfir-to-fir | FileCheck %s |
| 3 |
|
| 4 |
! Test lowering of CUDA attribute on procedures. |
| 5 |
|
| 6 |
attributes(host) subroutine sub_host(); end |
| 7 |
! CHECK: func.func @_QPsub_host() attributes {cuf.proc_attr = #cuf.cuda_proc<host>} |
| 8 |
|
| 9 |
attributes(device) subroutine sub_device(); end |
| 10 |
! CHECK: func.func @_QPsub_device() attributes {cuf.proc_attr = #cuf.cuda_proc<device>} |
| 11 |
|
| 12 |
attributes(host) attributes(device) subroutine sub_host_device; end |
| 13 |
! CHECK: func.func @_QPsub_host_device() attributes {cuf.proc_attr = #cuf.cuda_proc<host_device>} |
| 14 |
|
| 15 |
attributes(device) attributes(host) subroutine sub_device_host; end |
| 16 |
! CHECK: func.func @_QPsub_device_host() attributes {cuf.proc_attr = #cuf.cuda_proc<host_device>} |
| 17 |
|
| 18 |
attributes(global) subroutine sub_global(); end |
| 19 |
! CHECK: func.func @_QPsub_global() attributes {cuf.proc_attr = #cuf.cuda_proc<global>} |
| 20 |
|
| 21 |
attributes(grid_global) subroutine sub_grid_global(); end |
| 22 |
! CHECK: func.func @_QPsub_grid_global() attributes {cuf.proc_attr = #cuf.cuda_proc<grid_global>} |
| 23 |
|
| 24 |
attributes(host) integer function fct_host(); end |
| 25 |
! CHECK: func.func @_QPfct_host() -> i32 attributes {cuf.proc_attr = #cuf.cuda_proc<host>} |
| 26 |
|
| 27 |
attributes(device) integer function fct_device(); end |
| 28 |
! CHECK: func.func @_QPfct_device() -> i32 attributes {cuf.proc_attr = #cuf.cuda_proc<device>} |
| 29 |
|
| 30 |
attributes(host) attributes(device) integer function fct_host_device; end |
| 31 |
! CHECK: func.func @_QPfct_host_device() -> i32 attributes {cuf.proc_attr = #cuf.cuda_proc<host_device>} |
| 32 |
|
| 33 |
attributes(device) attributes(host) integer function fct_device_host; end |
| 34 |
! CHECK: func.func @_QPfct_device_host() -> i32 attributes {cuf.proc_attr = #cuf.cuda_proc<host_device>} |
| 35 |
|
| 36 |
attributes(global) launch_bounds(1, 2) subroutine sub_lbounds1(); end |
| 37 |
! CHECK: func.func @_QPsub_lbounds1() attributes {cuf.launch_bounds = #cuf.launch_bounds<maxTPB = 1 : i64, minBPM = 2 : i64>, cuf.proc_attr = #cuf.cuda_proc<global>} |
| 38 |
|
| 39 |
attributes(global) launch_bounds(1, 2, 3) subroutine sub_lbounds2(); end |
| 40 |
! CHECK: func.func @_QPsub_lbounds2() attributes {cuf.launch_bounds = #cuf.launch_bounds<maxTPB = 1 : i64, minBPM = 2 : i64, upperBoundClusterSize = 3 : i64>, cuf.proc_attr = #cuf.cuda_proc<global>} |
| 41 |
|
| 42 |
attributes(global) cluster_dims(1, 2, 3) subroutine sub_clusterdims1(); end |
| 43 |
! CHECK: func.func @_QPsub_clusterdims1() attributes {cuf.cluster_dims = #cuf.cluster_dims<x = 1 : i64, y = 2 : i64, z = 3 : i64>, cuf.proc_attr = #cuf.cuda_proc<global>} |