Skip to content

Commit ecd1574

Browse files
committed
[ILUVATAR_GPU] Fix compilation errors due to Paddle updates
1 parent c35130f commit ecd1574

File tree

4 files changed

+82
-1469
lines changed

4 files changed

+82
-1469
lines changed

backends/iluvatar_gpu/patches/paddle-corex.patch

Lines changed: 50 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
From 76e456a8fe536f6095a236ebb27c0463f32a9e4b Mon Sep 17 00:00:00 2001
1+
From ed3e134049155029178bfb612c7d221345bd8f89 Mon Sep 17 00:00:00 2001
22
From: "tianyu.zhou" <[email protected]>
33
Date: Mon, 26 May 2025 14:21:47 +0800
4-
Subject: [PATCH] Adapt for Iluvatar 0723.
4+
Subject: [PATCH] Adapt for Iluvatar 0811.
55

66
---
77
CMakeLists.txt | 2 +-
@@ -10,7 +10,7 @@ Subject: [PATCH] Adapt for Iluvatar 0723.
1010
.../fluid/platform/device/gpu/nccl_helper.h | 2 +-
1111
paddle/phi/backends/dynload/cudnn.cc | 4 +++
1212
paddle/phi/backends/dynload/cudnn.h | 9 +++++++
13-
paddle/phi/backends/dynload/cusolver.h | 2 --
13+
paddle/phi/backends/dynload/cusolver.h | 6 -----
1414
.../backends/gpu/cuda/cuda_device_function.h | 4 +--
1515
paddle/phi/backends/gpu/cuda/cuda_graph.cc | 4 +--
1616
paddle/phi/backends/gpu/cuda/cuda_graph.h | 2 +-
@@ -22,6 +22,7 @@ Subject: [PATCH] Adapt for Iluvatar 0723.
2222
paddle/phi/core/distributed/nccl_tools.cc | 2 +-
2323
paddle/phi/core/enforce.h | 6 ++++-
2424
paddle/phi/core/utils/data_type.h | 2 +-
25+
paddle/phi/kernels/funcs/activation_functor.h | 2 ++
2526
paddle/phi/kernels/funcs/affine_grid_utils.h | 2 ++
2627
paddle/phi/kernels/funcs/segmented_array.h | 8 ++++++
2728
paddle/phi/kernels/funcs/softmax_impl.h | 1 +
@@ -35,10 +36,10 @@ Subject: [PATCH] Adapt for Iluvatar 0723.
3536
paddle/phi/kernels/squeeze_kernel.cc | 2 ++
3637
paddle/phi/kernels/strided_slice_kernel.cc | 2 ++
3738
paddle/phi/kernels/unsqueeze_kernel.cc | 2 ++
38-
31 files changed, 114 insertions(+), 34 deletions(-)
39+
32 files changed, 116 insertions(+), 38 deletions(-)
3940

4041
diff --git a/CMakeLists.txt b/CMakeLists.txt
41-
index b2c4e6a650..c51f3df1f0 100755
42+
index 9c2a59d879..9dac2ecbf9 100755
4243
--- a/CMakeLists.txt
4344
+++ b/CMakeLists.txt
4445
@@ -63,7 +63,7 @@ option(WITH_IPU "Compile PaddlePaddle with Graphcore IPU" OFF)
@@ -125,25 +126,45 @@ index 7a5450c349..329fff1f73 100644
125126
} // namespace phi
126127

127128
diff --git a/paddle/phi/backends/dynload/cusolver.h b/paddle/phi/backends/dynload/cusolver.h
128-
index d580751fe4..42a261bdfd 100644
129+
index 86651fc8f1..42a261bdfd 100644
129130
--- a/paddle/phi/backends/dynload/cusolver.h
130131
+++ b/paddle/phi/backends/dynload/cusolver.h
131-
@@ -77,7 +77,6 @@ CUSOLVER_ROUTINE_EACH(DECLARE_DYNAMIC_LOAD_CUSOLVER_WRAP);
132+
@@ -46,10 +46,8 @@ extern void *cusolver_dso_handle;
133+
__macro(cusolverDnSetStream); \
134+
__macro(cusolverDnSpotrf_bufferSize); \
135+
__macro(cusolverDnDpotrf_bufferSize); \
136+
- __macro(cusolverDnXpotrf_bufferSize); \
137+
__macro(cusolverDnSpotrf); \
138+
__macro(cusolverDnDpotrf); \
139+
- __macro(cusolverDnXpotrf); \
140+
__macro(cusolverDnSpotrs); \
141+
__macro(cusolverDnDpotrs); \
142+
__macro(cusolverDnCpotrs); \
143+
@@ -79,7 +77,6 @@ CUSOLVER_ROUTINE_EACH(DECLARE_DYNAMIC_LOAD_CUSOLVER_WRAP);
132144
__macro(cusolverDnDgeqrf_bufferSize); \
133145
__macro(cusolverDnCgeqrf_bufferSize); \
134146
__macro(cusolverDnZgeqrf_bufferSize); \
135147
- __macro(cusolverDnXgeqrf_bufferSize); \
136148
__macro(cusolverDnSorgqr_bufferSize); \
137149
__macro(cusolverDnDorgqr_bufferSize); \
138150
__macro(cusolverDnSormqr_bufferSize); \
139-
@@ -106,7 +105,6 @@ CUSOLVER_ROUTINE_EACH(DECLARE_DYNAMIC_LOAD_CUSOLVER_WRAP);
151+
@@ -108,7 +105,6 @@ CUSOLVER_ROUTINE_EACH(DECLARE_DYNAMIC_LOAD_CUSOLVER_WRAP);
140152
__macro(cusolverDnDgeqrf); \
141153
__macro(cusolverDnCgeqrf); \
142154
__macro(cusolverDnZgeqrf); \
143155
- __macro(cusolverDnXgeqrf); \
144156
__macro(cusolverDnSorgqr); \
145157
__macro(cusolverDnDorgqr); \
146158
__macro(cusolverDnSormqr); \
159+
@@ -122,8 +118,6 @@ CUSOLVER_ROUTINE_EACH_R1(DECLARE_DYNAMIC_LOAD_CUSOLVER_WRAP)
160+
#if CUDA_VERSION >= 9020
161+
#define CUSOLVER_ROUTINE_EACH_R2(__macro) \
162+
__macro(cusolverDnCreateSyevjInfo); \
163+
- __macro(cusolverDnCreateParams); \
164+
- __macro(cusolverDnDestroyParams); \
165+
__macro(cusolverDnSsyevj_bufferSize); \
166+
__macro(cusolverDnDsyevj_bufferSize); \
167+
__macro(cusolverDnCheevj_bufferSize); \
147168
diff --git a/paddle/phi/backends/gpu/cuda/cuda_device_function.h b/paddle/phi/backends/gpu/cuda/cuda_device_function.h
148169
index 4ff2e528a9..956bac0c64 100644
149170
--- a/paddle/phi/backends/gpu/cuda/cuda_device_function.h
@@ -215,7 +236,7 @@ index 02753c0333..bcf435dfae 100644
215236
return CUDA_R_16BF;
216237
#endif
217238
diff --git a/paddle/phi/backends/gpu/cuda/cudnn_helper.h b/paddle/phi/backends/gpu/cuda/cudnn_helper.h
218-
index 99b8fa120e..beba409fcc 100644
239+
index 28c3d14d37..5dc5f79178 100644
219240
--- a/paddle/phi/backends/gpu/cuda/cudnn_helper.h
220241
+++ b/paddle/phi/backends/gpu/cuda/cudnn_helper.h
221242
@@ -125,7 +125,7 @@ class CudnnDataType<phi::dtype::float8_e4m3fn> {
@@ -390,6 +411,25 @@ index 1d20fa3173..fab2b90ed2 100644
390411
} else if (type == DataType::BFLOAT16) {
391412
return ncclBfloat16;
392413
#endif
414+
diff --git a/paddle/phi/kernels/funcs/activation_functor.h b/paddle/phi/kernels/funcs/activation_functor.h
415+
index fa55cd725f..f0e3f5b49c 100644
416+
--- a/paddle/phi/kernels/funcs/activation_functor.h
417+
+++ b/paddle/phi/kernels/funcs/activation_functor.h
418+
@@ -3659,12 +3659,14 @@ struct CudaReciprocalFunctor<ComplexType<T>>
419+
return ::isnan(real) || ::isnan(imag);
420+
};
421+
if (either_nan(x.real, x.imag) || both_inf(x.real, x.imag)) {
422+
+#ifndef PADDLE_WITH_COREX
423+
// If either is Nan or both are infinite, return {nan, nan}
424+
if constexpr (std::is_same<T, float>::value) {
425+
return ComplexType<T>(nanf(""), nanf(""));
426+
} else if constexpr (std::is_same<T, double>::value) {
427+
return ComplexType<T>(nan(""), nan(""));
428+
}
429+
+#endif
430+
} else if (either_inf(x.real, x.imag)) {
431+
// If either is Inf, return {0, 0}
432+
return ComplexType<T>(static_cast<T>(0), static_cast<T>(0));
393433
diff --git a/paddle/phi/kernels/funcs/affine_grid_utils.h b/paddle/phi/kernels/funcs/affine_grid_utils.h
394434
index b973d75a9b..daeb4778c6 100644
395435
--- a/paddle/phi/kernels/funcs/affine_grid_utils.h
@@ -472,7 +512,7 @@ index 9d0d474d90..b1a12276d9 100644
472512
GPU,
473513
ALL_LAYOUT,
474514
diff --git a/paddle/phi/kernels/gpu/layer_norm_kernel.cu b/paddle/phi/kernels/gpu/layer_norm_kernel.cu
475-
index 648bb6cee2..5b4cdd0505 100644
515+
index f621d5ed5b..909d28b62f 100644
476516
--- a/paddle/phi/kernels/gpu/layer_norm_kernel.cu
477517
+++ b/paddle/phi/kernels/gpu/layer_norm_kernel.cu
478518
@@ -681,7 +681,7 @@ PD_REGISTER_KERNEL(layer_norm,

backends/iluvatar_gpu/tests/unittests/test_arange_iluvatar.py

Lines changed: 0 additions & 252 deletions
This file was deleted.

0 commit comments

Comments
 (0)