44 lines · plain
1! RUN: bbc -emit-hlfir -fcuda %s -o - | FileCheck %s2! RUN: bbc -emit-hlfir -fcuda %s -o - | fir-opt -convert-hlfir-to-fir | FileCheck %s3 4! Test lowering of CUDA attribute on procedures.5 6attributes(host) subroutine sub_host(); end7! CHECK: func.func @_QPsub_host() attributes {cuf.proc_attr = #cuf.cuda_proc<host>}8 9attributes(device) subroutine sub_device(); end10! CHECK: func.func @_QPsub_device() attributes {cuf.proc_attr = #cuf.cuda_proc<device>}11 12attributes(host) attributes(device) subroutine sub_host_device; end13! CHECK: func.func @_QPsub_host_device() attributes {cuf.proc_attr = #cuf.cuda_proc<host_device>}14 15attributes(device) attributes(host) subroutine sub_device_host; end16! CHECK: func.func @_QPsub_device_host() attributes {cuf.proc_attr = #cuf.cuda_proc<host_device>}17 18attributes(global) subroutine sub_global(); end19! CHECK: func.func @_QPsub_global() attributes {cuf.proc_attr = #cuf.cuda_proc<global>}20 21attributes(grid_global) subroutine sub_grid_global(); end22! CHECK: func.func @_QPsub_grid_global() attributes {cuf.proc_attr = #cuf.cuda_proc<grid_global>}23 24attributes(host) integer function fct_host(); end25! CHECK: func.func @_QPfct_host() -> i32 attributes {cuf.proc_attr = #cuf.cuda_proc<host>}26 27attributes(device) integer function fct_device(); end28! CHECK: func.func @_QPfct_device() -> i32 attributes {cuf.proc_attr = #cuf.cuda_proc<device>}29 30attributes(host) attributes(device) integer function fct_host_device; end31! CHECK: func.func @_QPfct_host_device() -> i32 attributes {cuf.proc_attr = #cuf.cuda_proc<host_device>}32 33attributes(device) attributes(host) integer function fct_device_host; end34! CHECK: func.func @_QPfct_device_host() -> i32 attributes {cuf.proc_attr = #cuf.cuda_proc<host_device>}35 36attributes(global) launch_bounds(1, 2) subroutine sub_lbounds1(); end37! 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 39attributes(global) launch_bounds(1, 2, 3) subroutine sub_lbounds2(); end40! 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 42attributes(global) cluster_dims(1, 2, 3) subroutine sub_clusterdims1(); end43! 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>}44