未验证 提交 7c302538 编写于 作者: H huangjiyi 提交者: GitHub

[PHI decoupling] remove "paddle/fluid/platform/dynload/xxx.h" in phi (#47787)

* rm "paddle/fluid/platform/dynload/cudnn.h" in phi

* rm "paddle/fluid/platform/dynload/mklml.h" in phi

* rm "paddle/fluid/platform/dynload/rocblas.h" in phi

* replace "paddle::platform::dynload::" with "phi::dynload::" in phi

* revert "blas_impl.cu.h"
上级 c551e55d
......@@ -18,7 +18,7 @@
#include "paddle/phi/core/dense_tensor.h"
#ifdef PADDLE_WITH_MKLML
#include "paddle/fluid/platform/dynload/mklml.h"
#include "paddle/phi/backends/dynload/mklml.h"
#endif
#ifdef PADDLE_WITH_LIBXSMM
......
......@@ -113,27 +113,27 @@ template <>
struct CBlas<float> {
template <typename... ARGS>
static void GEMM(ARGS... args) {
paddle::platform::dynload::cblas_sgemm(args...);
phi::dynload::cblas_sgemm(args...);
}
template <typename... ARGS>
static float *GEMM_ALLOC(ARGS... args) {
return paddle::platform::dynload::cblas_sgemm_alloc(args...);
return phi::dynload::cblas_sgemm_alloc(args...);
}
template <typename... ARGS>
static void GEMM_PACK(ARGS... args) {
paddle::platform::dynload::cblas_sgemm_pack(args...);
phi::dynload::cblas_sgemm_pack(args...);
}
template <typename... ARGS>
static void GEMM_COMPUTE(ARGS... args) {
paddle::platform::dynload::cblas_sgemm_compute(args...);
phi::dynload::cblas_sgemm_compute(args...);
}
template <typename... ARGS>
static void GEMM_FREE(ARGS... args) {
paddle::platform::dynload::cblas_sgemm_free(args...);
phi::dynload::cblas_sgemm_free(args...);
}
#ifdef PADDLE_WITH_LIBXSMM
......@@ -145,93 +145,93 @@ struct CBlas<float> {
template <typename... ARGS>
static void AXPY(ARGS... args) {
paddle::platform::dynload::cblas_saxpy(args...);
phi::dynload::cblas_saxpy(args...);
}
template <typename... ARGS>
static void VCOPY(ARGS... args) {
paddle::platform::dynload::cblas_scopy(args...);
phi::dynload::cblas_scopy(args...);
}
template <typename... ARGS>
static void GEMV(ARGS... args) {
paddle::platform::dynload::cblas_sgemv(args...);
phi::dynload::cblas_sgemv(args...);
}
template <typename... ARGS>
static float DOT(ARGS... args) {
return paddle::platform::dynload::cblas_sdot(args...);
return phi::dynload::cblas_sdot(args...);
}
template <typename... ARGS>
static void SCAL(ARGS... args) {
paddle::platform::dynload::cblas_sscal(args...);
phi::dynload::cblas_sscal(args...);
}
template <typename... ARGS>
static float ASUM(ARGS... args) {
return paddle::platform::dynload::cblas_sasum(args...);
return phi::dynload::cblas_sasum(args...);
}
template <typename... ARGS>
static void GEMM_BATCH(ARGS... args) {
paddle::platform::dynload::cblas_sgemm_batch(args...);
phi::dynload::cblas_sgemm_batch(args...);
}
template <typename... ARGS>
static void VADD(ARGS... args) {
paddle::platform::dynload::vsAdd(args...);
phi::dynload::vsAdd(args...);
}
template <typename... ARGS>
static void VSUB(ARGS... args) {
paddle::platform::dynload::vsSub(args...);
phi::dynload::vsSub(args...);
}
template <typename... ARGS>
static void VMUL(ARGS... args) {
paddle::platform::dynload::vsMul(args...);
phi::dynload::vsMul(args...);
}
template <typename... ARGS>
static void VDIV(ARGS... args) {
paddle::platform::dynload::vsDiv(args...);
phi::dynload::vsDiv(args...);
}
template <typename... ARGS>
static void VEXP(ARGS... args) {
paddle::platform::dynload::vsExp(args...);
phi::dynload::vsExp(args...);
}
template <typename... ARGS>
static void VSQUARE(ARGS... args) {
paddle::platform::dynload::vsSqr(args...);
phi::dynload::vsSqr(args...);
}
template <typename... ARGS>
static void VPOW(ARGS... args) {
paddle::platform::dynload::vsPowx(args...);
phi::dynload::vsPowx(args...);
}
template <typename... ARGS>
static void VINV(ARGS... args) {
paddle::platform::dynload::vsInv(args...);
phi::dynload::vsInv(args...);
}
template <typename... ARGS>
static void VMERF(ARGS... args) {
paddle::platform::dynload::vmsErf(args...);
phi::dynload::vmsErf(args...);
}
#if !defined(_WIN32)
template <typename... ARGS>
static void CSRMM(ARGS... args) {
paddle::platform::dynload::mkl_scsrmm(args...);
phi::dynload::mkl_scsrmm(args...);
}
#endif
template <typename... ARGS>
static void TRSM(ARGS... args) {
paddle::platform::dynload::cblas_strsm(args...);
phi::dynload::cblas_strsm(args...);
}
};
......@@ -239,27 +239,27 @@ template <>
struct CBlas<double> {
template <typename... ARGS>
static void GEMM(ARGS... args) {
paddle::platform::dynload::cblas_dgemm(args...);
phi::dynload::cblas_dgemm(args...);
}
template <typename... ARGS>
static double *GEMM_ALLOC(ARGS... args) {
return paddle::platform::dynload::cblas_dgemm_alloc(args...);
return phi::dynload::cblas_dgemm_alloc(args...);
}
template <typename... ARGS>
static void GEMM_PACK(ARGS... args) {
paddle::platform::dynload::cblas_dgemm_pack(args...);
phi::dynload::cblas_dgemm_pack(args...);
}
template <typename... ARGS>
static void GEMM_COMPUTE(ARGS... args) {
paddle::platform::dynload::cblas_dgemm_compute(args...);
phi::dynload::cblas_dgemm_compute(args...);
}
template <typename... ARGS>
static void GEMM_FREE(ARGS... args) {
paddle::platform::dynload::cblas_dgemm_free(args...);
phi::dynload::cblas_dgemm_free(args...);
}
#ifdef PADDLE_WITH_LIBXSMM
......@@ -271,93 +271,93 @@ struct CBlas<double> {
template <typename... ARGS>
static void AXPY(ARGS... args) {
paddle::platform::dynload::cblas_daxpy(args...);
phi::dynload::cblas_daxpy(args...);
}
template <typename... ARGS>
static void VCOPY(ARGS... args) {
paddle::platform::dynload::cblas_dcopy(args...);
phi::dynload::cblas_dcopy(args...);
}
template <typename... ARGS>
static void GEMV(ARGS... args) {
paddle::platform::dynload::cblas_dgemv(args...);
phi::dynload::cblas_dgemv(args...);
}
template <typename... ARGS>
static double DOT(ARGS... args) {
return paddle::platform::dynload::cblas_ddot(args...);
return phi::dynload::cblas_ddot(args...);
}
template <typename... ARGS>
static void SCAL(ARGS... args) {
paddle::platform::dynload::cblas_dscal(args...);
phi::dynload::cblas_dscal(args...);
}
template <typename... ARGS>
static double ASUM(ARGS... args) {
return paddle::platform::dynload::cblas_dasum(args...);
return phi::dynload::cblas_dasum(args...);
}
template <typename... ARGS>
static void GEMM_BATCH(ARGS... args) {
paddle::platform::dynload::cblas_dgemm_batch(args...);
phi::dynload::cblas_dgemm_batch(args...);
}
template <typename... ARGS>
static void VADD(ARGS... args) {
paddle::platform::dynload::vdAdd(args...);
phi::dynload::vdAdd(args...);
}
template <typename... ARGS>
static void VSUB(ARGS... args) {
paddle::platform::dynload::vdSub(args...);
phi::dynload::vdSub(args...);
}
template <typename... ARGS>
static void VMUL(ARGS... args) {
paddle::platform::dynload::vdMul(args...);
phi::dynload::vdMul(args...);
}
template <typename... ARGS>
static void VDIV(ARGS... args) {
paddle::platform::dynload::vdDiv(args...);
phi::dynload::vdDiv(args...);
}
template <typename... ARGS>
static void VEXP(ARGS... args) {
paddle::platform::dynload::vdExp(args...);
phi::dynload::vdExp(args...);
}
template <typename... ARGS>
static void VSQUARE(ARGS... args) {
paddle::platform::dynload::vdSqr(args...);
phi::dynload::vdSqr(args...);
}
template <typename... ARGS>
static void VPOW(ARGS... args) {
paddle::platform::dynload::vdPowx(args...);
phi::dynload::vdPowx(args...);
}
template <typename... ARGS>
static void VINV(ARGS... args) {
paddle::platform::dynload::vdInv(args...);
phi::dynload::vdInv(args...);
}
template <typename... ARGS>
static void VMERF(ARGS... args) {
paddle::platform::dynload::vmdErf(args...);
phi::dynload::vmdErf(args...);
}
#if !defined(_WIN32)
template <typename... ARGS>
static void CSRMM(ARGS... args) {
paddle::platform::dynload::mkl_dcsrmm(args...);
phi::dynload::mkl_dcsrmm(args...);
}
#endif
template <typename... ARGS>
static void TRSM(ARGS... args) {
paddle::platform::dynload::cblas_dtrsm(args...);
phi::dynload::cblas_dtrsm(args...);
}
};
......@@ -370,12 +370,12 @@ struct CBlas<phi::dtype::complex<float>> {
const int incX,
phi::dtype::complex<float> *Y,
const int incY) {
paddle::platform::dynload::cblas_caxpy(n, &alpha, X, incX, Y, incY);
phi::dynload::cblas_caxpy(n, &alpha, X, incX, Y, incY);
}
template <typename... ARGS>
static void VCOPY(ARGS... args) {
paddle::platform::dynload::cblas_ccopy(args...);
phi::dynload::cblas_ccopy(args...);
}
// the libmklml_intel.so paddle used has no vcAdd, vcSub,
......@@ -384,22 +384,22 @@ struct CBlas<phi::dtype::complex<float>> {
/*
template <typename... ARGS>
static void VADD(ARGS... args) {
paddle::platform::dynload::vcAdd(args...);
phi::dynload::vcAdd(args...);
}
template <typename... ARGS>
static void VSUB(ARGS... args) {
paddle::platform::dynload::vcSub(args...);
phi::dynload::vcSub(args...);
}
template <typename... ARGS>
static void VMUL(ARGS... args) {
paddle::platform::dynload::vcMul(args...);
phi::dynload::vcMul(args...);
}
template <typename... ARGS>
static void VDIV(ARGS... args) {
paddle::platform::dynload::vcDiv(args...);
phi::dynload::vcDiv(args...);
}
*/
......@@ -458,7 +458,7 @@ struct CBlas<phi::dtype::complex<float>> {
const void *a_ = (const void *)(A);
const void *x_ = (const void *)(X);
void *y_ = static_cast<void *>(Y);
paddle::platform::dynload::cblas_cgemv(
phi::dynload::cblas_cgemv(
layout, trans, M, N, &alpha, a_, lda, x_, incx, &beta, y_, incy);
}
......@@ -480,20 +480,20 @@ struct CBlas<phi::dtype::complex<float>> {
const void *a_ = (const void *)(A);
const void *b_ = (const void *)(B);
void *c_ = static_cast<void *>(C);
paddle::platform::dynload::cblas_cgemm(layout,
trans_a,
trans_b,
M,
N,
K,
&alpha,
a_,
lda,
b_,
ldb,
&beta,
c_,
ldc);
phi::dynload::cblas_cgemm(layout,
trans_a,
trans_b,
M,
N,
K,
&alpha,
a_,
lda,
b_,
ldb,
&beta,
c_,
ldc);
}
static void TRSM(CBLAS_LAYOUT layout,
......@@ -510,7 +510,7 @@ struct CBlas<phi::dtype::complex<float>> {
int ldb) {
const void *a_ = (const void *)(A);
void *b_ = static_cast<void *>(B);
paddle::platform::dynload::cblas_ctrsm(
phi::dynload::cblas_ctrsm(
layout, side, uplo, trans_a, diag, M, N, &alpha, a_, lda, b_, ldb);
}
......@@ -535,27 +535,27 @@ struct CBlas<phi::dtype::complex<float>> {
const void **B_void = (const void **)(&(*B));
void **C_void = reinterpret_cast<void **>(C);
paddle::platform::dynload::cblas_cgemm_batch(layout,
trans_a,
trans_b,
M,
N,
K,
alpha,
A_void,
lda,
B_void,
ldb,
beta,
C_void,
ldc,
group_count,
group_size);
phi::dynload::cblas_cgemm_batch(layout,
trans_a,
trans_b,
M,
N,
K,
alpha,
A_void,
lda,
B_void,
ldb,
beta,
C_void,
ldc,
group_count,
group_size);
}
template <typename... ARGS>
static void GEMM_EX(ARGS... args) {
paddle::platform::dynload::cblas_cgemm_batch(args...);
phi::dynload::cblas_cgemm_batch(args...);
}
};
......@@ -568,12 +568,12 @@ struct CBlas<phi::dtype::complex<double>> {
const int incX,
phi::dtype::complex<double> *Y,
const int incY) {
paddle::platform::dynload::cblas_zaxpy(n, &alpha, X, incX, Y, incY);
phi::dynload::cblas_zaxpy(n, &alpha, X, incX, Y, incY);
}
template <typename... ARGS>
static void VCOPY(ARGS... args) {
paddle::platform::dynload::cblas_zcopy(args...);
phi::dynload::cblas_zcopy(args...);
}
// the libmklml_intel.so paddle used has no vzAdd, vzSub,
......@@ -582,22 +582,22 @@ struct CBlas<phi::dtype::complex<double>> {
/*
template <typename... ARGS>
static void VADD(ARGS... args) {
paddle::platform::dynload::vzAdd(args...);
phi::dynload::vzAdd(args...);
}
template <typename... ARGS>
static void VSUB(ARGS... args) {
paddle::platform::dynload::vzSub(args...);
phi::dynload::vzSub(args...);
}
template <typename... ARGS>
static void VMUL(ARGS... args) {
paddle::platform::dynload::vzMul(args...);
phi::dynload::vzMul(args...);
}
template <typename... ARGS>
static void VDIV(ARGS... args) {
paddle::platform::dynload::vzDiv(args...);
phi::dynload::vzDiv(args...);
}
*/
......@@ -656,7 +656,7 @@ struct CBlas<phi::dtype::complex<double>> {
const void *a_ = (const void *)(A);
const void *x_ = (const void *)(X);
void *y_ = static_cast<void *>(Y);
paddle::platform::dynload::cblas_zgemv(
phi::dynload::cblas_zgemv(
layout, trans, M, N, &alpha, a_, lda, x_, incx, &beta, y_, incy);
}
......@@ -678,20 +678,20 @@ struct CBlas<phi::dtype::complex<double>> {
const void *a_ = (const void *)(A);
const void *b_ = (const void *)(B);
void *c_ = static_cast<void *>(C);
paddle::platform::dynload::cblas_zgemm(layout,
trans_a,
trans_b,
M,
N,
K,
&alpha,
a_,
lda,
b_,
ldb,
&beta,
c_,
ldc);
phi::dynload::cblas_zgemm(layout,
trans_a,
trans_b,
M,
N,
K,
&alpha,
a_,
lda,
b_,
ldb,
&beta,
c_,
ldc);
}
static void TRSM(CBLAS_LAYOUT layout,
......@@ -708,7 +708,7 @@ struct CBlas<phi::dtype::complex<double>> {
int ldb) {
const void *a_ = (const void *)(A);
void *b_ = static_cast<void *>(B);
paddle::platform::dynload::cblas_ztrsm(
phi::dynload::cblas_ztrsm(
layout, side, uplo, trans_a, diag, M, N, &alpha, a_, lda, b_, ldb);
}
......@@ -733,27 +733,27 @@ struct CBlas<phi::dtype::complex<double>> {
const void **B_void = (const void **)(&(*B));
void **C_void = reinterpret_cast<void **>(C);
paddle::platform::dynload::cblas_zgemm_batch(layout,
trans_a,
trans_b,
M,
N,
K,
alpha,
A_void,
lda,
B_void,
ldb,
beta,
C_void,
ldc,
group_count,
group_size);
phi::dynload::cblas_zgemm_batch(layout,
trans_a,
trans_b,
M,
N,
K,
alpha,
A_void,
lda,
B_void,
ldb,
beta,
C_void,
ldc,
group_count,
group_size);
}
template <typename... ARGS>
static void GEMM_EX(ARGS... args) {
paddle::platform::dynload::cblas_zgemm_batch(args...);
phi::dynload::cblas_zgemm_batch(args...);
}
};
......
......@@ -21,7 +21,7 @@ limitations under the License. */
#include "paddle/fluid/platform/enforce.h"
#ifdef PADDLE_WITH_MKLML
#include "paddle/fluid/platform/dynload/mklml.h"
#include "paddle/phi/backends/dynload/mklml.h"
#endif
namespace phi {
......@@ -60,23 +60,23 @@ inline void vec_exp<float>(const int n, const float* x, float* y) {
y[i] = std::exp(x[i]);
}
} else {
paddle::platform::dynload::vsExp(n, x, y);
phi::dynload::vsExp(n, x, y);
}
}
template <>
inline void vec_exp<double>(const int n, const double* x, double* y) {
paddle::platform::dynload::vdExp(n, x, y);
phi::dynload::vdExp(n, x, y);
}
template <>
inline void vec_scal<float>(const int n, const float a, float* x) {
paddle::platform::dynload::cblas_sscal(n, a, x, 1);
phi::dynload::cblas_sscal(n, a, x, 1);
}
template <>
inline void vec_scal<double>(const int n, const double a, double* x) {
paddle::platform::dynload::cblas_dscal(n, a, x, 1);
phi::dynload::cblas_dscal(n, a, x, 1);
}
#endif
......
......@@ -15,7 +15,7 @@ limitations under the License. */
#include "paddle/phi/kernels/funcs/math_function.h"
#ifdef PADDLE_WITH_MKLML
#include "paddle/fluid/platform/dynload/mklml.h"
#include "paddle/phi/backends/dynload/mklml.h"
#endif
#ifdef PADDLE_USE_OPENBLAS
......
......@@ -102,14 +102,12 @@ class RNNDescriptors {
if (!is_test_ && !is_initialized) {
#ifdef PADDLE_WITH_HIP
PADDLE_ENFORCE_GPU_SUCCESS(
paddle::platform::dynload::miopenDropoutGetStatesSize(handle,
&state_size));
phi::dynload::miopenDropoutGetStatesSize(handle, &state_size));
dropout_state->mutable_data<uint8_t>({static_cast<int64_t>(state_size)},
place);
#else
PADDLE_ENFORCE_GPU_SUCCESS(
paddle::platform::dynload::cudnnDropoutGetStatesSize(handle,
&state_size));
phi::dynload::cudnnDropoutGetStatesSize(handle, &state_size));
dropout_state->mutable_data<uint8_t>({static_cast<int64_t>(state_size)},
place);
#endif
......@@ -124,33 +122,31 @@ class RNNDescriptors {
// ------------------- cudnn rnn descriptors ---------------------
#ifdef PADDLE_WITH_HIP
PADDLE_ENFORCE_GPU_SUCCESS(
paddle::platform::dynload::miopenSetRNNDescriptor_V2(
rnn_desc_.desc(),
hidden_size_,
num_layers_,
dropout_desc_.desc(),
miopenRNNlinear,
is_bidirec_ ? miopenRNNbidirection : miopenRNNunidirection,
mode_,
miopenRNNwithBias,
miopenRNNdefault,
cudnn_type));
PADDLE_ENFORCE_GPU_SUCCESS(phi::dynload::miopenSetRNNDescriptor_V2(
rnn_desc_.desc(),
hidden_size_,
num_layers_,
dropout_desc_.desc(),
miopenRNNlinear,
is_bidirec_ ? miopenRNNbidirection : miopenRNNunidirection,
mode_,
miopenRNNwithBias,
miopenRNNdefault,
cudnn_type));
#elif CUDNN_VERSION >= 6000
PADDLE_ENFORCE_GPU_SUCCESS(
paddle::platform::dynload::cudnnSetRNNDescriptor_v6(
handle,
rnn_desc_.desc(),
hidden_size_,
num_layers_,
dropout_desc_.desc(),
CUDNN_LINEAR_INPUT,
is_bidirec_ ? CUDNN_BIDIRECTIONAL : CUDNN_UNIDIRECTIONAL,
mode_,
CUDNN_RNN_ALGO_STANDARD,
cudnn_type));
PADDLE_ENFORCE_GPU_SUCCESS(phi::dynload::cudnnSetRNNDescriptor_v6(
handle,
rnn_desc_.desc(),
hidden_size_,
num_layers_,
dropout_desc_.desc(),
CUDNN_LINEAR_INPUT,
is_bidirec_ ? CUDNN_BIDIRECTIONAL : CUDNN_UNIDIRECTIONAL,
mode_,
CUDNN_RNN_ALGO_STANDARD,
cudnn_type));
#else
PADDLE_ENFORCE_GPU_SUCCESS(paddle::platform::dynload::cudnnSetRNNDescriptor(
PADDLE_ENFORCE_GPU_SUCCESS(phi::dynload::cudnnSetRNNDescriptor(
rnn_desc_.desc(),
hidden_size_,
num_layers_,
......@@ -163,20 +159,18 @@ class RNNDescriptors {
#if defined(PADDLE_WITH_CUDA) && CUDNN_VERSION >= 7201
if (!sequence_length.empty()) {
PADDLE_ENFORCE_GPU_SUCCESS(
paddle::platform::dynload::cudnnSetRNNPaddingMode(
rnn_desc_.desc(), CUDNN_RNN_PADDED_IO_ENABLED));
PADDLE_ENFORCE_GPU_SUCCESS(phi::dynload::cudnnSetRNNPaddingMode(
rnn_desc_.desc(), CUDNN_RNN_PADDED_IO_ENABLED));
}
#endif
// ------------------- cudnn weights_size ---------------------
size_t weights_size_;
#ifdef PADDLE_WITH_HIP
PADDLE_ENFORCE_GPU_SUCCESS(
paddle::platform::dynload::miopenGetRNNParamsSize(
handle, rnn_desc_.desc(), x_descs_[0], &weights_size_, cudnn_type));
PADDLE_ENFORCE_GPU_SUCCESS(phi::dynload::miopenGetRNNParamsSize(
handle, rnn_desc_.desc(), x_descs_[0], &weights_size_, cudnn_type));
#else
PADDLE_ENFORCE_GPU_SUCCESS(paddle::platform::dynload::cudnnGetRNNParamsSize(
PADDLE_ENFORCE_GPU_SUCCESS(phi::dynload::cudnnGetRNNParamsSize(
handle, rnn_desc_.desc(), x_descs_[0], &weights_size_, cudnn_type));
#endif
PADDLE_ENFORCE_EQ(
......@@ -192,32 +186,22 @@ class RNNDescriptors {
// ------------------- cudnn workspace, reserve size ---------------------
#ifdef PADDLE_WITH_HIP
PADDLE_ENFORCE_GPU_SUCCESS(
paddle::platform::dynload::miopenGetRNNWorkspaceSize(handle,
rnn_desc_.desc(),
seq_length_,
x_descs_.data(),
workspace_size));
PADDLE_ENFORCE_GPU_SUCCESS(
paddle::platform::dynload::miopenGetRNNTrainingReserveSize(
handle,
rnn_desc_.desc(),
seq_length_,
x_descs_.data(),
reserve_size));
phi::dynload::miopenGetRNNWorkspaceSize(handle,
rnn_desc_.desc(),
seq_length_,
x_descs_.data(),
workspace_size));
PADDLE_ENFORCE_GPU_SUCCESS(phi::dynload::miopenGetRNNTrainingReserveSize(
handle, rnn_desc_.desc(), seq_length_, x_descs_.data(), reserve_size));
#else
PADDLE_ENFORCE_GPU_SUCCESS(
paddle::platform::dynload::cudnnGetRNNWorkspaceSize(handle,
rnn_desc_.desc(),
seq_length_,
x_descs_.data(),
workspace_size));
PADDLE_ENFORCE_GPU_SUCCESS(
paddle::platform::dynload::cudnnGetRNNTrainingReserveSize(
handle,
rnn_desc_.desc(),
seq_length_,
x_descs_.data(),
reserve_size));
phi::dynload::cudnnGetRNNWorkspaceSize(handle,
rnn_desc_.desc(),
seq_length_,
x_descs_.data(),
workspace_size));
PADDLE_ENFORCE_GPU_SUCCESS(phi::dynload::cudnnGetRNNTrainingReserveSize(
handle, rnn_desc_.desc(), seq_length_, x_descs_.data(), reserve_size));
#endif
}
#ifdef PADDLE_WITH_HIP
......
......@@ -434,14 +434,14 @@ void SyncBatchNormGradFunctor(
int dtype = paddle::platform::ToNCCLDataType(
paddle::framework::TransToProtoVarType(scale.dtype()));
// In-place operation
PADDLE_ENFORCE_GPU_SUCCESS(paddle::platform::dynload::ncclAllReduce(
stats,
stats,
2 * C + 1,
static_cast<ncclDataType_t>(dtype),
ncclSum,
comm,
stream));
PADDLE_ENFORCE_GPU_SUCCESS(
phi::dynload::ncclAllReduce(stats,
stats,
2 * C + 1,
static_cast<ncclDataType_t>(dtype),
ncclSum,
comm,
stream));
VLOG(3) << "Sync result using all reduce";
}
#endif
......
......@@ -1063,7 +1063,7 @@ void SoftmaxForwardCudnnKernel(const GPUContext& dev_ctx,
auto mode = axis == rank - 1 ? MIOPEN_SOFTMAX_MODE_INSTANCE
: MIOPEN_SOFTMAX_MODE_CHANNEL;
auto algo = log_mode ? MIOPEN_SOFTMAX_LOG : MIOPEN_SOFTMAX_ACCURATE;
PADDLE_ENFORCE_GPU_SUCCESS(paddle::platform::dynload::miopenSoftmaxForward_V2(
PADDLE_ENFORCE_GPU_SUCCESS(phi::dynload::miopenSoftmaxForward_V2(
handle,
paddle::platform::CudnnDataType<T>::kOne(),
desc,
......@@ -1078,7 +1078,7 @@ void SoftmaxForwardCudnnKernel(const GPUContext& dev_ctx,
auto mode = axis == rank - 1 ? CUDNN_SOFTMAX_MODE_INSTANCE
: CUDNN_SOFTMAX_MODE_CHANNEL;
auto algo = log_mode ? CUDNN_SOFTMAX_LOG : CUDNN_SOFTMAX_ACCURATE;
PADDLE_ENFORCE_GPU_SUCCESS(paddle::platform::dynload::cudnnSoftmaxForward(
PADDLE_ENFORCE_GPU_SUCCESS(phi::dynload::cudnnSoftmaxForward(
handle,
algo,
mode,
......@@ -1135,25 +1135,24 @@ void SoftmaxBackwardCudnnKernel(const GPUContext& dev_ctx,
auto mode = axis == rank - 1 ? MIOPEN_SOFTMAX_MODE_INSTANCE
: MIOPEN_SOFTMAX_MODE_CHANNEL;
auto algo = log_mode ? MIOPEN_SOFTMAX_LOG : MIOPEN_SOFTMAX_ACCURATE;
PADDLE_ENFORCE_GPU_SUCCESS(
paddle::platform::dynload::miopenSoftmaxBackward_V2(
handle,
paddle::platform::CudnnDataType<T>::kOne(),
desc,
out_data,
desc,
dout_data,
paddle::platform::CudnnDataType<T>::kZero(),
desc,
dx_data,
algo,
mode));
PADDLE_ENFORCE_GPU_SUCCESS(phi::dynload::miopenSoftmaxBackward_V2(
handle,
paddle::platform::CudnnDataType<T>::kOne(),
desc,
out_data,
desc,
dout_data,
paddle::platform::CudnnDataType<T>::kZero(),
desc,
dx_data,
algo,
mode));
#else
cudnnTensorDescriptor_t desc = scoped_desc.descriptor<T>(layout, tensor_dims);
auto mode = axis == rank - 1 ? CUDNN_SOFTMAX_MODE_INSTANCE
: CUDNN_SOFTMAX_MODE_CHANNEL;
auto algo = log_mode ? CUDNN_SOFTMAX_LOG : CUDNN_SOFTMAX_ACCURATE;
PADDLE_ENFORCE_GPU_SUCCESS(paddle::platform::dynload::cudnnSoftmaxBackward(
PADDLE_ENFORCE_GPU_SUCCESS(phi::dynload::cudnnSoftmaxBackward(
handle,
algo,
mode,
......
......@@ -24,9 +24,9 @@
#endif
#include "paddle/fluid/platform/cudnn_workspace_helper.h"
#include "paddle/fluid/platform/dynload/cudnn.h"
#include "paddle/fluid/platform/float16.h"
#include "paddle/fluid/platform/profiler.h"
#include "paddle/phi/backends/dynload/cudnn.h"
#include "paddle/phi/kernels/cpu/conv_util.h"
#include "paddle/phi/kernels/funcs/batch_norm_utils.h"
#include "paddle/phi/kernels/funcs/padding.h"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册