未验证 提交 66cd0bbb 编写于 作者: C Chen Weihang 提交者: GitHub

rename pd_dll_decl to paddle_api (#37876)

上级 a73064f2
......@@ -15,13 +15,13 @@
#pragma once
#if defined(_WIN32)
#ifndef PD_DLL_DECL
#ifndef PADDLE_API
#ifdef PADDLE_DLL_EXPORT
#define PD_DLL_DECL __declspec(dllexport)
#define PADDLE_API __declspec(dllexport)
#else
#define PD_DLL_DECL __declspec(dllimport)
#define PADDLE_API __declspec(dllimport)
#endif // PADDLE_DLL_EXPORT
#endif // PD_DLL_DECL
#endif // PADDLE_API
#else
#define PD_DLL_DECL
#define PADDLE_API
#endif // _WIN32
......@@ -33,7 +33,7 @@ limitations under the License. */
namespace paddle {
namespace framework {
class PD_DLL_DECL OpMetaInfoHelper;
class PADDLE_API OpMetaInfoHelper;
} // namespace framework
using Tensor = paddle::Tensor;
......@@ -425,7 +425,7 @@ struct InferDtypeFuncImpl<Return (*)(Args...), impl_fn> {
////////////////////// Op Meta Info //////////////////////
class PD_DLL_DECL OpMetaInfo {
class PADDLE_API OpMetaInfo {
public:
explicit OpMetaInfo(const std::string& op_name) : name_(op_name) {}
......@@ -464,7 +464,7 @@ class PD_DLL_DECL OpMetaInfo {
//////////////// Op Meta Info Map /////////////////
class PD_DLL_DECL OpMetaInfoMap {
class PADDLE_API OpMetaInfoMap {
public:
// this function's impl should keep in header file.
// if move to cc file, meta info can not be added
......@@ -488,7 +488,7 @@ class PD_DLL_DECL OpMetaInfoMap {
//////////////// Op Meta Info Builder /////////////////
class PD_DLL_DECL OpMetaInfoBuilder {
class PADDLE_API OpMetaInfoBuilder {
public:
explicit OpMetaInfoBuilder(std::string&& name, size_t index);
OpMetaInfoBuilder& Inputs(std::vector<std::string>&& inputs);
......
......@@ -84,7 +84,7 @@ class AbstractAutogradMeta {
* another simple Tensor design may be required for inference.
*/
class PD_DLL_DECL Tensor final {
class PADDLE_API Tensor final {
public:
/* Part 1: Construction and destruction methods */
......
......@@ -21,7 +21,7 @@ namespace paddle {
namespace experimental {
// TODO(chenweihang): Replace backend by place when place is ready
PD_DLL_DECL Tensor copy_to(const Tensor& x, Backend backend, bool blocking);
PADDLE_API Tensor copy_to(const Tensor& x, Backend backend, bool blocking);
} // namespace experimental
} // namespace paddle
......@@ -37,10 +37,10 @@ namespace experimental {
// use to declare symbol
#define PT_REGISTER_API(name) \
PD_DLL_DECL int RegisterSymbolsFor##name() { return 0; }
PADDLE_API int RegisterSymbolsFor##name() { return 0; }
#define PT_DECLARE_API(name) \
extern PD_DLL_DECL int RegisterSymbolsFor##name(); \
extern PADDLE_API int RegisterSymbolsFor##name(); \
UNUSED static int use_pten_api_##name = RegisterSymbolsFor##name()
} // namespace experimental
......
......@@ -159,19 +159,19 @@ T *Tensor::mutable_data() {
return nullptr;
}
template PD_DLL_DECL float *Tensor::mutable_data<float>();
template PD_DLL_DECL double *Tensor::mutable_data<double>();
template PD_DLL_DECL int64_t *Tensor::mutable_data<int64_t>();
template PD_DLL_DECL int32_t *Tensor::mutable_data<int32_t>();
template PD_DLL_DECL uint8_t *Tensor::mutable_data<uint8_t>();
template PD_DLL_DECL int8_t *Tensor::mutable_data<int8_t>();
template PD_DLL_DECL int16_t *Tensor::mutable_data<int16_t>();
template PD_DLL_DECL bool *Tensor::mutable_data<bool>();
template PD_DLL_DECL paddle::platform::complex<float>
template PADDLE_API float *Tensor::mutable_data<float>();
template PADDLE_API double *Tensor::mutable_data<double>();
template PADDLE_API int64_t *Tensor::mutable_data<int64_t>();
template PADDLE_API int32_t *Tensor::mutable_data<int32_t>();
template PADDLE_API uint8_t *Tensor::mutable_data<uint8_t>();
template PADDLE_API int8_t *Tensor::mutable_data<int8_t>();
template PADDLE_API int16_t *Tensor::mutable_data<int16_t>();
template PADDLE_API bool *Tensor::mutable_data<bool>();
template PADDLE_API paddle::platform::complex<float>
*Tensor::mutable_data<paddle::platform::complex<float>>();
template PD_DLL_DECL paddle::platform::complex<double>
template PADDLE_API paddle::platform::complex<double>
*Tensor::mutable_data<paddle::platform::complex<double>>();
template PD_DLL_DECL paddle::platform::float16 *
template PADDLE_API paddle::platform::float16 *
Tensor::mutable_data<paddle::platform::float16>();
template <typename T>
......@@ -185,25 +185,25 @@ T *Tensor::mutable_data(const PlaceType &place) {
return mutable_data<T>();
}
template PD_DLL_DECL float *Tensor::mutable_data<float>(const PlaceType &place);
template PD_DLL_DECL double *Tensor::mutable_data<double>(
template PADDLE_API float *Tensor::mutable_data<float>(const PlaceType &place);
template PADDLE_API double *Tensor::mutable_data<double>(
const PlaceType &place);
template PD_DLL_DECL int64_t *Tensor::mutable_data<int64_t>(
template PADDLE_API int64_t *Tensor::mutable_data<int64_t>(
const PlaceType &place);
template PD_DLL_DECL int32_t *Tensor::mutable_data<int32_t>(
template PADDLE_API int32_t *Tensor::mutable_data<int32_t>(
const PlaceType &place);
template PD_DLL_DECL uint8_t *Tensor::mutable_data<uint8_t>(
template PADDLE_API uint8_t *Tensor::mutable_data<uint8_t>(
const PlaceType &place);
template PD_DLL_DECL int8_t *Tensor::mutable_data<int8_t>(
template PADDLE_API int8_t *Tensor::mutable_data<int8_t>(
const PlaceType &place);
template PD_DLL_DECL int16_t *Tensor::mutable_data<int16_t>(
template PADDLE_API int16_t *Tensor::mutable_data<int16_t>(
const PlaceType &place);
template PD_DLL_DECL bool *Tensor::mutable_data<bool>(const PlaceType &place);
template PD_DLL_DECL paddle::platform::complex<float> *
template PADDLE_API bool *Tensor::mutable_data<bool>(const PlaceType &place);
template PADDLE_API paddle::platform::complex<float> *
Tensor::mutable_data<paddle::platform::complex<float>>(const PlaceType &place);
template PD_DLL_DECL paddle::platform::complex<double> *
template PADDLE_API paddle::platform::complex<double> *
Tensor::mutable_data<paddle::platform::complex<double>>(const PlaceType &place);
template PD_DLL_DECL paddle::platform::float16 *
template PADDLE_API paddle::platform::float16 *
Tensor::mutable_data<paddle::platform::float16>(const PlaceType &place);
template <typename T>
......@@ -214,22 +214,22 @@ const T *Tensor::data() const {
return nullptr;
}
template PD_DLL_DECL const float *Tensor::data<float>() const;
template PD_DLL_DECL const double *Tensor::data<double>() const;
template PD_DLL_DECL const int64_t *Tensor::data<int64_t>() const;
template PD_DLL_DECL const int32_t *Tensor::data<int32_t>() const;
template PD_DLL_DECL const uint8_t *Tensor::data<uint8_t>() const;
template PD_DLL_DECL const int8_t *Tensor::data<int8_t>() const;
template PD_DLL_DECL const int16_t *Tensor::data<int16_t>() const;
template PD_DLL_DECL const uint16_t *Tensor::data<uint16_t>() const;
template PD_DLL_DECL const bool *Tensor::data<bool>() const;
template PD_DLL_DECL const paddle::platform::complex<float>
template PADDLE_API const float *Tensor::data<float>() const;
template PADDLE_API const double *Tensor::data<double>() const;
template PADDLE_API const int64_t *Tensor::data<int64_t>() const;
template PADDLE_API const int32_t *Tensor::data<int32_t>() const;
template PADDLE_API const uint8_t *Tensor::data<uint8_t>() const;
template PADDLE_API const int8_t *Tensor::data<int8_t>() const;
template PADDLE_API const int16_t *Tensor::data<int16_t>() const;
template PADDLE_API const uint16_t *Tensor::data<uint16_t>() const;
template PADDLE_API const bool *Tensor::data<bool>() const;
template PADDLE_API const paddle::platform::complex<float>
*Tensor::data<paddle::platform::complex<float>>() const;
template PD_DLL_DECL const paddle::platform::complex<double>
template PADDLE_API const paddle::platform::complex<double>
*Tensor::data<paddle::platform::complex<double>>() const;
template PD_DLL_DECL const paddle::platform::float16 *
template PADDLE_API const paddle::platform::float16 *
Tensor::data<paddle::platform::float16>() const;
template PD_DLL_DECL const paddle::platform::bfloat16 *
template PADDLE_API const paddle::platform::bfloat16 *
Tensor::data<paddle::platform::bfloat16>() const;
template <typename T>
......@@ -241,19 +241,19 @@ T *Tensor::data() {
return nullptr;
}
template PD_DLL_DECL float *Tensor::data<float>();
template PD_DLL_DECL double *Tensor::data<double>();
template PD_DLL_DECL int64_t *Tensor::data<int64_t>();
template PD_DLL_DECL int32_t *Tensor::data<int32_t>();
template PD_DLL_DECL uint8_t *Tensor::data<uint8_t>();
template PD_DLL_DECL int8_t *Tensor::data<int8_t>();
template PD_DLL_DECL int16_t *Tensor::data<int16_t>();
template PD_DLL_DECL bool *Tensor::data<bool>();
template PD_DLL_DECL paddle::platform::complex<float>
template PADDLE_API float *Tensor::data<float>();
template PADDLE_API double *Tensor::data<double>();
template PADDLE_API int64_t *Tensor::data<int64_t>();
template PADDLE_API int32_t *Tensor::data<int32_t>();
template PADDLE_API uint8_t *Tensor::data<uint8_t>();
template PADDLE_API int8_t *Tensor::data<int8_t>();
template PADDLE_API int16_t *Tensor::data<int16_t>();
template PADDLE_API bool *Tensor::data<bool>();
template PADDLE_API paddle::platform::complex<float>
*Tensor::data<paddle::platform::complex<float>>();
template PD_DLL_DECL paddle::platform::complex<double>
template PADDLE_API paddle::platform::complex<double>
*Tensor::data<paddle::platform::complex<double>>();
template PD_DLL_DECL paddle::platform::float16 *
template PADDLE_API paddle::platform::float16 *
Tensor::data<paddle::platform::float16>();
// TODO(chenweihang): replace slice impl by API
......@@ -294,27 +294,27 @@ Tensor Tensor::copy_to(const PlaceType &target_place) const {
return copy_to(ConvertExtPlaceToBackend(target_place), /*blocking=*/false);
}
template PD_DLL_DECL Tensor
template PADDLE_API Tensor
Tensor::copy_to<float>(const PlaceType &target_place) const;
template PD_DLL_DECL Tensor
template PADDLE_API Tensor
Tensor::copy_to<double>(const PlaceType &target_place) const;
template PD_DLL_DECL Tensor
template PADDLE_API Tensor
Tensor::copy_to<int64_t>(const PlaceType &target_place) const;
template PD_DLL_DECL Tensor
template PADDLE_API Tensor
Tensor::copy_to<int32_t>(const PlaceType &target_place) const;
template PD_DLL_DECL Tensor
template PADDLE_API Tensor
Tensor::copy_to<uint8_t>(const PlaceType &target_place) const;
template PD_DLL_DECL Tensor
template PADDLE_API Tensor
Tensor::copy_to<int8_t>(const PlaceType &target_place) const;
template PD_DLL_DECL Tensor
template PADDLE_API Tensor
Tensor::copy_to<int16_t>(const PlaceType &target_place) const;
template PD_DLL_DECL Tensor
template PADDLE_API Tensor
Tensor::copy_to<bool>(const PlaceType &target_place) const;
template PD_DLL_DECL Tensor Tensor::copy_to<paddle::platform::complex<float>>(
template PADDLE_API Tensor Tensor::copy_to<paddle::platform::complex<float>>(
const PlaceType &target_place) const;
template PD_DLL_DECL Tensor Tensor::copy_to<paddle::platform::complex<double>>(
template PADDLE_API Tensor Tensor::copy_to<paddle::platform::complex<double>>(
const PlaceType &target_place) const;
template PD_DLL_DECL Tensor
template PADDLE_API Tensor
Tensor::copy_to<paddle::platform::float16>(const PlaceType &target_place) const;
Tensor Tensor::copy_to(Backend backend, bool blocking) const {
......
......@@ -34,7 +34,7 @@ PT_DECLARE_MODULE(UtilsCUDA);
namespace paddle {
namespace experimental {
PD_DLL_DECL Tensor copy_to(const Tensor& x, Backend backend, bool blocking) {
PADDLE_API Tensor copy_to(const Tensor& x, Backend backend, bool blocking) {
// 1. Get kernel signature and kernel
auto kernel_key_set = ParseKernelKeyByInputArgs(x);
kernel_key_set.backend_set = kernel_key_set.backend_set | BackendSet(backend);
......
......@@ -111,7 +111,7 @@ class API:
def gene_api_declaration(self):
return f"""
PD_DLL_DECL {self.output} {self.api}({self.args['args_declare']});
PADDLE_API {self.output} {self.api}({self.args['args_declare']});
"""
def gene_kernel_select(self, input_names, attrs, kernel):
......@@ -312,7 +312,7 @@ PD_DLL_DECL {self.output} {self.api}({self.args['args_declare']});
def gene_api_code(self):
if self.is_base_api:
return f"""
PD_DLL_DECL {self.output} {self.api}({self.args["args_define"]}) {{
PADDLE_API {self.output} {self.api}({self.args["args_define"]}) {{
{self.gene_kernel_select(self.args['inputs']['names'], self.args['attrs'], self.kernel)}
{self.gene_kernel_context(self.args['inputs']['names'], self.args['attrs'], self.infer_meta, self.kernel['param'])}
......@@ -323,7 +323,7 @@ PD_DLL_DECL {self.output} {self.api}({self.args["args_define"]}) {{
else:
return f"""
PD_DLL_DECL {self.output} {self.api}({self.args["args_define"]}) {{
PADDLE_API {self.output} {self.api}({self.args["args_define"]}) {{
return {self.invoke};
}}
"""
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册