Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions paddle/fluid/imperative/reducer.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include "paddle/fluid/framework/tensor.h"
#include "paddle/fluid/framework/tensor_util.h"
#include "paddle/fluid/framework/variable.h"
#include "paddle/fluid/platform/for_range.h"
#include "paddle/phi/kernels/funcs/for_range.h"
#include "paddle/phi/kernels/funcs/math_function.h"

namespace paddle {
Expand Down Expand Up @@ -72,8 +72,8 @@ struct DivNRanksForAllReduce {
template <typename T>
void apply() const {
T* data = in_->mutable_data<T>(ctx_.GetPlace());
platform::ForRange<Dex> for_range(static_cast<const Dex&>(ctx_),
static_cast<size_t>(in_->numel()));
phi::funcs::ForRange<Dex> for_range(static_cast<const Dex&>(ctx_),
static_cast<size_t>(in_->numel()));
DivNRanksFunctor<T> functor(nranks_, data);
for_range(functor);
}
Expand Down
27 changes: 0 additions & 27 deletions paddle/fluid/platform/for_range.h

This file was deleted.

4 changes: 2 additions & 2 deletions test/cpp/fluid/memory/best_fit_allocator_test.cu
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "paddle/fluid/memory/allocation/best_fit_allocator.h"
#include "paddle/fluid/memory/allocation/cuda_allocator.h"
#include "paddle/fluid/memory/memcpy.h"
#include "paddle/fluid/platform/for_range.h"
#include "paddle/phi/kernels/funcs/for_range.h"
namespace paddle {
namespace memory {
namespace allocation {
Expand Down Expand Up @@ -62,7 +62,7 @@ TEST(BestFitAllocator, concurrent_cuda) {
size_t* data = reinterpret_cast<size_t*>(allocation->ptr());

ForEachFill fill(data);
platform::ForRange<phi::GPUContext> for_range(dev_ctx, allocate_size);
phi::funcs::ForRange<phi::GPUContext> for_range(dev_ctx, allocate_size);
for_range(fill);

memory::Copy(phi::CPUPlace(),
Expand Down
6 changes: 3 additions & 3 deletions test/cpp/fluid/test_leaky_relu_grad_grad_functor.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#include "gtest/gtest.h"
#include "paddle/fluid/operators/activation_op.h"
#include "paddle/fluid/platform/for_range.h"
#include "paddle/phi/kernels/funcs/for_range.h"

namespace paddle {
namespace operators {
Expand Down Expand Up @@ -98,13 +98,13 @@ static bool TestLeakyReluGradGradMain(const phi::DDim &dim,
if (phi::is_gpu_place(place)) {
auto &cuda_dev_ctx = dynamic_cast<phi::GPUContext &>(dev_ctx);
functor(cuda_dev_ctx, &x, out, &ddx, &ddout, dout, dx);
platform::ForRange<phi::GPUContext> for_range(cuda_dev_ctx, limit);
phi::funcs::ForRange<phi::GPUContext> for_range(cuda_dev_ctx, limit);
for_range(actual_functor);
} else {
#endif
auto &cpu_dev_ctx = dynamic_cast<phi::CPUContext &>(dev_ctx);
functor(cpu_dev_ctx, &x, out, &ddx, &ddout, dout, dx);
platform::ForRange<phi::CPUContext> for_range(cpu_dev_ctx, limit);
phi::funcs::ForRange<phi::CPUContext> for_range(cpu_dev_ctx, limit);
for_range(actual_functor);
#if defined(__NVCC__) || defined(__HIPCC__)
}
Expand Down
14 changes: 7 additions & 7 deletions test/deprecated/custom_op/custom_raw_op_kernel_op.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "paddle/fluid/framework/data_type.h"
#include "paddle/fluid/framework/tensor.h"
#include "paddle/fluid/platform/device_context.h"
#include "paddle/fluid/platform/for_range.h"
#include "paddle/phi/kernels/funcs/for_range.h"

namespace custom_raw_op {

Expand Down Expand Up @@ -50,12 +50,12 @@ struct ReluFunctor {

const auto &dev_ctx = *phi::DeviceContextPool::Instance().Get(place);

#define LAUNCH_RELU_KERNEL(DevCtxT) \
do { \
auto &__dev_ctx = dynamic_cast<const DevCtxT &>(dev_ctx); \
paddle::platform::ForRange<DevCtxT> for_range(__dev_ctx, n); \
Impl<T> functor(x_data, y_data); \
for_range(functor); \
#define LAUNCH_RELU_KERNEL(DevCtxT) \
do { \
auto &__dev_ctx = dynamic_cast<const DevCtxT &>(dev_ctx); \
phi::funcs::ForRange<DevCtxT> for_range(__dev_ctx, n); \
Impl<T> functor(x_data, y_data); \
for_range(functor); \
} while (0)

#if defined(__NVCC__) || defined(__HIPCC__)
Expand Down