diff --git a/paddle/fluid/framework/details/all_reduce_op_handle.h b/paddle/fluid/framework/details/all_reduce_op_handle.h index 39b923be9df84f4ebd471a6e918ba7effe79550d..033d9396e9bf230982f2561d90a07090fd97cc60 100644 --- a/paddle/fluid/framework/details/all_reduce_op_handle.h +++ b/paddle/fluid/framework/details/all_reduce_op_handle.h @@ -36,7 +36,7 @@ class NCCLCommunicator; #include "paddle/fluid/platform/nccl_helper.h" #elif defined(PADDLE_WITH_XPU_BKCL) #include "paddle/fluid/framework/details/bkcl_op_handle.h" -#include "paddle/fluid/platform/bkcl_helper.h" +#include "paddle/fluid/platform/device/xpu/bkcl_helper.h" #endif namespace paddle { diff --git a/paddle/fluid/framework/details/bkcl_op_handle.h b/paddle/fluid/framework/details/bkcl_op_handle.h index fe63153a30920540dac35ce4a6552588aed998c5..f863cb123a8afb7c29d87d4940e4a7e65fb432e9 100644 --- a/paddle/fluid/framework/details/bkcl_op_handle.h +++ b/paddle/fluid/framework/details/bkcl_op_handle.h @@ -23,7 +23,7 @@ #include "paddle/fluid/framework/details/op_handle_base.h" #include "paddle/fluid/framework/lod_tensor.h" #include "paddle/fluid/framework/scope.h" -#include "paddle/fluid/platform/bkcl_helper.h" +#include "paddle/fluid/platform/device/xpu/bkcl_helper.h" DECLARE_bool(sync_bkcl_allreduce); diff --git a/paddle/fluid/framework/details/broadcast_op_handle.h b/paddle/fluid/framework/details/broadcast_op_handle.h index 8ca20da97416c6eb2ed64520bc30431de31de6ee..0b062b1a3f49a40ee3b67872afcdcfcd900dd803 100644 --- a/paddle/fluid/framework/details/broadcast_op_handle.h +++ b/paddle/fluid/framework/details/broadcast_op_handle.h @@ -46,7 +46,7 @@ struct BKCLContextMap; #if defined(PADDLE_WITH_NCCL) || defined(PADDLE_WITH_RCCL) #include "paddle/fluid/platform/nccl_helper.h" #elif defined(PADDLE_WITH_XPU_BKCL) -#include "paddle/fluid/platform/bkcl_helper.h" +#include "paddle/fluid/platform/device/xpu/bkcl_helper.h" #endif namespace paddle { diff --git a/paddle/fluid/framework/details/build_strategy.h b/paddle/fluid/framework/details/build_strategy.h index 25110fe24f5871c721989f83a89eccd282566277..68c5daaac5d78049b7d0778edc2b22d652ceb65d 100644 --- a/paddle/fluid/framework/details/build_strategy.h +++ b/paddle/fluid/framework/details/build_strategy.h @@ -42,7 +42,7 @@ class NCCLCommunicator; #if defined(PADDLE_WITH_NCCL) || defined(PADDLE_WITH_RCCL) #include "paddle/fluid/platform/nccl_helper.h" #elif defined(PADDLE_WITH_XPU) && defined(PADDLE_WITH_XPU_BKCL) -#include "paddle/fluid/platform/bkcl_helper.h" +#include "paddle/fluid/platform/device/xpu/bkcl_helper.h" #endif namespace paddle { diff --git a/paddle/fluid/framework/details/fused_all_reduce_op_handle.h b/paddle/fluid/framework/details/fused_all_reduce_op_handle.h index 8473700867ce323029aa364af157c148ffa12c54..31336b92c4dfb6351a8d2cb05304ad4a29efecff 100644 --- a/paddle/fluid/framework/details/fused_all_reduce_op_handle.h +++ b/paddle/fluid/framework/details/fused_all_reduce_op_handle.h @@ -37,7 +37,7 @@ class NCCLCommunicator; #include "paddle/fluid/framework/details/nccl_op_handle.h" #include "paddle/fluid/platform/nccl_helper.h" #elif defined(PADDLE_WITH_XPU_BKCL) -#include "paddle/fluid/platform/bkcl_helper.h" +#include "paddle/fluid/platform/device/xpu/bkcl_helper.h" #endif namespace paddle { diff --git a/paddle/fluid/framework/details/reduce_op_handle.h b/paddle/fluid/framework/details/reduce_op_handle.h index 569699c19ccf5050ea52d48ed8167d9fd9d23907..d56b6b3663003c6f4568f6d6619b12af2c981536 100644 --- a/paddle/fluid/framework/details/reduce_op_handle.h +++ b/paddle/fluid/framework/details/reduce_op_handle.h @@ -43,7 +43,7 @@ struct NCCLContextMap; #if defined(PADDLE_WITH_NCCL) || defined(PADDLE_WITH_RCCL) #include "paddle/fluid/platform/nccl_helper.h" #elif defined(PADDLE_WITH_XPU_BKCL) -#include "paddle/fluid/platform/bkcl_helper.h" +#include "paddle/fluid/platform/device/xpu/bkcl_helper.h" #endif namespace paddle { diff --git a/paddle/fluid/framework/operator.cc b/paddle/fluid/framework/operator.cc index f2615694cfbc83aa4d203f6f64efb1e25e620bc4..cde5d1353d018c8d904c55a8061beb029e3a9248 100644 --- a/paddle/fluid/framework/operator.cc +++ b/paddle/fluid/framework/operator.cc @@ -37,8 +37,8 @@ class LoDTensor; } // namespace framework } // namespace paddle #ifdef PADDLE_WITH_XPU -#include "paddle/fluid/platform/xpu/xpu_info.h" -#include "paddle/fluid/platform/xpu/xpu_op_list.h" +#include "paddle/fluid/platform/device/xpu/xpu_info.h" +#include "paddle/fluid/platform/device/xpu/xpu_op_list.h" #endif #ifdef PADDLE_WITH_MKLDNN diff --git a/paddle/fluid/framework/var_type_traits.cc b/paddle/fluid/framework/var_type_traits.cc index 886d00e562bff1a1de9ebb45162f05cb5033b534..1d5e638729361da4752a0f4ef3545333f7e825ce 100644 --- a/paddle/fluid/framework/var_type_traits.cc +++ b/paddle/fluid/framework/var_type_traits.cc @@ -38,7 +38,7 @@ #endif #if defined(PADDLE_WITH_XPU_BKCL) -#include "paddle/fluid/platform/bkcl_helper.h" +#include "paddle/fluid/platform/device/xpu/bkcl_helper.h" #endif namespace paddle { diff --git a/paddle/fluid/framework/var_type_traits_test.cc b/paddle/fluid/framework/var_type_traits_test.cc index 2a6635c4b6050b8f70a4e517d550b66581ab3a21..ae7ae85207d849b7cb37c64d26dd3485c7da22b9 100644 --- a/paddle/fluid/framework/var_type_traits_test.cc +++ b/paddle/fluid/framework/var_type_traits_test.cc @@ -37,7 +37,7 @@ #include "paddle/fluid/operators/miopen_rnn_cache.h" #endif #if defined(PADDLE_WITH_XPU_BKCL) -#include "paddle/fluid/platform/bkcl_helper.h" +#include "paddle/fluid/platform/device/xpu/bkcl_helper.h" #endif namespace paddle { diff --git a/paddle/fluid/imperative/bkcl_context.cc b/paddle/fluid/imperative/bkcl_context.cc index ba9b70aea7b96c52f29411a9879a878aee21195b..8c6b840f60a591f82005f2eebc6c3e52f482591f 100644 --- a/paddle/fluid/imperative/bkcl_context.cc +++ b/paddle/fluid/imperative/bkcl_context.cc @@ -20,8 +20,8 @@ #include #include "paddle/fluid/framework/variable.h" -#include "paddle/fluid/platform/bkcl_helper.h" #include "paddle/fluid/platform/collective_helper.h" +#include "paddle/fluid/platform/device/xpu/bkcl_helper.h" #include "paddle/fluid/platform/device_context.h" #include "paddle/fluid/platform/gen_comm_id_helper.h" #include "paddle/fluid/platform/place.h" diff --git a/paddle/fluid/imperative/prepared_operator.cc b/paddle/fluid/imperative/prepared_operator.cc index 521f85d9429ba7ce112439d65c5e5a3dbbbf5888..167afdfb1966d772374cd3a5da2a4b7718496871 100644 --- a/paddle/fluid/imperative/prepared_operator.cc +++ b/paddle/fluid/imperative/prepared_operator.cc @@ -21,7 +21,7 @@ #include "paddle/pten/common/scalar.h" #include "paddle/utils/small_vector.h" #ifdef PADDLE_WITH_XPU -#include "paddle/fluid/platform/xpu/xpu_op_list.h" +#include "paddle/fluid/platform/device/xpu/xpu_op_list.h" #endif DECLARE_bool(check_nan_inf); DECLARE_bool(run_pten_kernel); diff --git a/paddle/fluid/memory/allocation/allocator_facade.cc b/paddle/fluid/memory/allocation/allocator_facade.cc index 9da735636fc00f927f034e0bb7a965669efe95eb..ca7f5655f08c37f47570e53f659d63cb74bab8c6 100644 --- a/paddle/fluid/memory/allocation/allocator_facade.cc +++ b/paddle/fluid/memory/allocation/allocator_facade.cc @@ -42,7 +42,7 @@ #include "paddle/fluid/platform/cuda_graph.h" #endif #ifdef PADDLE_WITH_XPU -#include "paddle/fluid/platform/xpu/xpu_info.h" +#include "paddle/fluid/platform/device/xpu/xpu_info.h" #endif #include "paddle/fluid/platform/npu_info.h" diff --git a/paddle/fluid/memory/allocation/naive_best_fit_allocator.cc b/paddle/fluid/memory/allocation/naive_best_fit_allocator.cc index 2c00b34dd1353b583a680fd12416fa4d545566ad..a9ef83db1704e7d2fe5cc250b4eeafb1cbfd670b 100644 --- a/paddle/fluid/memory/allocation/naive_best_fit_allocator.cc +++ b/paddle/fluid/memory/allocation/naive_best_fit_allocator.cc @@ -31,7 +31,7 @@ #include "paddle/fluid/platform/cuda_device_guard.h" #endif #ifdef PADDLE_WITH_XPU -#include "paddle/fluid/platform/xpu/xpu_header.h" +#include "paddle/fluid/platform/device/xpu/xpu_header.h" #endif PADDLE_DEFINE_EXPORTED_bool( diff --git a/paddle/fluid/memory/memcpy.cc b/paddle/fluid/memory/memcpy.cc index 3b3be9776c4c54362ed55cd1208e7d17c9e10315..574b15205439935ac199d0b37c963d10c1851cbc 100644 --- a/paddle/fluid/memory/memcpy.cc +++ b/paddle/fluid/memory/memcpy.cc @@ -19,7 +19,7 @@ limitations under the License. */ #include "paddle/fluid/platform/profiler.h" #ifdef PADDLE_WITH_XPU -#include "paddle/fluid/platform/xpu/xpu_header.h" +#include "paddle/fluid/platform/device/xpu/xpu_header.h" #endif namespace paddle { diff --git a/paddle/fluid/operators/activation_op_xpu.cc b/paddle/fluid/operators/activation_op_xpu.cc index 2c3d9697366cadfc60bf432b613704aed569059c..fe85eb26705d1f5c3cec21c6585fee3a7bf0feb2 100644 --- a/paddle/fluid/operators/activation_op_xpu.cc +++ b/paddle/fluid/operators/activation_op_xpu.cc @@ -16,7 +16,7 @@ limitations under the License. */ #include "paddle/fluid/operators/activation_op.h" #include -#include "paddle/fluid/platform/xpu/xpu_header.h" +#include "paddle/fluid/platform/device/xpu/xpu_header.h" namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/collective/broadcast_op_xpu.cc b/paddle/fluid/operators/collective/broadcast_op_xpu.cc index 2bfd77b8c2a090bc507ce0b6dee6ad86f75de0b1..9cd5c5fd22cc384f21acfbcfd71aaae70ff51513 100644 --- a/paddle/fluid/operators/collective/broadcast_op_xpu.cc +++ b/paddle/fluid/operators/collective/broadcast_op_xpu.cc @@ -21,8 +21,8 @@ limitations under the License. */ #include "paddle/fluid/framework/op_registry.h" #if defined(PADDLE_WITH_XPU_BKCL) -#include "paddle/fluid/platform/bkcl_helper.h" #include "paddle/fluid/platform/collective_helper.h" +#include "paddle/fluid/platform/device/xpu/bkcl_helper.h" #endif namespace ops = paddle::operators; diff --git a/paddle/fluid/operators/collective/c_allreduce_op.h b/paddle/fluid/operators/collective/c_allreduce_op.h index a19d603ada8257995592969769bfd6db7a50d5c0..938ded9d017632b860c65a7b1badd4fcd9332235 100644 --- a/paddle/fluid/operators/collective/c_allreduce_op.h +++ b/paddle/fluid/operators/collective/c_allreduce_op.h @@ -33,7 +33,7 @@ limitations under the License. */ #endif #if defined(PADDLE_WITH_XPU_BKCL) -#include "paddle/fluid/platform/bkcl_helper.h" +#include "paddle/fluid/platform/device/xpu/bkcl_helper.h" #endif #if defined(PADDLE_WITH_GLOO) diff --git a/paddle/fluid/operators/collective/c_reduce_op.h b/paddle/fluid/operators/collective/c_reduce_op.h index fa9fd079d8e48b053deaa12fb3d61b0c00713b22..06023dc8ca46187e67c804e3e6631291dfaddf2e 100644 --- a/paddle/fluid/operators/collective/c_reduce_op.h +++ b/paddle/fluid/operators/collective/c_reduce_op.h @@ -34,7 +34,7 @@ limitations under the License. */ #endif #if defined(PADDLE_WITH_XPU_BKCL) -#include "paddle/fluid/platform/bkcl_helper.h" +#include "paddle/fluid/platform/device/xpu/bkcl_helper.h" #endif #if defined(PADDLE_WITH_GLOO) diff --git a/paddle/fluid/operators/collective/gen_bkcl_id_op.cc b/paddle/fluid/operators/collective/gen_bkcl_id_op.cc index 7067bfb314485efb9aacd9a0e364ec3eddbe505d..1ce8938356895968c5cbf871701946886508ebc7 100644 --- a/paddle/fluid/operators/collective/gen_bkcl_id_op.cc +++ b/paddle/fluid/operators/collective/gen_bkcl_id_op.cc @@ -21,7 +21,7 @@ limitations under the License. */ #include "paddle/fluid/framework/operator.h" #include "paddle/fluid/framework/scope.h" #include "paddle/fluid/framework/var_type_traits.h" -#include "paddle/fluid/platform/bkcl_helper.h" +#include "paddle/fluid/platform/device/xpu/bkcl_helper.h" #include "paddle/fluid/platform/device_context.h" #include "paddle/fluid/platform/enforce.h" #include "paddle/fluid/platform/place.h" diff --git a/paddle/fluid/operators/concat_op_xpu.cc b/paddle/fluid/operators/concat_op_xpu.cc index dc9359ecf5c3d1647423a0828347f5e5bf0181d7..0ff11e11165f06628566c65050c90e0ce0f17240 100644 --- a/paddle/fluid/operators/concat_op_xpu.cc +++ b/paddle/fluid/operators/concat_op_xpu.cc @@ -16,7 +16,7 @@ limitations under the License. */ #include #include #include -#include "paddle/fluid/platform/xpu/xpu_header.h" +#include "paddle/fluid/platform/device/xpu/xpu_header.h" namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/deformable_conv_op_xpu.cc b/paddle/fluid/operators/deformable_conv_op_xpu.cc index 457616756215c2afb26f3238d44774f35b433136..ebdaf0acced13d1d859d1a50e774673982fd80e1 100644 --- a/paddle/fluid/operators/deformable_conv_op_xpu.cc +++ b/paddle/fluid/operators/deformable_conv_op_xpu.cc @@ -16,7 +16,7 @@ limitations under the License. */ #include #include #include "paddle/fluid/framework/op_registry.h" -#include "paddle/fluid/platform/xpu/xpu_header.h" +#include "paddle/fluid/platform/device/xpu/xpu_header.h" namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/dropout_op_xpu.cc b/paddle/fluid/operators/dropout_op_xpu.cc index 0b0b7095bd5d163ff79733c2f99a2b93f4d811a7..3335c0de429e4b6f065b37d3229baaf3af23e1ef 100644 --- a/paddle/fluid/operators/dropout_op_xpu.cc +++ b/paddle/fluid/operators/dropout_op_xpu.cc @@ -11,7 +11,7 @@ limitations under the License. */ #include "paddle/fluid/operators/dropout_op.h" #include #include -#include "paddle/fluid/platform/xpu/xpu_header.h" +#include "paddle/fluid/platform/device/xpu/xpu_header.h" namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/metrics/accuracy_op_xpu.cc b/paddle/fluid/operators/metrics/accuracy_op_xpu.cc index cb75616221bc4d998b2bb0da7458e4692010ff26..7031b96a50b9e442fc85c68a5942cc048c82d795 100644 --- a/paddle/fluid/operators/metrics/accuracy_op_xpu.cc +++ b/paddle/fluid/operators/metrics/accuracy_op_xpu.cc @@ -15,7 +15,7 @@ limitations under the License. */ #ifdef PADDLE_WITH_XPU #include "paddle/fluid/operators/metrics/accuracy_op.h" -#include "paddle/fluid/platform/xpu/xpu_header.h" +#include "paddle/fluid/platform/device/xpu/xpu_header.h" namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/reduce_ops/logsumexp_op_xpu.cc b/paddle/fluid/operators/reduce_ops/logsumexp_op_xpu.cc index 4f98dde210f7a7b9d6fbcf6e697fbc940b45e258..dcb849de0991bc93514a33d8ba93a6fe84d87093 100644 --- a/paddle/fluid/operators/reduce_ops/logsumexp_op_xpu.cc +++ b/paddle/fluid/operators/reduce_ops/logsumexp_op_xpu.cc @@ -15,8 +15,8 @@ #ifdef PADDLE_WITH_XPU #include "paddle/fluid/operators/reduce_ops/logsumexp_op.h" +#include "paddle/fluid/platform/device/xpu/xpu_header.h" #include "paddle/fluid/platform/device_context.h" -#include "paddle/fluid/platform/xpu/xpu_header.h" namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/reduce_ops/reduce_max_op_xpu.cc b/paddle/fluid/operators/reduce_ops/reduce_max_op_xpu.cc index ae27a5d7df473417cd8a1c48d8903dd6e887335f..15d672da04bec5fa581c04fee9d3854b1cf61633 100644 --- a/paddle/fluid/operators/reduce_ops/reduce_max_op_xpu.cc +++ b/paddle/fluid/operators/reduce_ops/reduce_max_op_xpu.cc @@ -16,7 +16,7 @@ #include #include #include "paddle/fluid/operators/reduce_ops/reduce_op_xpu.h" -#include "paddle/fluid/platform/xpu/xpu_header.h" +#include "paddle/fluid/platform/device/xpu/xpu_header.h" namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/reduce_ops/reduce_op_xpu.h b/paddle/fluid/operators/reduce_ops/reduce_op_xpu.h index 5ae60713bc912bf477ec1f918183d2317b8c7d4a..324fd369e82b597dfd318397f1273b4e4e4291f5 100644 --- a/paddle/fluid/operators/reduce_ops/reduce_op_xpu.h +++ b/paddle/fluid/operators/reduce_ops/reduce_op_xpu.h @@ -21,7 +21,7 @@ #include #include #include "paddle/fluid/operators/reduce_ops/reduce_op.h" -#include "paddle/fluid/platform/xpu/xpu_header.h" +#include "paddle/fluid/platform/device/xpu/xpu_header.h" namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/reduce_ops/reduce_sum_op_xpu.cc b/paddle/fluid/operators/reduce_ops/reduce_sum_op_xpu.cc index f759b104d01d1824713b05687dbeadf595cd4abe..7a5c86c35c6a2a99466476e04082ea683d2172aa 100644 --- a/paddle/fluid/operators/reduce_ops/reduce_sum_op_xpu.cc +++ b/paddle/fluid/operators/reduce_ops/reduce_sum_op_xpu.cc @@ -16,7 +16,7 @@ #include #include #include "paddle/fluid/operators/reduce_ops/reduce_op_xpu.h" -#include "paddle/fluid/platform/xpu/xpu_header.h" +#include "paddle/fluid/platform/device/xpu/xpu_header.h" namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/rnn_op_xpu.cc b/paddle/fluid/operators/rnn_op_xpu.cc index 9d637e1cee11763dd0af61d64102537bf0aaa371..183f83dbae7c3e1cda80cca8704ac8a7452a6173 100644 --- a/paddle/fluid/operators/rnn_op_xpu.cc +++ b/paddle/fluid/operators/rnn_op_xpu.cc @@ -13,8 +13,8 @@ limitations under the License. */ #include "paddle/fluid/framework/op_registry.h" #include "paddle/fluid/operators/utils.h" +#include "paddle/fluid/platform/device/xpu/xpu_header.h" #include "paddle/fluid/platform/device_context.h" -#include "paddle/fluid/platform/xpu/xpu_header.h" namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/scale_op_xpu.cc b/paddle/fluid/operators/scale_op_xpu.cc index d3943e09b6d0b1276b6756759389b269603b764a..4960f720ee39aaa130544befc9b0a6449d5381d9 100644 --- a/paddle/fluid/operators/scale_op_xpu.cc +++ b/paddle/fluid/operators/scale_op_xpu.cc @@ -16,7 +16,7 @@ limitations under the License. */ #include "paddle/fluid/operators/scale_op.h" #include -#include "paddle/fluid/platform/xpu/xpu_header.h" +#include "paddle/fluid/platform/device/xpu/xpu_header.h" namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/sign_op_xpu.cc b/paddle/fluid/operators/sign_op_xpu.cc index a164a9b056677ad4c115941386ac7079582ac655..8b3beb2fb397b0e744a90f01c9d505cbca69912e 100644 --- a/paddle/fluid/operators/sign_op_xpu.cc +++ b/paddle/fluid/operators/sign_op_xpu.cc @@ -15,7 +15,7 @@ limitations under the License. */ #ifdef PADDLE_WITH_XPU #include "paddle/fluid/operators/sign_op.h" -#include "paddle/fluid/platform/xpu/xpu_header.h" +#include "paddle/fluid/platform/device/xpu/xpu_header.h" namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/sum_op_xpu.cc b/paddle/fluid/operators/sum_op_xpu.cc index 89a48a2144ef7b9e72e494571a1a98f418a202ab..5899591549eacc831f42accdeec378ad688c294e 100644 --- a/paddle/fluid/operators/sum_op_xpu.cc +++ b/paddle/fluid/operators/sum_op_xpu.cc @@ -13,7 +13,7 @@ limitations under the License. */ #include "paddle/fluid/operators/sum_op.h" #include -#include "paddle/fluid/platform/xpu/xpu_header.h" +#include "paddle/fluid/platform/device/xpu/xpu_header.h" namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/transpose_op_xpu.cc b/paddle/fluid/operators/transpose_op_xpu.cc index 0e25a69f87c4a5384904d55911978c2d7321fb42..00a43c74d873663f651c6c1930175292f00ed72a 100644 --- a/paddle/fluid/operators/transpose_op_xpu.cc +++ b/paddle/fluid/operators/transpose_op_xpu.cc @@ -17,7 +17,7 @@ limitations under the License. */ #include #include #include -#include "paddle/fluid/platform/xpu/xpu_header.h" +#include "paddle/fluid/platform/device/xpu/xpu_header.h" namespace paddle { namespace operators { diff --git a/paddle/fluid/platform/CMakeLists.txt b/paddle/fluid/platform/CMakeLists.txt index 54e73c5c1d9fa21968d78874e8207abeb1d191fb..b6a2de06962f8d5b5c99896ce802a9ce418cc260 100644 --- a/paddle/fluid/platform/CMakeLists.txt +++ b/paddle/fluid/platform/CMakeLists.txt @@ -4,12 +4,6 @@ if(WITH_GPU) proto_library(external_error_proto SRCS external_error.proto) endif(WITH_GPU) -if(WITH_XPU) - set(XPU_CTX_DEPS xpulib ssl crypto rt z resolv dl) -ELSE() - set(XPU_CTX_DEPS) -endif(WITH_XPU) - if(WITH_ASCEND) set(ASCEND_DEPS xpulib) ELSE() @@ -74,10 +68,7 @@ ENDIF() cc_library(place SRCS place.cc DEPS enforce boost) cc_test(place_test SRCS place_test.cc DEPS place glog gflags) -if(WITH_XPU) -cc_library(xpu_info SRCS xpu/xpu_info.cc DEPS gflags glog enforce xpulib) -cc_library(xpu_op_list SRCS xpu/xpu_op_list.cc DEPS gflags glog enforce xpulib device_context) -endif() +add_subdirectory(device) if(WITH_ASCEND) cc_library(ascend_npu_info SRCS ascend_npu_info.cc DEPS gflags glog enforce atlas_acl) diff --git a/paddle/fluid/platform/device/CMakeLists.txt b/paddle/fluid/platform/device/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d8e5a7784ce4ad1d5ce26e888ce218bd92de541 --- /dev/null +++ b/paddle/fluid/platform/device/CMakeLists.txt @@ -0,0 +1,4 @@ +# XPU +IF(WITH_XPU) + add_subdirectory(xpu) +ENDIF() diff --git a/paddle/fluid/platform/device/xpu/CMakeLists.txt b/paddle/fluid/platform/device/xpu/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..17f492f93e534606bc4cf3f412d9badf0d6c45a7 --- /dev/null +++ b/paddle/fluid/platform/device/xpu/CMakeLists.txt @@ -0,0 +1,8 @@ +if(NOT WITH_XPU) + return() +endif() + +set(XPU_CTX_DEPS xpulib ssl crypto rt z resolv dl) + +cc_library(xpu_info SRCS xpu_info.cc DEPS gflags glog enforce xpulib) +cc_library(xpu_op_list SRCS xpu_op_list.cc DEPS gflags glog enforce xpulib device_context) diff --git a/paddle/fluid/platform/bkcl_helper.h b/paddle/fluid/platform/device/xpu/bkcl_helper.h similarity index 100% rename from paddle/fluid/platform/bkcl_helper.h rename to paddle/fluid/platform/device/xpu/bkcl_helper.h diff --git a/paddle/fluid/platform/xpu/xpu1_op_list.h b/paddle/fluid/platform/device/xpu/xpu1_op_list.h similarity index 100% rename from paddle/fluid/platform/xpu/xpu1_op_list.h rename to paddle/fluid/platform/device/xpu/xpu1_op_list.h diff --git a/paddle/fluid/platform/xpu/xpu2_op_list.h b/paddle/fluid/platform/device/xpu/xpu2_op_list.h similarity index 100% rename from paddle/fluid/platform/xpu/xpu2_op_list.h rename to paddle/fluid/platform/device/xpu/xpu2_op_list.h diff --git a/paddle/fluid/platform/xpu/xpu_header.h b/paddle/fluid/platform/device/xpu/xpu_header.h similarity index 98% rename from paddle/fluid/platform/xpu/xpu_header.h rename to paddle/fluid/platform/device/xpu/xpu_header.h index a72fbd65e24622c2c28bf35da1d6784d736656e9..fe75290c252dfdf2347a7d261ece204198d110c7 100644 --- a/paddle/fluid/platform/xpu/xpu_header.h +++ b/paddle/fluid/platform/device/xpu/xpu_header.h @@ -20,6 +20,7 @@ #include #include "paddle/fluid/platform/bfloat16.h" +#include "paddle/fluid/platform/enforce.h" #include "paddle/fluid/platform/errors.h" #include "paddle/fluid/platform/float16.h" #include "xpu/runtime.h" diff --git a/paddle/fluid/platform/xpu/xpu_info.cc b/paddle/fluid/platform/device/xpu/xpu_info.cc similarity index 97% rename from paddle/fluid/platform/xpu/xpu_info.cc rename to paddle/fluid/platform/device/xpu/xpu_info.cc index 3f45286d8f20209a28a12e98b0643a11d72afca6..adc8bcc22da98b7f119588f36cb12af85638779d 100644 --- a/paddle/fluid/platform/xpu/xpu_info.cc +++ b/paddle/fluid/platform/device/xpu/xpu_info.cc @@ -8,14 +8,14 @@ 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 "paddle/fluid/platform/xpu/xpu_info.h" +#include "paddle/fluid/platform/device/xpu/xpu_info.h" #include #include #include #include "gflags/gflags.h" +#include "paddle/fluid/platform/device/xpu/xpu_header.h" #include "paddle/fluid/platform/enforce.h" -#include "paddle/fluid/platform/xpu/xpu_header.h" #include "paddle/fluid/string/split.h" PADDLE_DEFINE_EXPORTED_string( diff --git a/paddle/fluid/platform/xpu/xpu_info.h b/paddle/fluid/platform/device/xpu/xpu_info.h similarity index 100% rename from paddle/fluid/platform/xpu/xpu_info.h rename to paddle/fluid/platform/device/xpu/xpu_info.h diff --git a/paddle/fluid/platform/xpu/xpu_op_list.cc b/paddle/fluid/platform/device/xpu/xpu_op_list.cc similarity index 91% rename from paddle/fluid/platform/xpu/xpu_op_list.cc rename to paddle/fluid/platform/device/xpu/xpu_op_list.cc index 0c10436f397898b7e7f96bb9f23eb1249d58b31d..7561830fc76c1160d6d2abf148a2ecfe4f5cc567 100644 --- a/paddle/fluid/platform/xpu/xpu_op_list.cc +++ b/paddle/fluid/platform/device/xpu/xpu_op_list.cc @@ -13,10 +13,10 @@ limitations under the License. */ #include #include -#include "paddle/fluid/platform/xpu/xpu1_op_list.h" -#include "paddle/fluid/platform/xpu/xpu2_op_list.h" -#include "paddle/fluid/platform/xpu/xpu_info.h" -#include "paddle/fluid/platform/xpu/xpu_op_list.h" +#include "paddle/fluid/platform/device/xpu/xpu1_op_list.h" +#include "paddle/fluid/platform/device/xpu/xpu2_op_list.h" +#include "paddle/fluid/platform/device/xpu/xpu_info.h" +#include "paddle/fluid/platform/device/xpu/xpu_op_list.h" namespace paddle { namespace platform { diff --git a/paddle/fluid/platform/xpu/xpu_op_list.h b/paddle/fluid/platform/device/xpu/xpu_op_list.h similarity index 100% rename from paddle/fluid/platform/xpu/xpu_op_list.h rename to paddle/fluid/platform/device/xpu/xpu_op_list.h diff --git a/paddle/fluid/platform/device_context.h b/paddle/fluid/platform/device_context.h index 13a1040dd19df23fffba5663e6b77d063704c0ab..6ffc3bef7431bf688a53305730b8c95600ce3ebd 100644 --- a/paddle/fluid/platform/device_context.h +++ b/paddle/fluid/platform/device_context.h @@ -69,8 +69,8 @@ struct GpuDevice; } // namespace Eigen #ifdef PADDLE_WITH_XPU -#include "paddle/fluid/platform/xpu/xpu_header.h" -#include "paddle/fluid/platform/xpu/xpu_info.h" +#include "paddle/fluid/platform/device/xpu/xpu_header.h" +#include "paddle/fluid/platform/device/xpu/xpu_info.h" #endif #ifdef PADDLE_WITH_ASCEND_CL diff --git a/paddle/fluid/platform/init.cc b/paddle/fluid/platform/init.cc index 1109ecd52824a989fefa32e81dcaeb72ef24e99a..2516b4a3b1d4a0f601dcb6ec0bc18a188d93f07f 100644 --- a/paddle/fluid/platform/init.cc +++ b/paddle/fluid/platform/init.cc @@ -30,8 +30,8 @@ limitations under the License. */ #include "paddle/fluid/platform/place.h" #ifdef PADDLE_WITH_XPU -#include "paddle/fluid/platform/xpu/xpu_header.h" -#include "paddle/fluid/platform/xpu/xpu_info.h" +#include "paddle/fluid/platform/device/xpu/xpu_header.h" +#include "paddle/fluid/platform/device/xpu/xpu_info.h" #endif #ifdef WITH_WIN_DUMP_DBG diff --git a/paddle/fluid/pybind/pybind.cc b/paddle/fluid/pybind/pybind.cc index ec3a4ba78c7cca81d470ae3026d7146edf9958b3..b85ebdeab55429a2621248300dc67ca3e618e149 100644 --- a/paddle/fluid/pybind/pybind.cc +++ b/paddle/fluid/pybind/pybind.cc @@ -125,7 +125,7 @@ limitations under the License. */ #endif #ifdef PADDLE_WITH_XPU -#include "paddle/fluid/platform/xpu/xpu_info.h" +#include "paddle/fluid/platform/device/xpu/xpu_info.h" #endif #include "paddle/fluid/platform/cuda_graph_with_memory_pool.h"