45 lines · plain
1! RUN: %flang_fc1 -fdebug-dump-symbols %s | FileCheck %s2 3! Test CUDA Fortran intrinsic can pass semantic4 5attributes(global) subroutine devsub()6 implicit none7 integer :: ret8 9 ! 3.6.4. Synchronization Functions10 call syncthreads()11 call syncwarp(1)12 call threadfence()13 call threadfence_block()14 call threadfence_system()15 ret = syncthreads_and(1)16 ret = syncthreads_count(1)17 ret = syncthreads_or(1)18end19 20! CHECK-LABEL: Subprogram scope: devsub21! CHECK: syncthreads (Subroutine): Use from syncthreads in cudadevice22! CHECK: syncthreads_and (Function): Use from syncthreads_and in cudadevice23! CHECK: syncthreads_count (Function): Use from syncthreads_count in cudadevice24! CHECK: syncthreads_or (Function): Use from syncthreads_or in cudadevice25! CHECK: syncwarp (Subroutine): Use from syncwarp in cudadevice26! CHECK: threadfence (Subroutine): Use from threadfence in cudadevice27! CHECK: threadfence_block (Subroutine): Use from threadfence_block in cudadevice28! CHECK: threadfence_system (Subroutine): Use from threadfence_system in cudadevice29 30subroutine host()31 real(4) :: af32 real(8) :: ad33 integer(4) :: ai34 integer(8) :: al35 call syncthreads()36 ai = atomicadd(ai, 1_4)37 al = atomicadd(al, 1_8)38 af = atomicadd(af, 1.0_4)39 ad = atomicadd(ad, 1.0_8)40end subroutine41 42! CHECK-LABEL: Subprogram scope: host43! CHECK: atomicadd, EXTERNAL: HostAssoc => atomicadd, EXTERNAL (Function, Implicit): ProcEntity REAL(4){{$}}44! CHECK: syncthreads, EXTERNAL: HostAssoc => syncthreads, EXTERNAL (Subroutine): ProcEntity{{$}}45