[flang][cuda] Move interface to __cuda_device (#122771)

This commit is contained in:
Valentin Clement (バレンタイン クレメン)
2025-01-13 17:28:34 -08:00
committed by GitHub
parent ba4dc5a0d6
commit c701c18bed
4 changed files with 41 additions and 18 deletions

View File

@@ -0,0 +1,32 @@
!===-- module/__cuda_device.f90 --------------------------------------------===!
!
! Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
! See https://llvm.org/LICENSE.txt for license information.
! SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
!
!===------------------------------------------------------------------------===!
! This module contains CUDA Fortran interfaces used in cudadevice.f90.
module __cuda_device
implicit none
! Set PRIVATE by default to explicitly only export what is meant
! to be exported by this MODULE.
interface
attributes(device) function __fadd_rd(x, y) bind(c, name='__nv_fadd_rd')
real, intent(in), value :: x, y
real :: __fadd_rd
end function
end interface
public :: __fadd_rd
interface
attributes(device) function __fadd_ru(x, y) bind(c, name='__nv_fadd_ru')
real, intent(in), value :: x, y
real :: __fadd_ru
end function
end interface
public :: __fadd_ru
end module

View File

@@ -9,6 +9,7 @@
! CUDA Fortran procedures available in device subprogram
module cudadevice
use __cuda_device, only: __fadd_rd, __fadd_ru
implicit none
! Set PRIVATE by default to explicitly only export what is meant
@@ -71,20 +72,4 @@ implicit none
end interface
public :: threadfence_system
interface
attributes(device) function __fadd_rd(x, y) bind(c, name='__nv_fadd_rd')
real, intent(in) :: x, y
real :: __fadd_rd
end function
end interface
public :: __fadd_rd
interface
attributes(device) function __fadd_ru(x, y) bind(c, name='__nv_fadd_ru')
real, intent(in) :: x, y
real :: __fadd_ru
end function
end interface
public :: __fadd_ru
end module