diff --git a/paddle/fluid/inference/CMakeLists.txt b/paddle/fluid/inference/CMakeLists.txt index 6ff46554296048f13d447db8e9d07f00c4a3c40a..7f2daa942b057df6a74113a1578eb1c51db5d7ef 100644 --- a/paddle/fluid/inference/CMakeLists.txt +++ b/paddle/fluid/inference/CMakeLists.txt @@ -40,6 +40,10 @@ get_property(phi_modules GLOBAL PROPERTY PHI_MODULES) get_property(phi_kernels GLOBAL PROPERTY PHI_KERNELS) set(utils_modules stringpiece pretty_log string_helper benchmark) +if(WITH_CUSTOM_DEVICE) + set(fluid_modules ${fluid_modules} phi_capi) +endif() + add_subdirectory(api) # Create static inference library if needed diff --git a/paddle/fluid/inference/api/CMakeLists.txt b/paddle/fluid/inference/api/CMakeLists.txt index 9e601df8088fc172e39115dca106918b5c3d8da5..3aff5d5536a23e53195096ffb0506afbd0976f1d 100755 --- a/paddle/fluid/inference/api/CMakeLists.txt +++ b/paddle/fluid/inference/api/CMakeLists.txt @@ -55,6 +55,9 @@ set(paddle_inference_api_deps if(WITH_CRYPTO) list(APPEND paddle_inference_api_deps paddle_crypto) endif() +if(WITH_CUSTOM_DEVICE) + set(paddle_inference_api_deps ${paddle_inference_api_deps} phi_capi) +endif() cc_library( paddle_inference_api diff --git a/paddle/fluid/inference/api/api.cc b/paddle/fluid/inference/api/api.cc index d5897e3c4f2a7abcd5156ee2a4dc00a5b3e85c8a..054b4668c4cc6c0246b593ed79d8b04f33d54699 100644 --- a/paddle/fluid/inference/api/api.cc +++ b/paddle/fluid/inference/api/api.cc @@ -156,3 +156,7 @@ std::shared_ptr MakeCipher(const std::string &config_file) { #endif } // namespace paddle + +#ifdef PADDLE_WITH_CUSTOM_DEVICE +#include "paddle/phi/capi/capi.h" +#endif diff --git a/paddle/fluid/inference/paddle_inference_custom_device.map b/paddle/fluid/inference/paddle_inference_custom_device.map index 52bc2870482e27caaae9c6d4c2296e2103dcef2f..d78860e0a2070073c1fbc422c30a00db4e7ec6a0 100644 --- a/paddle/fluid/inference/paddle_inference_custom_device.map +++ b/paddle/fluid/inference/paddle_inference_custom_device.map @@ -5,6 +5,7 @@ *profile*; *phi*; *FLAGS_*; + PD_*; local: *; }; diff --git a/paddle/phi/capi/include/c_tensor.h b/paddle/phi/capi/include/c_tensor.h index 35ac7dda3964d9fc104690facbf088653cc9eb15..2bebee977740b0dd9666aa2da6ce65ed084c862f 100644 --- a/paddle/phi/capi/include/c_tensor.h +++ b/paddle/phi/capi/include/c_tensor.h @@ -24,7 +24,7 @@ extern "C" { typedef struct PD_Tensor PD_Tensor; -PD_DataType PD_TensorGetDataType(const PD_Tensor *tensor, PD_Status *status); +PD_DataType PD_TensorGetPDDataType(const PD_Tensor *tensor, PD_Status *status); PD_DataLayout PD_TensorGetDataLayout(const PD_Tensor *tensor, PD_Status *status); diff --git a/paddle/phi/capi/include/wrapper_base.h b/paddle/phi/capi/include/wrapper_base.h index 2b5421bc266cfddc76d27934dae5b51a0f685d20..adfb2b5a0e050d0eb876fd4eb187b0d6d6d96feb 100644 --- a/paddle/phi/capi/include/wrapper_base.h +++ b/paddle/phi/capi/include/wrapper_base.h @@ -128,7 +128,7 @@ class DenseTensor : public WrapperBase { PD_DataType dtype() const { C_Status status; - auto data_type = PD_TensorGetDataType(raw_data(), &status); + auto data_type = PD_TensorGetPDDataType(raw_data(), &status); PD_CHECK_STATUS(status); return data_type; } diff --git a/paddle/phi/capi/lib/c_tensor.cc b/paddle/phi/capi/lib/c_tensor.cc index c81eefe22f77ef67c79951e1be8e93553a0742a6..b460d2e368607c80ddf1376ccde799dc4cad1b84 100644 --- a/paddle/phi/capi/lib/c_tensor.cc +++ b/paddle/phi/capi/lib/c_tensor.cc @@ -19,7 +19,7 @@ #include "paddle/phi/core/dense_tensor.h" #include "paddle/phi/core/meta_tensor.h" -PD_DataType PD_TensorGetDataType(const PD_Tensor* tensor, PD_Status* status) { +PD_DataType PD_TensorGetPDDataType(const PD_Tensor* tensor, PD_Status* status) { if (status) { if (!tensor) { *status = C_FAILED;