[flang-commits] [flang] [flang][cuda] Add interfaces for __ldcg, __ldca, __ldcs, __ldlu, __ldcv, __stwb, __stcg, __stcs, __stwt (PR #128766)
Valentin Clement バレンタイン クレメン via flang-commits
flang-commits at lists.llvm.org
Tue Feb 25 11:45:59 PST 2025
https://github.com/clementval created https://github.com/llvm/llvm-project/pull/128766
None
>From a94a98f74b340673621236b35d058a9455ec2c43 Mon Sep 17 00:00:00 2001
From: Valentin Clement <clementval at gmail.com>
Date: Tue, 25 Feb 2025 11:45:19 -0800
Subject: [PATCH] [flang][cuda] Add interfaces for __ldcg, __ldca, __ldcs,
__ldlu, __ldcv, __stwb, __stcg, __stcs, __stwt
---
flang/module/cudadevice.f90 | 473 ++++++++++++++++++++++++++++++++++++
1 file changed, 473 insertions(+)
diff --git a/flang/module/cudadevice.f90 b/flang/module/cudadevice.f90
index af8ea66618e27..aa5eacf7c8212 100644
--- a/flang/module/cudadevice.f90
+++ b/flang/module/cudadevice.f90
@@ -670,4 +670,477 @@ attributes(device) integer function match_any_syncjd(mask, val)
end function
end interface
+ ! LDCG
+ interface __ldcg
+ attributes(device) pure integer(4) function __ldcg_i4(x) bind(c)
+ !dir$ ignore_tkr (d) x
+ integer(4), intent(in) :: x
+ end function
+ attributes(device) pure integer(8) function __ldcg_i8(x) bind(c)
+ !dir$ ignore_tkr (d) x
+ integer(8), intent(in) :: x
+ end function
+ attributes(device) pure function __ldcg_cd(x) bind(c) result(y)
+ import c_devptr
+ !dir$ ignore_tkr (d) x
+ type(c_devptr), intent(in) :: x
+ type(c_devptr) :: y
+ end function
+ attributes(device) pure real(2) function __ldcg_r2(x) bind(c)
+ !dir$ ignore_tkr (d) x
+ real(2), intent(in) :: x
+ end function
+ attributes(device) pure real(4) function __ldcg_r4(x) bind(c)
+ !dir$ ignore_tkr (d) x
+ real(4), intent(in) :: x
+ end function
+ attributes(device) pure real(8) function __ldcg_r8(x) bind(c)
+ !dir$ ignore_tkr (d) x
+ real(8), intent(in) :: x
+ end function
+ attributes(device) pure complex(4) function __ldcg_c4(x) &
+ bind(c,name='__ldcg_c4x')
+ !dir$ ignore_tkr (d) x
+ complex(4), intent(in) :: x
+ end function
+ attributes(device) pure complex(8) function __ldcg_c8(x) &
+ bind(c,name='__ldcg_c8x')
+ !dir$ ignore_tkr (d) x
+ complex(8), intent(in) :: x
+ end function
+ attributes(device) pure function __ldcg_i4x4(x) result(y)
+ !dir$ ignore_tkr (d) x
+ integer(4), dimension(4), intent(in) :: x
+ integer(4), dimension(4) :: y
+ end function
+ attributes(device) pure function __ldcg_i8x2(x) result(y)
+ !dir$ ignore_tkr (d) x
+ integer(8), dimension(2), intent(in) :: x
+ integer(8), dimension(2) :: y
+ end function
+ attributes(device) pure function __ldcg_r2x2(x) result(y)
+ !dir$ ignore_tkr (d) x
+ real(2), dimension(2), intent(in) :: x
+ real(2), dimension(2) :: y
+ end function
+ attributes(device) pure function __ldcg_r4x4(x) result(y)
+ !dir$ ignore_tkr (d) x
+ real(4), dimension(4), intent(in) :: x
+ real(4), dimension(4) :: y
+ end function
+ attributes(device) pure function __ldcg_r8x2(x) result(y)
+ !dir$ ignore_tkr (d) x
+ real(8), dimension(2), intent(in) :: x
+ real(8), dimension(2) :: y
+ end function
+ end interface
+
+ ! LDCA
+ interface __ldca
+ attributes(device) pure integer(4) function __ldca_i4(x) bind(c)
+ !dir$ ignore_tkr (d) x
+ integer(4), intent(in) :: x
+ end function
+ attributes(device) pure integer(8) function __ldca_i8(x) bind(c)
+ !dir$ ignore_tkr (d) x
+ integer(8), intent(in) :: x
+ end function
+ attributes(device) pure function __ldca_cd(x) bind(c) result(y)
+ !dir$ ignore_tkr (d) x
+ import c_devptr
+ type(c_devptr), intent(in) :: x
+ type(c_devptr) :: y
+ end function
+ attributes(device) pure real(2) function __ldca_r2(x) bind(c)
+ !dir$ ignore_tkr (d) x
+ real(2), intent(in) :: x
+ end function
+ attributes(device) pure real(4) function __ldca_r4(x) bind(c)
+ !dir$ ignore_tkr (d) x
+ real(4), intent(in) :: x
+ end function
+ attributes(device) pure real(8) function __ldca_r8(x) bind(c)
+ !dir$ ignore_tkr (d) x
+ real(8), intent(in) :: x
+ end function
+ attributes(device) pure complex(4) function __ldca_c4(x) &
+ bind(c,name='__ldca_c4x')
+ !dir$ ignore_tkr (d) x
+ complex(4), intent(in) :: x
+ end function
+ attributes(device) pure complex(8) function __ldca_c8(x) &
+ bind(c,name='__ldca_c8x')
+ !dir$ ignore_tkr (d) x
+ complex(8), intent(in) :: x
+ end function
+ end interface
+
+ ! LDCS
+ interface __ldcs
+ attributes(device) pure integer(4) function __ldcs_i4(x) bind(c)
+ !dir$ ignore_tkr (d) x
+ integer(4), intent(in) :: x
+ end function
+ attributes(device) pure integer(8) function __ldcs_i8(x) bind(c)
+ !dir$ ignore_tkr (d) x
+ integer(8), intent(in) :: x
+ end function
+ attributes(device) pure function __ldcs_cd(x) bind(c) result(y)
+ import c_devptr
+ !dir$ ignore_tkr (d) x
+ type(c_devptr), intent(in) :: x
+ type(c_devptr) :: y
+ end function
+ attributes(device) pure real(2) function __ldcs_r2(x) bind(c)
+ !dir$ ignore_tkr (d) x
+ real(2), intent(in) :: x
+ end function
+ attributes(device) pure real(4) function __ldcs_r4(x) bind(c)
+ !dir$ ignore_tkr (d) x
+ real(4), intent(in) :: x
+ end function
+ attributes(device) pure real(8) function __ldcs_r8(x) bind(c)
+ !dir$ ignore_tkr (d) x
+ real(8), intent(in) :: x
+ end function
+ attributes(device) pure complex(4) function __ldcs_c4(x) &
+ bind(c,name='__ldcs_c4x')
+ !dir$ ignore_tkr (d) x
+ complex(4), intent(in) :: x
+ end function
+ attributes(device) pure complex(8) function __ldcs_c8(x) &
+ bind(c,name='__ldcs_c8x')
+ !dir$ ignore_tkr (d) x
+ complex(8), intent(in) :: x
+ end function
+ end interface
+
+ ! LDLU
+ interface __ldlu
+ attributes(device) pure integer(4) function __ldlu_i4(x) bind(c)
+ !dir$ ignore_tkr (d) x
+ integer(4), intent(in) :: x
+ end function
+ attributes(device) pure integer(8) function __ldlu_i8(x) bind(c)
+ !dir$ ignore_tkr (d) x
+ integer(8), intent(in) :: x
+ end function
+ attributes(device) pure function __ldlu_cd(x) bind(c) result(y)
+ import c_devptr
+ !dir$ ignore_tkr (d) x
+ type(c_devptr), intent(in) :: x
+ type(c_devptr) :: y
+ end function
+ attributes(device) pure real(2) function __ldlu_r2(x) bind(c)
+ !dir$ ignore_tkr (d) x
+ real(2), intent(in) :: x
+ end function
+ attributes(device) pure real(4) function __ldlu_r4(x) bind(c)
+ !dir$ ignore_tkr (d) x
+ real(4), intent(in) :: x
+ end function
+ attributes(device) pure real(8) function __ldlu_r8(x) bind(c)
+ !dir$ ignore_tkr (d) x
+ real(8), intent(in) :: x
+ end function
+ attributes(device) pure complex(4) function __ldlu_c4(x) &
+ bind(c,name='__ldlu_c4x')
+ !dir$ ignore_tkr (d) x
+ complex(4), intent(in) :: x
+ end function
+ attributes(device) pure complex(8) function __ldlu_c8(x) &
+ bind(c,name='__ldlu_c8x')
+ !dir$ ignore_tkr (d) x
+ complex(8), intent(in) :: x
+ end function
+ end interface
+
+ ! LDCV
+ interface __ldcv
+ attributes(device) pure integer(4) function __ldcv_i4(x) bind(c)
+ !dir$ ignore_tkr (d) x
+ integer(4), intent(in) :: x
+ end function
+ attributes(device) pure integer(8) function __ldcv_i8(x) bind(c)
+ !dir$ ignore_tkr (d) x
+ integer(8), intent(in) :: x
+ end function
+ attributes(device) pure function __ldcv_cd(x) bind(c) result(y)
+ import c_devptr
+ !dir$ ignore_tkr (d) x
+ type(c_devptr), intent(in) :: x
+ type(c_devptr) :: y
+ end function
+ attributes(device) pure real(2) function __ldcv_r2(x) bind(c)
+ !dir$ ignore_tkr (d) x
+ real(2), intent(in) :: x
+ end function
+ attributes(device) pure real(4) function __ldcv_r4(x) bind(c)
+ !dir$ ignore_tkr (d) x
+ real(4), intent(in) :: x
+ end function
+ attributes(device) pure real(8) function __ldcv_r8(x) bind(c)
+ !dir$ ignore_tkr (d) x
+ real(8), intent(in) :: x
+ end function
+ attributes(device) pure complex(4) function __ldcv_c4(x) &
+ bind(c,name='__ldcv_c4x')
+ !dir$ ignore_tkr (d) x
+ complex(4), intent(in) :: x
+ end function
+ attributes(device) pure complex(8) function __ldcv_c8(x) &
+ bind(c,name='__ldcv_c8x')
+ !dir$ ignore_tkr (d) x
+ complex(8), intent(in) :: x
+ end function
+ end interface
+
+ ! STWB
+ interface __stwb
+ attributes(device) pure subroutine __stwb_i4(y, x) bind(c)
+ !dir$ ignore_tkr (d) y, (d) x
+ integer(4), value :: x
+ integer(4), device, intent(in) :: y
+ end subroutine
+ attributes(device) pure subroutine __stwb_i8(y, x) bind(c)
+ !dir$ ignore_tkr (d) y, (d) x
+ integer(8), value :: x
+ integer(8), device, intent(in) :: y
+ end subroutine
+ attributes(device) pure subroutine __stwb_cd(y, x) bind(c)
+ import c_devptr
+ !dir$ ignore_tkr (d) y, (d) x
+ type(c_devptr), device, intent(in) :: y, x
+ end subroutine
+ attributes(device) pure subroutine __stwb_r2(y, x) bind(c)
+ !dir$ ignore_tkr (d) y, (d) x
+ real(2), value :: x
+ real(2), device, intent(in) :: y
+ end subroutine
+ attributes(device) pure subroutine __stwb_r4(y, x) bind(c)
+ !dir$ ignore_tkr (d) y, (d) x
+ real(4), value :: x
+ real(4), device, intent(in) :: y
+ end subroutine
+ attributes(device) pure subroutine __stwb_r8(y, x) bind(c)
+ !dir$ ignore_tkr (d) y, (d) x
+ real(8), value :: x
+ real(8), device, intent(in) :: y
+ end subroutine
+ attributes(device) pure subroutine __stwb_c4(y, x) bind(c)
+ !dir$ ignore_tkr (d) y, (rd) x
+ complex(4), device, intent(in) :: y, x
+ end subroutine
+ attributes(device) pure subroutine __stwb_c8(y, x) bind(c)
+ !dir$ ignore_tkr (d) y, (d) x
+ complex(8), device, intent(in) :: y, x
+ end subroutine
+ attributes(device) pure subroutine __stwb_i4x4(y, x) bind(c)
+ !dir$ ignore_tkr (d) y, (d) x
+ integer(4), dimension(4), device, intent(in) :: y, x
+ end subroutine
+ attributes(device) pure subroutine __stwb_i8x2(y, x) bind(c)
+ !dir$ ignore_tkr (d) y, (d) x
+ integer(8), dimension(2), device, intent(in) :: y, x
+ end subroutine
+ attributes(device) pure subroutine __stwb_r2x2(y, x) bind(c)
+ !dir$ ignore_tkr (d) y, (d) x
+ real(2), dimension(2), device, intent(in) :: y, x
+ end subroutine
+ attributes(device) pure subroutine __stwb_r4x4(y, x) bind(c)
+ !dir$ ignore_tkr (d) y, (d) x
+ real(4), dimension(4), device, intent(in) :: y, x
+ end subroutine
+ attributes(device) pure subroutine __stwb_r8x2(y, x) bind(c)
+ !dir$ ignore_tkr (d) y, (d) x
+ real(8), dimension(2), device, intent(in) :: y, x
+ end subroutine
+ end interface
+
+ ! STCG
+ interface __stcg
+ attributes(device) pure subroutine __stcg_i4(y, x) bind(c)
+ !dir$ ignore_tkr (d) y, (d) x
+ integer(4), value :: x
+ integer(4), device, intent(in) :: y
+ end subroutine
+ attributes(device) pure subroutine __stcg_i8(y, x) bind(c)
+ !dir$ ignore_tkr (d) y, (d) x
+ integer(8), value :: x
+ integer(8), device, intent(in) :: y
+ end subroutine
+ attributes(device) pure subroutine __stcg_cd(y, x) bind(c)
+ import c_devptr
+ !dir$ ignore_tkr (d) y, (d) x
+ type(c_devptr), device, intent(in) :: y, x
+ end subroutine
+ attributes(device) pure subroutine __stcg_r2(y, x) bind(c)
+ !dir$ ignore_tkr (d) y, (d) x
+ real(2), value :: x
+ real(2), device, intent(in) :: y
+ end subroutine
+ attributes(device) pure subroutine __stcg_r4(y, x) bind(c)
+ !dir$ ignore_tkr (d) y, (d) x
+ real(4), value :: x
+ real(4), device, intent(in) :: y
+ end subroutine
+ attributes(device) pure subroutine __stcg_r8(y, x) bind(c)
+ !dir$ ignore_tkr (d) y, (d) x
+ real(8), value :: x
+ real(8), device, intent(in) :: y
+ end subroutine
+ attributes(device) pure subroutine __stcg_c4(y, x) bind(c)
+ !dir$ ignore_tkr (d) y, (rd) x
+ complex(4), device, intent(in) :: y, x
+ end subroutine
+ attributes(device) pure subroutine __stcg_c8(y, x) bind(c)
+ !dir$ ignore_tkr (d) y, (d) x
+ complex(8), device, intent(in) :: y, x
+ end subroutine
+ attributes(device) pure subroutine __stcg_i4x4(y, x) bind(c)
+ !dir$ ignore_tkr (d) y, (d) x
+ integer(4), dimension(4), device, intent(in) :: y, x
+ end subroutine
+ attributes(device) pure subroutine __stcg_i8x2(y, x) bind(c)
+ !dir$ ignore_tkr (d) y, (d) x
+ integer(8), dimension(2), device, intent(in) :: y, x
+ end subroutine
+ attributes(device) pure subroutine __stcg_r2x2(y, x) bind(c)
+ !dir$ ignore_tkr (d) y, (d) x
+ real(2), dimension(2), device, intent(in) :: y, x
+ end subroutine
+ attributes(device) pure subroutine __stcg_r4x4(y, x) bind(c)
+ !dir$ ignore_tkr (d) y, (d) x
+ real(4), dimension(4), device, intent(in) :: y, x
+ end subroutine
+ attributes(device) pure subroutine __stcg_r8x2(y, x) bind(c)
+ !dir$ ignore_tkr (d) y, (d) x
+ real(8), dimension(2), device, intent(in) :: y, x
+ end subroutine
+ end interface
+
+ ! STCS
+ interface __stcs
+ attributes(device) pure subroutine __stcs_i4(y, x) bind(c)
+ !dir$ ignore_tkr (d) y, (d) x
+ integer(4), value :: x
+ integer(4), device, intent(in) :: y
+ end subroutine
+ attributes(device) pure subroutine __stcs_i8(y, x) bind(c)
+ !dir$ ignore_tkr (d) y, (d) x
+ integer(8), value :: x
+ integer(8), device, intent(in) :: y
+ end subroutine
+ attributes(device) pure subroutine __stcs_cd(y, x) bind(c)
+ import c_devptr
+ !dir$ ignore_tkr (d) y, (d) x
+ type(c_devptr), device, intent(in) :: y, x
+ end subroutine
+ attributes(device) pure subroutine __stcs_r2(y, x) bind(c)
+ !dir$ ignore_tkr (d) y, (d) x
+ real(2), value :: x
+ real(2), device, intent(in) :: y
+ end subroutine
+ attributes(device) pure subroutine __stcs_r4(y, x) bind(c)
+ !dir$ ignore_tkr (d) y, (d) x
+ real(4), value :: x
+ real(4), device, intent(in) :: y
+ end subroutine
+ attributes(device) pure subroutine __stcs_r8(y, x) bind(c)
+ !dir$ ignore_tkr (d) y, (d) x
+ real(8), value :: x
+ real(8), device, intent(in) :: y
+ end subroutine
+ attributes(device) pure subroutine __stcs_c4(y, x) bind(c)
+ !dir$ ignore_tkr (d) y, (rd) x
+ complex(4), device, intent(in) :: y, x
+ end subroutine
+ attributes(device) pure subroutine __stcs_c8(y, x) bind(c)
+ !dir$ ignore_tkr (d) y, (d) x
+ complex(8), device, intent(in) :: y, x
+ end subroutine
+ attributes(device) pure subroutine __stcs_i4x4(y, x) bind(c)
+ !dir$ ignore_tkr (d) y, (d) x
+ integer(4), dimension(4), device, intent(in) :: y, x
+ end subroutine
+ attributes(device) pure subroutine __stcs_i8x2(y, x) bind(c)
+ !dir$ ignore_tkr (d) y, (d) x
+ integer(8), dimension(2), device, intent(in) :: y, x
+ end subroutine
+ attributes(device) pure subroutine __stcs_r2x2(y, x) bind(c)
+ !dir$ ignore_tkr (d) y, (d) x
+ real(2), dimension(2), device, intent(in) :: y, x
+ end subroutine
+ attributes(device) pure subroutine __stcs_r4x4(y, x) bind(c)
+ !dir$ ignore_tkr (d) y, (d) x
+ real(4), dimension(4), device, intent(in) :: y, x
+ end subroutine
+ attributes(device) pure subroutine __stcs_r8x2(y, x) bind(c)
+ !dir$ ignore_tkr (d) y, (d) x
+ real(8), dimension(2), device, intent(in) :: y, x
+ end subroutine
+ end interface
+
+ ! STWT
+ interface __stwt
+ attributes(device) pure subroutine __stwt_i4(y, x) bind(c)
+ !dir$ ignore_tkr (d) y, (d) x
+ integer(4), value :: x
+ integer(4), device, intent(in) :: y
+ end subroutine
+ attributes(device) pure subroutine __stwt_i8(y, x) bind(c)
+ !dir$ ignore_tkr (d) y, (d) x
+ integer(8), value :: x
+ integer(8), device, intent(in) :: y
+ end subroutine
+ attributes(device) pure subroutine __stwt_cd(y, x) bind(c)
+ import c_devptr
+ !dir$ ignore_tkr (d) y, (d) x
+ type(c_devptr), device, intent(in) :: y, x
+ end subroutine
+ attributes(device) pure subroutine __stwt_r2(y, x) bind(c)
+ !dir$ ignore_tkr (d) y, (d) x
+ real(2), value :: x
+ real(2), device, intent(in) :: y
+ end subroutine
+ attributes(device) pure subroutine __stwt_r4(y, x) bind(c)
+ !dir$ ignore_tkr (d) y, (d) x
+ real(4), value :: x
+ real(4), device, intent(in) :: y
+ end subroutine
+ attributes(device) pure subroutine __stwt_r8(y, x) bind(c)
+ !dir$ ignore_tkr (d) y, (d) x
+ real(8), value :: x
+ real(8), device, intent(in) :: y
+ end subroutine
+ attributes(device) pure subroutine __stwt_c4(y, x) bind(c)
+ !dir$ ignore_tkr (d) y, (rd) x
+ complex(4), device, intent(in) :: y, x
+ end subroutine
+ attributes(device) pure subroutine __stwt_c8(y, x) bind(c)
+ !dir$ ignore_tkr (d) y, (d) x
+ complex(8), device, intent(in) :: y, x
+ end subroutine
+ attributes(device) pure subroutine __stwt_i4x4(y, x) bind(c)
+ !dir$ ignore_tkr (d) y, (d) x
+ integer(4), dimension(4), device, intent(in) :: y, x
+ end subroutine
+ attributes(device) pure subroutine __stwt_i8x2(y, x) bind(c)
+ !dir$ ignore_tkr (d) y, (d) x
+ integer(8), dimension(2), device, intent(in) :: y, x
+ end subroutine
+ attributes(device) pure subroutine __stwt_r2x2(y, x) bind(c)
+ !dir$ ignore_tkr (d) y, (d) x
+ real(2), dimension(2), device, intent(in) :: y, x
+ end subroutine
+ attributes(device) pure subroutine __stwt_r4x4(y, x) bind(c)
+ !dir$ ignore_tkr (d) y, (d) x
+ real(4), dimension(4), device, intent(in) :: y, x
+ end subroutine
+ attributes(device) pure subroutine __stwt_r8x2(y, x) bind(c)
+ !dir$ ignore_tkr (d) y, (d) x
+ real(8), dimension(2), device, intent(in) :: y, x
+ end subroutine
+ end interface
+
end module
More information about the flang-commits
mailing list