Skip to content

Commit

Permalink
Move the header file of conv cudnn and miopen to phi directory. (#47248)
Browse files Browse the repository at this point in the history
  • Loading branch information
Xreki authored Oct 24, 2022
1 parent a5f556f commit 31f57f2
Show file tree
Hide file tree
Showing 14 changed files with 415 additions and 502 deletions.
3 changes: 1 addition & 2 deletions paddle/fluid/framework/var_type_traits.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,14 @@
#endif
#include <cudnn.h>

#include "paddle/fluid/operators/conv_cudnn_op_cache.h"
#include "paddle/fluid/operators/cudnn_rnn_cache.h"
#include "paddle/phi/kernels/gpudnn/conv_gpudnn_info.h"
#endif
#ifdef PADDLE_WITH_HIP
#if defined(PADDLE_WITH_RCCL)
#include "paddle/fluid/operators/nccl/nccl_gpu_common.h" // NOLINT
#include "paddle/fluid/platform/device/gpu/nccl_helper.h" // NOLINT
#endif
#include "paddle/fluid/operators/conv_cudnn_op_cache.h" // NOLINT
#include "paddle/fluid/operators/miopen_rnn_cache.h"
#endif

Expand Down
2 changes: 0 additions & 2 deletions paddle/fluid/framework/var_type_traits_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,13 @@
#include "paddle/fluid/operators/nccl/nccl_gpu_common.h"
#include "paddle/fluid/platform/device/gpu/nccl_helper.h"
#endif
#include "paddle/fluid/operators/conv_cudnn_op_cache.h"
#include "paddle/fluid/operators/cudnn_rnn_cache.h"
#endif
#ifdef PADDLE_WITH_HIP
#if defined(PADDLE_WITH_RCCL)
#include "paddle/fluid/operators/nccl/nccl_gpu_common.h" // NOLINT
#include "paddle/fluid/platform/device/gpu/nccl_helper.h" // NOLINT
#endif
#include "paddle/fluid/operators/conv_cudnn_op_cache.h" // NOLINT
#include "paddle/fluid/operators/miopen_rnn_cache.h"
#endif
#if defined(PADDLE_WITH_XPU_BKCL)
Expand Down
12 changes: 6 additions & 6 deletions paddle/fluid/operators/fused/conv_fusion_op.cu
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ limitations under the License. */

#include "paddle/fluid/framework/conv_search_cache.h"
#include "paddle/fluid/framework/op_registry.h"
#include "paddle/fluid/operators/conv_cudnn_op_cache.h"
#include "paddle/fluid/operators/conv_op.h"
#include "paddle/fluid/platform/device/gpu/gpu_dnn.h"
#include "paddle/phi/kernels/funcs/padding.h"
#include "paddle/phi/kernels/gpudnn/conv_gpudnn_info.h"

DECLARE_int64(cudnn_exhaustive_search_times);

Expand Down Expand Up @@ -216,7 +216,7 @@ class CUDNNConvFusionOpKernel : public framework::OpKernel<T> {
cudnn_conv_desc,
cudnn_output_desc,
output_data,
kNUM_CUDNN_FWD_ALGS,
phi::kNUM_CUDNN_FWD_ALGS,
&find_count,
&find_result,
cudnn_workspace_ptr,
Expand Down Expand Up @@ -337,15 +337,15 @@ class CUDNNConvFusionOpKernel : public framework::OpKernel<T> {
int best_algo_idx = 0;
size_t tmp_size = 0;
std::unique_ptr<cudnnConvolutionFwdAlgoPerf_t[]> perf_results(
new cudnnConvolutionFwdAlgoPerf_t[kNUM_CUDNN_FWD_ALGS]);
new cudnnConvolutionFwdAlgoPerf_t[phi::kNUM_CUDNN_FWD_ALGS]);
PADDLE_ENFORCE_GPU_SUCCESS(
platform::dynload::cudnnGetConvolutionForwardAlgorithm_v7(
handle,
cudnn_input_desc,
cudnn_filter_desc,
cudnn_conv_desc,
cudnn_output_desc,
kNUM_CUDNN_FWD_ALGS,
phi::kNUM_CUDNN_FWD_ALGS,
&perf_count,
perf_results.get()));
algo = (perf_results.get())[best_algo_idx].algo;
Expand Down Expand Up @@ -378,7 +378,7 @@ class CUDNNConvFusionOpKernel : public framework::OpKernel<T> {
[&]() -> SearchFuseResult<cudnnConvolutionFwdAlgo_t> {
int returned_algo_count;
SearchFuseResult<cudnnConvolutionFwdAlgo_t> fwd_result;
std::array<cudnnConvolutionFwdAlgoPerf_t, kNUM_CUDNN_FWD_ALGS>
std::array<cudnnConvolutionFwdAlgoPerf_t, phi::kNUM_CUDNN_FWD_ALGS>
fwd_perf_stat;
auto cudnn_find_func = [&](void* cudnn_workspace) {
PADDLE_ENFORCE_GPU_SUCCESS(
Expand All @@ -391,7 +391,7 @@ class CUDNNConvFusionOpKernel : public framework::OpKernel<T> {
cudnn_conv_desc,
cudnn_output_desc,
output_data,
kNUM_CUDNN_FWD_ALGS,
phi::kNUM_CUDNN_FWD_ALGS,
&returned_algo_count,
fwd_perf_stat.data(),
cudnn_workspace,
Expand Down
6 changes: 3 additions & 3 deletions paddle/fluid/operators/fused/fusion_conv_inception_op.cu
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ See the License for the specific language governing permissions and
limitations under the License. */

#include "paddle/fluid/framework/op_registry.h"
#include "paddle/fluid/operators/conv_cudnn_op_cache.h"
#include "paddle/fluid/platform/device/gpu/gpu_dnn.h"
#include "paddle/phi/kernels/gpudnn/conv_gpudnn_info.h"

namespace paddle {
namespace operators {
Expand Down Expand Up @@ -206,15 +206,15 @@ class CUDNNConvInceptionFusionOpKernel : public framework::OpKernel<T> {
int best_algo_idx = 0;
size_t tmp_size = 0;
std::unique_ptr<cudnnConvolutionFwdAlgoPerf_t[]> perf_results(
new cudnnConvolutionFwdAlgoPerf_t[kNUM_CUDNN_FWD_ALGS]);
new cudnnConvolutionFwdAlgoPerf_t[phi::kNUM_CUDNN_FWD_ALGS]);
PADDLE_ENFORCE_GPU_SUCCESS(
platform::dynload::cudnnGetConvolutionForwardAlgorithm_v7(
handle,
in_desc[i],
filter_desc[i],
conv_desc[i],
out_desc[i],
kNUM_CUDNN_FWD_ALGS,
phi::kNUM_CUDNN_FWD_ALGS,
&perf_count,
perf_results.get()));
algo[i] = (perf_results.get())[best_algo_idx].algo;
Expand Down
Loading

0 comments on commit 31f57f2

Please sign in to comment.