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) {
4015
4015
*attrs == common::CUDASubprogramAttrs::Device) {
4016
4016
const Scope &scope{currScope ()};
4017
4017
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" )) {
4019
4021
return false ;
4020
4022
}
4021
4023
// 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 9
9
! CUDA Fortran procedures available in device subprogram
10
10
11
11
module cudadevice
12
+ use __cuda_device, only: __fadd_rd, __fadd_ru
12
13
implicit none
13
14
14
15
! Set PRIVATE by default to explicitly only export what is meant
@@ -71,20 +72,4 @@ attributes(device) subroutine threadfence_system()
71
72
end interface
72
73
public :: threadfence_system
73
74
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
-
90
75
end module
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ set(MODULES_WITHOUT_IMPLEMENTATION
21
21
"__ppc_intrinsics"
22
22
"mma"
23
23
"__cuda_builtins"
24
+ "__cuda_device"
24
25
"cudadevice"
25
26
"ieee_arithmetic"
26
27
"ieee_exceptions"
@@ -67,9 +68,12 @@ if (NOT CMAKE_CROSSCOMPILING)
67
68
elseif (${filename} STREQUAL "__ppc_intrinsics" OR
68
69
${filename} STREQUAL "mma" )
69
70
set (depends ${FLANG_INTRINSIC_MODULES_DIR} /__ppc_types.mod )
70
- elseif (${filename} STREQUAL "cudadevice " )
71
+ elseif (${filename} STREQUAL "__cuda_device " )
71
72
set (opts -fc1 -xcuda )
72
73
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 )
73
77
else ()
74
78
set (depends ${FLANG_INTRINSIC_MODULES_DIR} /__fortran_builtins.mod )
75
79
if (${filename} STREQUAL "iso_fortran_env" )
You can’t perform that action at this time.
0 commit comments