[flang-commits] [flang] [CUF] Moving __fadd_rd and __fadd_ru to cudadevice.f90 as they are symbol already known upstream. (PR #123127)

Renaud Kauffmann via flang-commits flang-commits at lists.llvm.org
Thu Jan 16 09:29:37 PST 2025


https://github.com/Renaud-K updated https://github.com/llvm/llvm-project/pull/123127

>From 8072386e27b07559da110887784767190a9ed1e4 Mon Sep 17 00:00:00 2001
From: Renaud-K <rkauffmann at nvidia.com>
Date: Wed, 15 Jan 2025 14:14:08 -0800
Subject: [PATCH 1/2] Moving __fadd_rd and __fadd_ru to cudadevice.f90 as they
 are upstream symbols.

---
 flang/module/__cuda_device.f90 | 15 ---------------
 flang/module/cudadevice.f90    | 16 ++++++++++++++++
 2 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/flang/module/__cuda_device.f90 b/flang/module/__cuda_device.f90
index 81b1f5aa334bbf..73f3d19c98a317 100644
--- a/flang/module/__cuda_device.f90
+++ b/flang/module/__cuda_device.f90
@@ -14,19 +14,4 @@
   ! 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
diff --git a/flang/module/cudadevice.f90 b/flang/module/cudadevice.f90
index 5712a7724ae49d..894562cb51eab6 100644
--- a/flang/module/cudadevice.f90
+++ b/flang/module/cudadevice.f90
@@ -75,4 +75,20 @@ attributes(device) subroutine threadfence_system()
   end interface
   public :: threadfence_system
 
+  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

>From 291b5f799cb4869238ea9371058aea00251d8d8d Mon Sep 17 00:00:00 2001
From: Renaud Kauffmann <rkauffmann at nvidia.com>
Date: Thu, 16 Jan 2025 09:29:27 -0800
Subject: [PATCH 2/2] Add comment to separate the new calls from the memory
 fences
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Co-authored-by: Valentin Clement (バレンタイン クレメン) <clementval at gmail.com>
---
 flang/module/cudadevice.f90 | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/flang/module/cudadevice.f90 b/flang/module/cudadevice.f90
index 894562cb51eab6..3d487fd000a094 100644
--- a/flang/module/cudadevice.f90
+++ b/flang/module/cudadevice.f90
@@ -75,6 +75,8 @@ attributes(device) subroutine threadfence_system()
   end interface
   public :: threadfence_system
 
+  ! Math API
+
   interface
     attributes(device) function __fadd_rd(x, y) bind(c, name='__nv_fadd_rd')
       real, intent(in), value :: x, y



More information about the flang-commits mailing list