File tree Expand file tree Collapse file tree 4 files changed +41
-18
lines changed Expand file tree Collapse file tree 4 files changed +41
-18
lines changed Original file line number Diff line number Diff line change @@ -4015,7 +4015,9 @@ bool SubprogramVisitor::Pre(const parser::PrefixSpec::Attributes &attrs) {
40154015 *attrs == common::CUDASubprogramAttrs::Device) {
40164016 const Scope &scope{currScope ()};
40174017 const Scope *mod{FindModuleContaining (scope)};
4018- if (mod && mod->GetName ().value () == " cudadevice" ) {
4018+ if (mod &&
4019+ (mod->GetName ().value () == " cudadevice" ||
4020+ mod->GetName ().value () == " __cuda_device" )) {
40194021 return false ;
40204022 }
40214023 // Implicitly USE the cudadevice module by copying its symbols in the
Original file line number Diff line number Diff line change 1+ ! ===-- module/__cuda_device.f90 --------------------------------------------===!
2+ !
3+ ! Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+ ! See https://llvm.org/LICENSE.txt for license information.
5+ ! SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+ !
7+ ! ===------------------------------------------------------------------------===!
8+
9+ ! This module contains CUDA Fortran interfaces used in cudadevice.f90.
10+
11+ module __cuda_device
12+ implicit none
13+
14+ ! Set PRIVATE by default to explicitly only export what is meant
15+ ! to be exported by this MODULE.
16+
17+ interface
18+ attributes(device) function __fadd_rd (x , y ) bind(c, name= ' __nv_fadd_rd' )
19+ real , intent (in ), value :: x, y
20+ real :: __fadd_rd
21+ end function
22+ end interface
23+ public :: __fadd_rd
24+
25+ interface
26+ attributes(device) function __fadd_ru (x , y ) bind(c, name= ' __nv_fadd_ru' )
27+ real , intent (in ), value :: x, y
28+ real :: __fadd_ru
29+ end function
30+ end interface
31+ public :: __fadd_ru
32+ end module
Original file line number Diff line number Diff line change 99! CUDA Fortran procedures available in device subprogram
1010
1111module cudadevice
12+ use __cuda_device, only: __fadd_rd, __fadd_ru
1213implicit none
1314
1415 ! Set PRIVATE by default to explicitly only export what is meant
@@ -71,20 +72,4 @@ attributes(device) subroutine threadfence_system()
7172 end interface
7273 public :: threadfence_system
7374
74- interface
75- attributes(device) function __fadd_rd (x , y ) bind(c, name= ' __nv_fadd_rd' )
76- real , intent (in ) :: x, y
77- real :: __fadd_rd
78- end function
79- end interface
80- public :: __fadd_rd
81-
82- interface
83- attributes(device) function __fadd_ru (x , y ) bind(c, name= ' __nv_fadd_ru' )
84- real , intent (in ) :: x, y
85- real :: __fadd_ru
86- end function
87- end interface
88- public :: __fadd_ru
89-
9075end module
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ set(MODULES_WITHOUT_IMPLEMENTATION
2121 "__ppc_intrinsics"
2222 "mma"
2323 "__cuda_builtins"
24+ "__cuda_device"
2425 "cudadevice"
2526 "ieee_arithmetic"
2627 "ieee_exceptions"
@@ -67,9 +68,12 @@ if (NOT CMAKE_CROSSCOMPILING)
6768 elseif (${filename} STREQUAL "__ppc_intrinsics" OR
6869 ${filename} STREQUAL "mma" )
6970 set (depends ${FLANG_INTRINSIC_MODULES_DIR} /__ppc_types.mod)
70- elseif (${filename} STREQUAL "cudadevice " )
71+ elseif (${filename} STREQUAL "__cuda_device " )
7172 set (opts -fc1 -xcuda)
7273 set (depends ${FLANG_INTRINSIC_MODULES_DIR} /__cuda_builtins.mod)
74+ elseif (${filename} STREQUAL "cudadevice" )
75+ set (opts -fc1 -xcuda)
76+ set (depends ${FLANG_INTRINSIC_MODULES_DIR} /__cuda_device.mod)
7377 else ()
7478 set (depends ${FLANG_INTRINSIC_MODULES_DIR} /__fortran_builtins.mod)
7579 if (${filename} STREQUAL "iso_fortran_env" )
You can’t perform that action at this time.
0 commit comments