Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dgl
Commits
08d18a47
Unverified
Commit
08d18a47
authored
Aug 14, 2023
by
Xin Yao
Committed by
GitHub
Aug 14, 2023
Browse files
[Build] Fix bf16/fp16 building issues for CUDA 12.2 (#6074)
Signed-off-by:
Xin Yao
<
xiny@nvidia.com
>
parent
de344fa4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
1 deletion
+7
-1
src/array/cuda/bf16.cuh
src/array/cuda/bf16.cuh
+3
-0
src/array/cuda/fp16.cuh
src/array/cuda/fp16.cuh
+4
-1
No files found.
src/array/cuda/bf16.cuh
View file @
08d18a47
...
...
@@ -46,6 +46,8 @@ min(__nv_bfloat16 a, __nv_bfloat16 b) {
// Arithmetic BF16 operations for architecture >= 8.0 are already defined in
// cuda_bf16.h
#if defined(__CUDA_ARCH__) && (__CUDA_ARCH__ < 800)
// CUDA 12.2 adds "emulated" support for older architectures.
#if defined(CUDART_VERSION) && (CUDART_VERSION < 12020)
__device__
__forceinline__
__nv_bfloat16
operator
+
(
const
__nv_bfloat16
&
lh
,
const
__nv_bfloat16
&
rh
)
{
return
__nv_bfloat16
(
float
(
lh
)
+
float
(
rh
));
// NOLINT
...
...
@@ -138,6 +140,7 @@ __device__ __forceinline__ bool operator<=(
const
__nv_bfloat16
&
lh
,
const
__nv_bfloat16
&
rh
)
{
return
float
(
lh
)
<=
float
(
rh
);
// NOLINT
}
#endif // defined(CUDART_VERSION) && (CUDART_VERSION < 12020)
#endif // defined(__CUDA_ARCH__) && (__CUDA_ARCH__ < 800)
#endif // __CUDACC__
...
...
src/array/cuda/fp16.cuh
View file @
08d18a47
...
...
@@ -45,6 +45,8 @@ static __device__ __forceinline__ half min(half a, half b) {
// Arithmetic FP16 operations for architecture >= 5.3 are already defined in
// cuda_fp16.h
#if defined(__CUDA_ARCH__) && (__CUDA_ARCH__ < 530)
// CUDA 12.2 adds "emulated" support for older architectures.
#if defined(CUDART_VERSION) && (CUDART_VERSION < 12020)
__device__
__forceinline__
__half
operator
+
(
const
__half
&
lh
,
const
__half
&
rh
)
{
return
__half
(
float
(
lh
)
+
float
(
rh
));
// NOLINT
...
...
@@ -125,7 +127,8 @@ __device__ __forceinline__ bool operator>=(const __half& lh, const __half& rh) {
__device__
__forceinline__
bool
operator
<=
(
const
__half
&
lh
,
const
__half
&
rh
)
{
return
float
(
lh
)
<=
float
(
rh
);
// NOLINT
}
#endif // __CUDA_ARCH__ < 530
#endif // defined(CUDART_VERSION) && (CUDART_VERSION < 12020)
#endif // defined(__CUDA_ARCH__) && (__CUDA_ARCH__ < 530)
#endif // __CUDACC__
#endif // DGL_ARRAY_CUDA_FP16_CUH_
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment