-
Notifications
You must be signed in to change notification settings - Fork 12.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[flang][cuda] Add bind(c) interfaces for __fadd_rd and __fadd_ru #122535
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
llvmbot
added
flang
Flang issues not falling into any other category
flang:fir-hlfir
labels
Jan 10, 2025
@llvm/pr-subscribers-mlir @llvm/pr-subscribers-flang-fir-hlfir Author: Valentin Clement (バレンタイン クレメン) (clementval) ChangesFunction like Full diff: https://github.com/llvm/llvm-project/pull/122535.diff 2 Files Affected:
diff --git a/flang/module/cudadevice.f90 b/flang/module/cudadevice.f90
index 1402bd4e150419..74825c36f7a95f 100644
--- a/flang/module/cudadevice.f90
+++ b/flang/module/cudadevice.f90
@@ -71,4 +71,18 @@ 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 :: x, y, __fadd_rd
+ end function
+ end interface
+ public :: __fadd_rd
+
+ interface
+ attributes(device) function __fadd_ru(x, y) bind(c, name='__nv_fadd_ru')
+ real :: x, y, __fadd_ru
+ end function
+ end interface
+ public :: __fadd_ru
+
end module
diff --git a/flang/test/Lower/CUDA/cuda-intrinsic.cuf b/flang/test/Lower/CUDA/cuda-intrinsic.cuf
new file mode 100644
index 00000000000000..9723afc532387f
--- /dev/null
+++ b/flang/test/Lower/CUDA/cuda-intrinsic.cuf
@@ -0,0 +1,17 @@
+! RUN: bbc -emit-hlfir -fcuda %s -o - | FileCheck %s
+
+module mod1
+ type int
+ real :: inf, sup
+ end type int
+contains
+ attributes(global) subroutine fadd(c, a, b)
+ type (int) :: c, a, b
+ c%inf = __fadd_rd(a%inf, b%inf)
+ c%sup = __fadd_ru(a%sup, b%sup)
+ end subroutine
+end
+
+! CHECK-LABEL: func.func @_QMmod1Pfadd
+! CHECK: fir.call @__nv_fadd_rd
+! CHECK: fir.call @__nv_fadd_ru
|
wangzpgi
reviewed
Jan 10, 2025
wangzpgi
approved these changes
Jan 10, 2025
clementval
commented
Jan 11, 2025
BaiXilin
pushed a commit
to BaiXilin/llvm-fix-vnni-instr-types
that referenced
this pull request
Jan 12, 2025
…m#122535) Function like `__fadd_rd ` and `__fadd_ru ` need to be converted to the cuda equivalent.
Mel-Chen
pushed a commit
to Mel-Chen/llvm-project
that referenced
this pull request
Jan 13, 2025
…m#122535) Function like `__fadd_rd ` and `__fadd_ru ` need to be converted to the cuda equivalent.
DKLoehr
pushed a commit
to DKLoehr/llvm-project
that referenced
this pull request
Jan 17, 2025
…m#122535) Function like `__fadd_rd ` and `__fadd_ru ` need to be converted to the cuda equivalent.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Function like
__fadd_rd
and__fadd_ru
need to be converted to the cuda equivalent.