Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] fix phi extension header error when compiling custom device #60842

Merged
merged 7 commits into from
Jan 17, 2024
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
2 changes: 0 additions & 2 deletions paddle/phi/kernels/copysign_grad_kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
#pragma once

#include "paddle/phi/core/dense_tensor.h"
#include "paddle/phi/kernels/funcs/elementwise_base.h"
#include "paddle/phi/kernels/funcs/elementwise_functor.h"

namespace phi {

Expand Down
2 changes: 0 additions & 2 deletions paddle/phi/kernels/copysign_kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
#pragma once

#include "paddle/phi/core/dense_tensor.h"
#include "paddle/phi/kernels/funcs/broadcast_function.h"
#include "paddle/phi/kernels/funcs/elementwise_base.h"
namespace phi {

using float16 = phi::dtype::float16;
Expand Down
3 changes: 2 additions & 1 deletion paddle/phi/kernels/cpu/copysign_grad_kernel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@
// limitations under the License.

#include "paddle/phi/kernels/copysign_grad_kernel.h"

#include "paddle/phi/backends/cpu/cpu_context.h"
#include "paddle/phi/core/kernel_registry.h"
#include "paddle/phi/kernels/cpu/elementwise_grad.h"
#include "paddle/phi/kernels/funcs/elementwise_base.h"
#include "paddle/phi/kernels/funcs/elementwise_functor.h"

namespace phi {

Expand Down
3 changes: 2 additions & 1 deletion paddle/phi/kernels/cpu/copysign_kernel.cc
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
// limitations under the License.

#include "paddle/phi/kernels/copysign_kernel.h"

#include "paddle/phi/backends/cpu/cpu_context.h"
#include "paddle/phi/core/kernel_registry.h"
#include "paddle/phi/kernels/funcs/broadcast_function.h"
#include "paddle/phi/kernels/funcs/elementwise_base.h"
namespace phi {
template <typename T, typename Context>
void CopySignKernel(const Context& dev_ctx,
Expand Down
3 changes: 2 additions & 1 deletion paddle/phi/kernels/gpu/copysign_grad_kernel.cu
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
// limitations under the License.

#include "paddle/phi/kernels/copysign_grad_kernel.h"

#include "paddle/phi/backends/gpu/gpu_context.h"
#include "paddle/phi/core/kernel_registry.h"
#include "paddle/phi/kernels/funcs/elementwise_base.h"
#include "paddle/phi/kernels/funcs/elementwise_functor.h"
#include "paddle/phi/kernels/gpu/elementwise_grad.h"

namespace phi {
Expand Down
3 changes: 2 additions & 1 deletion paddle/phi/kernels/gpu/copysign_kernel.cu
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
// limitations under the License.

#include "paddle/phi/kernels/copysign_kernel.h"

#include "paddle/phi/backends/gpu/gpu_context.h"
#include "paddle/phi/core/kernel_registry.h"
#include "paddle/phi/kernels/funcs/broadcast_function.h"
#include "paddle/phi/kernels/funcs/elementwise_base.h"
namespace phi {
template <typename T, typename Context>
void CopySignKernel(const Context& dev_ctx,
Expand Down
4 changes: 4 additions & 0 deletions test/custom_runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,8 @@ if(WITH_CUSTOM_DEVICE AND NOT WITH_GPU)
set_tests_properties(test_fleet_launch_custom_device PROPERTIES TIMEOUT 120)
set_tests_properties(test_custom_cpu_to_static PROPERTIES TIMEOUT 180)
set_tests_properties(test_custom_op_setup PROPERTIES TIMEOUT 120)

# cpp testing
paddle_test(extension_header_test SRCS extension_header_test.cc DEPS phi
common)
endif()
24 changes: 24 additions & 0 deletions test/custom_runtime/extension_header_test.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright (c) 2023 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#include "glog/logging.h"
#include "gtest/gtest.h"

// Note(qili93): ensure compile with one header file 'extension.h' only,
// !!! do not fix this ut by adding other header files (PR#60842) !!!
#include "paddle/phi/extension.h"

TEST(CustomDevce, extension_header) {
VLOG(1) << "check extension header support compile only";
}