未验证 提交 942ff89f 编写于 作者: W Weilong Wu 提交者: GitHub

[Phi] polish and rename, pt* -> phi* (#44697)

* polish and rename, pt* -> phi*

* fix code format
上级 d985b4b1
...@@ -621,13 +621,13 @@ void InterpreterCore::RunInstruction(const Instruction& instr_node) { ...@@ -621,13 +621,13 @@ void InterpreterCore::RunInstruction(const Instruction& instr_node) {
VLOG(4) << "Run phi kernel: " << op->Type(); VLOG(4) << "Run phi kernel: " << op->Type();
VLOG(4) << instr_node.InnerRuntimeContext().get() << " " VLOG(4) << instr_node.InnerRuntimeContext().get() << " "
<< &instr_node.DeviceContext(); << &instr_node.DeviceContext();
phi::KernelContext pt_kernel_context; phi::KernelContext phi_kernel_context;
op_with_kernel->BuildPhiKernelContext( op_with_kernel->BuildPhiKernelContext(
*instr_node.InnerRuntimeContext().get(), *instr_node.InnerRuntimeContext().get(),
const_cast<platform::DeviceContext*>(&instr_node.DeviceContext()), const_cast<platform::DeviceContext*>(&instr_node.DeviceContext()),
&pt_kernel_context); &phi_kernel_context);
(*instr_node.PhiKernel())(&pt_kernel_context); (*instr_node.PhiKernel())(&phi_kernel_context);
} else { } else {
instr_node.KernelFunc()(*instr_node.InnerExecutionContext().get()); instr_node.KernelFunc()(*instr_node.InnerExecutionContext().get());
......
...@@ -513,25 +513,25 @@ void build_op_func_list(const platform::Place& place, ...@@ -513,25 +513,25 @@ void build_op_func_list(const platform::Place& place,
auto run_phi_kernel = false; auto run_phi_kernel = false;
if (phi::KernelFactory::Instance().HasCompatiblePhiKernel( if (phi::KernelFactory::Instance().HasCompatiblePhiKernel(
op_with_kernel->Type())) { op_with_kernel->Type())) {
auto pt_kernel_key = op_with_kernel->ChoosePhiKernel(exec_ctx); auto phi_kernel_key = op_with_kernel->ChoosePhiKernel(exec_ctx);
auto pt_kernel_name = op_with_kernel->PhiKernelSignature()->name; auto phi_kernel_name = op_with_kernel->PhiKernelSignature()->name;
if (op_with_kernel->PhiKernel()->IsValid()) { if (op_with_kernel->PhiKernel()->IsValid()) {
run_phi_kernel = true; run_phi_kernel = true;
} else { } else {
if (!op_with_kernel->SupportsKernelType(expected_kernel_key)) { if (!op_with_kernel->SupportsKernelType(expected_kernel_key)) {
auto pt_cpu_kernel_key = FallBackToCpu( auto phi_cpu_kernel_key = FallBackToCpu(
expected_kernel_key, pt_kernel_key, *op_with_kernel); expected_kernel_key, phi_kernel_key, *op_with_kernel);
op_with_kernel->ResetPhiKernel( op_with_kernel->ResetPhiKernel(
new phi::Kernel(phi::KernelFactory::Instance().SelectKernel( new phi::Kernel(phi::KernelFactory::Instance().SelectKernel(
pt_kernel_name, pt_cpu_kernel_key))); phi_kernel_name, phi_cpu_kernel_key)));
if (op_with_kernel->PhiKernel()->IsValid()) { if (op_with_kernel->PhiKernel()->IsValid()) {
VLOG(6) << "Static mode PrepareImpl - kernel name: " VLOG(6) << "Static mode PrepareImpl - kernel name: "
<< pt_kernel_name << phi_kernel_name
<< " | kernel key: " << pt_cpu_kernel_key << " | kernel key: " << phi_cpu_kernel_key
<< " | kernel: " << *(op_with_kernel->PhiKernel()); << " | kernel: " << *(op_with_kernel->PhiKernel());
op_with_kernel->ResetKernelType(new OpKernelType( op_with_kernel->ResetKernelType(new OpKernelType(
TransPhiKernelKeyToOpKernelType(pt_cpu_kernel_key))); TransPhiKernelKeyToOpKernelType(phi_cpu_kernel_key)));
run_phi_kernel = true; run_phi_kernel = true;
} }
} }
...@@ -541,7 +541,7 @@ void build_op_func_list(const platform::Place& place, ...@@ -541,7 +541,7 @@ void build_op_func_list(const platform::Place& place,
op_with_kernel->ChooseKernel(exec_ctx); op_with_kernel->ChooseKernel(exec_ctx);
op_func_node.kernel_func_ = *op_with_kernel->kernel_func(); op_func_node.kernel_func_ = *op_with_kernel->kernel_func();
} else { } else {
op_func_node.pt_kernel_ = op_with_kernel->PhiKernel(); op_func_node.phi_kernel_ = op_with_kernel->PhiKernel();
} }
auto kernel_type = *(op_with_kernel->kernel_type()); auto kernel_type = *(op_with_kernel->kernel_type());
if (kernel_type.place_ != dev_ctx->GetPlace()) { if (kernel_type.place_ != dev_ctx->GetPlace()) {
...@@ -583,10 +583,10 @@ void build_op_func_list(const platform::Place& place, ...@@ -583,10 +583,10 @@ void build_op_func_list(const platform::Place& place,
// step 5. run kernel // step 5. run kernel
if (run_phi_kernel) { if (run_phi_kernel) {
phi::KernelContext pt_kernel_context; phi::KernelContext phi_kernel_context;
op_with_kernel->BuildPhiKernelContext( op_with_kernel->BuildPhiKernelContext(
runtime_context, dev_ctx, &pt_kernel_context); runtime_context, dev_ctx, &phi_kernel_context);
(*op_func_node.pt_kernel_)(&pt_kernel_context); (*op_func_node.phi_kernel_)(&phi_kernel_context);
} else { } else {
// the place of exec_ctx maybe has changed. // the place of exec_ctx maybe has changed.
op_func_node.kernel_func_(ExecutionContext( op_func_node.kernel_func_(ExecutionContext(
......
...@@ -705,7 +705,9 @@ OpKernelComputeFunc Instruction::KernelFunc() const { ...@@ -705,7 +705,9 @@ OpKernelComputeFunc Instruction::KernelFunc() const {
return op_func_node_.kernel_func_; return op_func_node_.kernel_func_;
} }
phi::Kernel* Instruction::PhiKernel() const { return op_func_node_.pt_kernel_; } phi::Kernel* Instruction::PhiKernel() const {
return op_func_node_.phi_kernel_;
}
OpFuncType Instruction::KernelType() const { return op_func_node_.type_; } OpFuncType Instruction::KernelType() const { return op_func_node_.type_; }
......
...@@ -283,7 +283,7 @@ struct OpFuncNode { ...@@ -283,7 +283,7 @@ struct OpFuncNode {
platform::DeviceContext* dev_ctx_; // not owned platform::DeviceContext* dev_ctx_; // not owned
// fit for phi kernel // fit for phi kernel
phi::Kernel* pt_kernel_{nullptr}; // not owned phi::Kernel* phi_kernel_{nullptr}; // not owned
OpFuncType type_; OpFuncType type_;
}; };
......
此差异已折叠。
...@@ -652,16 +652,16 @@ class OperatorWithKernel : public OperatorBase { ...@@ -652,16 +652,16 @@ class OperatorWithKernel : public OperatorBase {
void BuildPhiKernelContext(const RuntimeContext& ctx, void BuildPhiKernelContext(const RuntimeContext& ctx,
platform::DeviceContext* dev_ctx, platform::DeviceContext* dev_ctx,
phi::KernelContext* pt_kernel_context) const; phi::KernelContext* phi_kernel_context) const;
phi::KernelSignature* PhiKernelSignature() const { phi::KernelSignature* PhiKernelSignature() const {
return kernel_signature_.get(); return kernel_signature_.get();
} }
phi::Kernel* PhiKernel() const { return pt_kernel_.get(); } phi::Kernel* PhiKernel() const { return phi_kernel_.get(); }
void ResetPhiKernel(phi::Kernel* kernel) const { void ResetPhiKernel(phi::Kernel* kernel) const {
return pt_kernel_.reset(kernel); return phi_kernel_.reset(kernel);
} }
const OpKernelType* kernel_type() const { return kernel_type_.get(); } const OpKernelType* kernel_type() const { return kernel_type_.get(); }
...@@ -730,7 +730,7 @@ class OperatorWithKernel : public OperatorBase { ...@@ -730,7 +730,7 @@ class OperatorWithKernel : public OperatorBase {
mutable bool run_phi_kernel_ = false; mutable bool run_phi_kernel_ = false;
mutable bool run_kp_kernel = false; mutable bool run_kp_kernel = false;
mutable std::unique_ptr<phi::KernelSignature> kernel_signature_; mutable std::unique_ptr<phi::KernelSignature> kernel_signature_;
mutable std::unique_ptr<phi::Kernel> pt_kernel_; mutable std::unique_ptr<phi::Kernel> phi_kernel_;
mutable std::unique_ptr<phi::ArgumentMappingFn> arg_map_fn_; mutable std::unique_ptr<phi::ArgumentMappingFn> arg_map_fn_;
struct CacheImpl; struct CacheImpl;
......
...@@ -227,7 +227,7 @@ class OpBase { ...@@ -227,7 +227,7 @@ class OpBase {
size_t id_{-1UL}; size_t id_{-1UL};
// In order to reduce the compatibility phase // In order to reduce the compatibility phase
// performance overhead, temporarily cache KernelContext // performance overhead, temporarily cache KernelContext
static phi::KernelContext pt_kernel_context_; static phi::KernelContext phi_kernel_context_;
std::vector<std::shared_ptr<std::function<void()>>> void_function_post_hooks_; std::vector<std::shared_ptr<std::function<void()>>> void_function_post_hooks_;
}; };
......
...@@ -183,8 +183,8 @@ PreparedOp PrepareImpl( ...@@ -183,8 +183,8 @@ PreparedOp PrepareImpl(
const phi::KernelSignature* default_kernel_signature = nullptr; const phi::KernelSignature* default_kernel_signature = nullptr;
phi::KernelSignature kernel_signature; phi::KernelSignature kernel_signature;
phi::KernelKey pt_kernel_key; phi::KernelKey phi_kernel_key;
std::string pt_kernel_name; std::string phi_kernel_name;
#if defined(PADDLE_WITH_XPU) #if defined(PADDLE_WITH_XPU)
bool is_xpu_unsupport = bool is_xpu_unsupport =
paddle::platform::is_xpu_place(expected_kernel_key.place_) && paddle::platform::is_xpu_place(expected_kernel_key.place_) &&
...@@ -213,7 +213,7 @@ PreparedOp PrepareImpl( ...@@ -213,7 +213,7 @@ PreparedOp PrepareImpl(
if (has_phi_kernel) { if (has_phi_kernel) {
VLOG(6) << kernel_signature; VLOG(6) << kernel_signature;
pt_kernel_name = kernel_signature.name; phi_kernel_name = kernel_signature.name;
// NOTE(Liu-xiandong): The register kernel used KP have library_type[KP], // NOTE(Liu-xiandong): The register kernel used KP have library_type[KP],
// But the default library_type is Plain, so we need to modify the // But the default library_type is Plain, so we need to modify the
// library_type here, otherwise it can't work. // library_type here, otherwise it can't work.
...@@ -236,34 +236,35 @@ PreparedOp PrepareImpl( ...@@ -236,34 +236,35 @@ PreparedOp PrepareImpl(
auto expected_kernel_key_library_type = auto expected_kernel_key_library_type =
expected_kernel_key.library_type_; expected_kernel_key.library_type_;
expected_kernel_key.library_type_ = paddle::framework::LibraryType::kKP; expected_kernel_key.library_type_ = paddle::framework::LibraryType::kKP;
VLOG(3) << "modifing XPU KP kernel: " << pt_kernel_name VLOG(3) << "modifing XPU KP kernel: " << phi_kernel_name
<< ", using_kernel_key:" << expected_kernel_key; << ", using_kernel_key:" << expected_kernel_key;
phi::KernelKey try_pt_kernel_key = phi::KernelKey try_phi_kernel_key =
TransOpKernelTypeToPhiKernelKey(expected_kernel_key); TransOpKernelTypeToPhiKernelKey(expected_kernel_key);
if (!phi_kernel_factory.HasKernel(pt_kernel_name, try_pt_kernel_key)) { if (!phi_kernel_factory.HasKernel(phi_kernel_name,
try_phi_kernel_key)) {
expected_kernel_key.library_type_ = expected_kernel_key_library_type; expected_kernel_key.library_type_ = expected_kernel_key_library_type;
VLOG(3) << "modify XPU KP kernel: " << pt_kernel_name VLOG(3) << "modify XPU KP kernel: " << phi_kernel_name
<< " in dynamic graph is failed " << expected_kernel_key; << " in dynamic graph is failed " << expected_kernel_key;
} else { } else {
VLOG(3) << "modify XPU KP kernel: " << pt_kernel_name VLOG(3) << "modify XPU KP kernel: " << phi_kernel_name
<< " in dynamic graph is succeed " << expected_kernel_key; << " in dynamic graph is succeed " << expected_kernel_key;
} }
} }
} }
#endif #endif
pt_kernel_key = TransOpKernelTypeToPhiKernelKey(expected_kernel_key); phi_kernel_key = TransOpKernelTypeToPhiKernelKey(expected_kernel_key);
auto& phi_kernel = auto& phi_kernel =
phi_kernel_factory.SelectKernel(pt_kernel_name, pt_kernel_key); phi_kernel_factory.SelectKernel(phi_kernel_name, phi_kernel_key);
if (phi_kernel.IsValid() if (phi_kernel.IsValid()
#if defined(PADDLE_WITH_XPU) && !defined(PADDLE_WITH_XPU_KP) #if defined(PADDLE_WITH_XPU) && !defined(PADDLE_WITH_XPU_KP)
&& !is_xpu_unsupport && !is_xpu_unsupport
#endif #endif
) { ) {
VLOG(6) << "Dynamic mode PrepareImpl - kernel name: " << pt_kernel_name VLOG(6) << "Dynamic mode PrepareImpl - kernel name: " << phi_kernel_name
<< " | kernel key: " << pt_kernel_key << " | kernel key: " << phi_kernel_key
<< " | kernel: " << phi_kernel; << " | kernel: " << phi_kernel;
if (expected_kernel_key.place_ != place) { if (expected_kernel_key.place_ != place) {
...@@ -279,7 +280,7 @@ PreparedOp PrepareImpl( ...@@ -279,7 +280,7 @@ PreparedOp PrepareImpl(
phi_kernel, phi_kernel,
dev_ctx); dev_ctx);
} else { } else {
VLOG(6) << "Dynamic mode ChoosePhiKernel - kernel `" << pt_kernel_name VLOG(6) << "Dynamic mode ChoosePhiKernel - kernel `" << phi_kernel_name
<< "` not found."; << "` not found.";
} }
} }
...@@ -316,23 +317,23 @@ PreparedOp PrepareImpl( ...@@ -316,23 +317,23 @@ PreparedOp PrepareImpl(
#endif #endif
) { ) {
if (has_phi_kernel) { if (has_phi_kernel) {
auto pt_cpu_kernel_key = auto phi_cpu_kernel_key =
FallBackToCpu(expected_kernel_key, pt_kernel_key, op); FallBackToCpu(expected_kernel_key, phi_kernel_key, op);
auto& pt_cpu_kernel = auto& phi_cpu_kernel =
phi_kernel_factory.SelectKernel(pt_kernel_name, pt_cpu_kernel_key); phi_kernel_factory.SelectKernel(phi_kernel_name, phi_cpu_kernel_key);
if (pt_cpu_kernel.IsValid()) { if (phi_cpu_kernel.IsValid()) {
VLOG(6) << "Dynamic mode PrepareImpl - kernel name: " << pt_kernel_name VLOG(6) << "Dynamic mode PrepareImpl - kernel name: " << phi_kernel_name
<< " | kernel key: " << pt_cpu_kernel_key << " | kernel key: " << phi_cpu_kernel_key
<< " | kernel: " << pt_cpu_kernel; << " | kernel: " << phi_cpu_kernel;
auto* cpu_ctx = pool.Get(paddle::platform::CPUPlace()); auto* cpu_ctx = pool.Get(paddle::platform::CPUPlace());
return PreparedOp( return PreparedOp(
op, op,
empty_ctx, empty_ctx,
framework::TransPhiKernelKeyToOpKernelType(pt_cpu_kernel_key), framework::TransPhiKernelKeyToOpKernelType(phi_cpu_kernel_key),
arg_map_fn, arg_map_fn,
default_kernel_signature, default_kernel_signature,
std::move(kernel_signature), std::move(kernel_signature),
pt_cpu_kernel, phi_cpu_kernel,
cpu_ctx); cpu_ctx);
} }
} }
...@@ -610,7 +611,7 @@ static void PreparedOpRunPtImpl( ...@@ -610,7 +611,7 @@ static void PreparedOpRunPtImpl(
PreparePhiData<VarType>(phi_kernel, kernel_signature, ins); PreparePhiData<VarType>(phi_kernel, kernel_signature, ins);
phi::KernelContext pt_kernel_context; phi::KernelContext phi_kernel_context;
BuildDygraphPhiKernelContext<VarType>(kernel_signature, BuildDygraphPhiKernelContext<VarType>(kernel_signature,
phi_kernel, phi_kernel,
ins, ins,
...@@ -618,9 +619,9 @@ static void PreparedOpRunPtImpl( ...@@ -618,9 +619,9 @@ static void PreparedOpRunPtImpl(
attrs, attrs,
default_attrs, default_attrs,
dev_ctx, dev_ctx,
&pt_kernel_context); &phi_kernel_context);
phi_kernel(&pt_kernel_context); phi_kernel(&phi_kernel_context);
} }
if (FLAGS_check_nan_inf) { if (FLAGS_check_nan_inf) {
......
...@@ -138,7 +138,7 @@ namespace capi { ...@@ -138,7 +138,7 @@ namespace capi {
meta_kernel_fn, \ meta_kernel_fn, \
cpp_dtype) \ cpp_dtype) \
static const registrar_class<cpp_dtype> PD_CUSTOM_PHI_KERNEL_CONCATENATE( \ static const registrar_class<cpp_dtype> PD_CUSTOM_PHI_KERNEL_CONCATENATE( \
__reg_pt_kernel_##kernel_name##_##backend##_##layout##_, registrar_id); \ __reg_phi_kernel_##kernel_name##_##backend##_##layout##_, registrar_id); \
int TouchCustomKernelSymbolFor_##kernel_name##_##backend##_##layout() { \ int TouchCustomKernelSymbolFor_##kernel_name##_##backend##_##layout() { \
return 0; \ return 0; \
} }
...@@ -152,7 +152,7 @@ namespace capi { ...@@ -152,7 +152,7 @@ namespace capi {
cpp_dtype, \ cpp_dtype, \
...) \ ...) \
static const registrar_class<cpp_dtype> PD_CUSTOM_PHI_KERNEL_CONCATENATE( \ static const registrar_class<cpp_dtype> PD_CUSTOM_PHI_KERNEL_CONCATENATE( \
__reg_pt_kernel_##kernel_name##_##backend##_##layout##_, registrar_id); \ __reg_phi_kernel_##kernel_name##_##backend##_##layout##_, registrar_id); \
PD_CUSTOM_PHI_KERNEL_EXPAND( \ PD_CUSTOM_PHI_KERNEL_EXPAND( \
_PD_BUILD_KERNEL_REGISTRAR_INIT_1(registrar_class, \ _PD_BUILD_KERNEL_REGISTRAR_INIT_1(registrar_class, \
kernel_name, \ kernel_name, \
...@@ -171,7 +171,7 @@ namespace capi { ...@@ -171,7 +171,7 @@ namespace capi {
cpp_dtype, \ cpp_dtype, \
...) \ ...) \
static const registrar_class<cpp_dtype> PD_CUSTOM_PHI_KERNEL_CONCATENATE( \ static const registrar_class<cpp_dtype> PD_CUSTOM_PHI_KERNEL_CONCATENATE( \
__reg_pt_kernel_##kernel_name##_##backend##_##layout##_, registrar_id); \ __reg_phi_kernel_##kernel_name##_##backend##_##layout##_, registrar_id); \
PD_CUSTOM_PHI_KERNEL_EXPAND( \ PD_CUSTOM_PHI_KERNEL_EXPAND( \
_PD_BUILD_KERNEL_REGISTRAR_INIT_2(registrar_class, \ _PD_BUILD_KERNEL_REGISTRAR_INIT_2(registrar_class, \
kernel_name, \ kernel_name, \
...@@ -190,7 +190,7 @@ namespace capi { ...@@ -190,7 +190,7 @@ namespace capi {
cpp_dtype, \ cpp_dtype, \
...) \ ...) \
static const registrar_class<cpp_dtype> PD_CUSTOM_PHI_KERNEL_CONCATENATE( \ static const registrar_class<cpp_dtype> PD_CUSTOM_PHI_KERNEL_CONCATENATE( \
__reg_pt_kernel_##kernel_name##_##backend##_##layout##_, registrar_id); \ __reg_phi_kernel_##kernel_name##_##backend##_##layout##_, registrar_id); \
PD_CUSTOM_PHI_KERNEL_EXPAND( \ PD_CUSTOM_PHI_KERNEL_EXPAND( \
_PD_BUILD_KERNEL_REGISTRAR_INIT_3(registrar_class, \ _PD_BUILD_KERNEL_REGISTRAR_INIT_3(registrar_class, \
kernel_name, \ kernel_name, \
...@@ -209,7 +209,7 @@ namespace capi { ...@@ -209,7 +209,7 @@ namespace capi {
cpp_dtype, \ cpp_dtype, \
...) \ ...) \
static const registrar_class<cpp_dtype> PD_CUSTOM_PHI_KERNEL_CONCATENATE( \ static const registrar_class<cpp_dtype> PD_CUSTOM_PHI_KERNEL_CONCATENATE( \
__reg_pt_kernel_##kernel_name##_##backend##_##layout##_, registrar_id); \ __reg_phi_kernel_##kernel_name##_##backend##_##layout##_, registrar_id); \
PD_CUSTOM_PHI_KERNEL_EXPAND( \ PD_CUSTOM_PHI_KERNEL_EXPAND( \
_PD_BUILD_KERNEL_REGISTRAR_INIT_4(registrar_class, \ _PD_BUILD_KERNEL_REGISTRAR_INIT_4(registrar_class, \
kernel_name, \ kernel_name, \
...@@ -228,7 +228,7 @@ namespace capi { ...@@ -228,7 +228,7 @@ namespace capi {
cpp_dtype, \ cpp_dtype, \
...) \ ...) \
static const registrar_class<cpp_dtype> PD_CUSTOM_PHI_KERNEL_CONCATENATE( \ static const registrar_class<cpp_dtype> PD_CUSTOM_PHI_KERNEL_CONCATENATE( \
__reg_pt_kernel_##kernel_name##_##backend##_##layout##_, registrar_id); \ __reg_phi_kernel_##kernel_name##_##backend##_##layout##_, registrar_id); \
PD_CUSTOM_PHI_KERNEL_EXPAND( \ PD_CUSTOM_PHI_KERNEL_EXPAND( \
_PD_BUILD_KERNEL_REGISTRAR_INIT_5(registrar_class, \ _PD_BUILD_KERNEL_REGISTRAR_INIT_5(registrar_class, \
kernel_name, \ kernel_name, \
...@@ -247,7 +247,7 @@ namespace capi { ...@@ -247,7 +247,7 @@ namespace capi {
cpp_dtype, \ cpp_dtype, \
...) \ ...) \
static const registrar_class<cpp_dtype> PD_CUSTOM_PHI_KERNEL_CONCATENATE( \ static const registrar_class<cpp_dtype> PD_CUSTOM_PHI_KERNEL_CONCATENATE( \
__reg_pt_kernel_##kernel_name##_##backend##_##layout##_, registrar_id); \ __reg_phi_kernel_##kernel_name##_##backend##_##layout##_, registrar_id); \
PD_CUSTOM_PHI_KERNEL_EXPAND( \ PD_CUSTOM_PHI_KERNEL_EXPAND( \
_PD_BUILD_KERNEL_REGISTRAR_INIT_6(registrar_class, \ _PD_BUILD_KERNEL_REGISTRAR_INIT_6(registrar_class, \
kernel_name, \ kernel_name, \
...@@ -266,7 +266,7 @@ namespace capi { ...@@ -266,7 +266,7 @@ namespace capi {
cpp_dtype, \ cpp_dtype, \
...) \ ...) \
static const registrar_class<cpp_dtype> PD_CUSTOM_PHI_KERNEL_CONCATENATE( \ static const registrar_class<cpp_dtype> PD_CUSTOM_PHI_KERNEL_CONCATENATE( \
__reg_pt_kernel_##kernel_name##_##backend##_##layout##_, registrar_id); \ __reg_phi_kernel_##kernel_name##_##backend##_##layout##_, registrar_id); \
PD_CUSTOM_PHI_KERNEL_EXPAND( \ PD_CUSTOM_PHI_KERNEL_EXPAND( \
_PD_BUILD_KERNEL_REGISTRAR_INIT_7(registrar_class, \ _PD_BUILD_KERNEL_REGISTRAR_INIT_7(registrar_class, \
kernel_name, \ kernel_name, \
...@@ -285,7 +285,7 @@ namespace capi { ...@@ -285,7 +285,7 @@ namespace capi {
cpp_dtype, \ cpp_dtype, \
...) \ ...) \
static const registrar_class<cpp_dtype> PD_CUSTOM_PHI_KERNEL_CONCATENATE( \ static const registrar_class<cpp_dtype> PD_CUSTOM_PHI_KERNEL_CONCATENATE( \
__reg_pt_kernel_##kernel_name##_##backend##_##layout##_, registrar_id); \ __reg_phi_kernel_##kernel_name##_##backend##_##layout##_, registrar_id); \
PD_CUSTOM_PHI_KERNEL_EXPAND( \ PD_CUSTOM_PHI_KERNEL_EXPAND( \
_PD_BUILD_KERNEL_REGISTRAR_INIT_8(registrar_class, \ _PD_BUILD_KERNEL_REGISTRAR_INIT_8(registrar_class, \
kernel_name, \ kernel_name, \
...@@ -304,7 +304,7 @@ namespace capi { ...@@ -304,7 +304,7 @@ namespace capi {
cpp_dtype, \ cpp_dtype, \
...) \ ...) \
static const registrar_class<cpp_dtype> PD_CUSTOM_PHI_KERNEL_CONCATENATE( \ static const registrar_class<cpp_dtype> PD_CUSTOM_PHI_KERNEL_CONCATENATE( \
__reg_pt_kernel_##kernel_name##_##backend##_##layout##_, registrar_id); \ __reg_phi_kernel_##kernel_name##_##backend##_##layout##_, registrar_id); \
PD_CUSTOM_PHI_KERNEL_EXPAND( \ PD_CUSTOM_PHI_KERNEL_EXPAND( \
_PD_BUILD_KERNEL_REGISTRAR_INIT_9(registrar_class, \ _PD_BUILD_KERNEL_REGISTRAR_INIT_9(registrar_class, \
kernel_name, \ kernel_name, \
...@@ -323,7 +323,7 @@ namespace capi { ...@@ -323,7 +323,7 @@ namespace capi {
cpp_dtype, \ cpp_dtype, \
...) \ ...) \
static const registrar_class<cpp_dtype> PD_CUSTOM_PHI_KERNEL_CONCATENATE( \ static const registrar_class<cpp_dtype> PD_CUSTOM_PHI_KERNEL_CONCATENATE( \
__reg_pt_kernel_##kernel_name##_##backend##_##layout##_, registrar_id); \ __reg_phi_kernel_##kernel_name##_##backend##_##layout##_, registrar_id); \
PD_CUSTOM_PHI_KERNEL_EXPAND( \ PD_CUSTOM_PHI_KERNEL_EXPAND( \
_PD_BUILD_KERNEL_REGISTRAR_INIT_10(registrar_class, \ _PD_BUILD_KERNEL_REGISTRAR_INIT_10(registrar_class, \
kernel_name, \ kernel_name, \
...@@ -342,7 +342,7 @@ namespace capi { ...@@ -342,7 +342,7 @@ namespace capi {
cpp_dtype, \ cpp_dtype, \
...) \ ...) \
static const registrar_class<cpp_dtype> PD_CUSTOM_PHI_KERNEL_CONCATENATE( \ static const registrar_class<cpp_dtype> PD_CUSTOM_PHI_KERNEL_CONCATENATE( \
__reg_pt_kernel_##kernel_name##_##backend##_##layout##_, registrar_id); \ __reg_phi_kernel_##kernel_name##_##backend##_##layout##_, registrar_id); \
PD_CUSTOM_PHI_KERNEL_EXPAND( \ PD_CUSTOM_PHI_KERNEL_EXPAND( \
_PD_BUILD_KERNEL_REGISTRAR_INIT_11(registrar_class, \ _PD_BUILD_KERNEL_REGISTRAR_INIT_11(registrar_class, \
kernel_name, \ kernel_name, \
...@@ -361,7 +361,7 @@ namespace capi { ...@@ -361,7 +361,7 @@ namespace capi {
cpp_dtype, \ cpp_dtype, \
...) \ ...) \
static const registrar_class<cpp_dtype> PD_CUSTOM_PHI_KERNEL_CONCATENATE( \ static const registrar_class<cpp_dtype> PD_CUSTOM_PHI_KERNEL_CONCATENATE( \
__reg_pt_kernel_##kernel_name##_##backend##_##layout##_, registrar_id); \ __reg_phi_kernel_##kernel_name##_##backend##_##layout##_, registrar_id); \
PD_CUSTOM_PHI_KERNEL_EXPAND( \ PD_CUSTOM_PHI_KERNEL_EXPAND( \
_PD_BUILD_KERNEL_REGISTRAR_INIT_12(registrar_class, \ _PD_BUILD_KERNEL_REGISTRAR_INIT_12(registrar_class, \
kernel_name, \ kernel_name, \
...@@ -380,7 +380,7 @@ namespace capi { ...@@ -380,7 +380,7 @@ namespace capi {
cpp_dtype, \ cpp_dtype, \
...) \ ...) \
static const registrar_class<cpp_dtype> PD_CUSTOM_PHI_KERNEL_CONCATENATE( \ static const registrar_class<cpp_dtype> PD_CUSTOM_PHI_KERNEL_CONCATENATE( \
__reg_pt_kernel_##kernel_name##_##backend##_##layout##_, registrar_id); \ __reg_phi_kernel_##kernel_name##_##backend##_##layout##_, registrar_id); \
PD_CUSTOM_PHI_KERNEL_EXPAND( \ PD_CUSTOM_PHI_KERNEL_EXPAND( \
_PD_BUILD_KERNEL_REGISTRAR_INIT_13(registrar_class, \ _PD_BUILD_KERNEL_REGISTRAR_INIT_13(registrar_class, \
kernel_name, \ kernel_name, \
...@@ -399,7 +399,7 @@ namespace capi { ...@@ -399,7 +399,7 @@ namespace capi {
cpp_dtype, \ cpp_dtype, \
...) \ ...) \
static const registrar_class<cpp_dtype> PD_CUSTOM_PHI_KERNEL_CONCATENATE( \ static const registrar_class<cpp_dtype> PD_CUSTOM_PHI_KERNEL_CONCATENATE( \
__reg_pt_kernel_##kernel_name##_##backend##_##layout##_, registrar_id); \ __reg_phi_kernel_##kernel_name##_##backend##_##layout##_, registrar_id); \
PD_CUSTOM_PHI_KERNEL_EXPAND( \ PD_CUSTOM_PHI_KERNEL_EXPAND( \
_PD_BUILD_KERNEL_REGISTRAR_INIT_14(registrar_class, \ _PD_BUILD_KERNEL_REGISTRAR_INIT_14(registrar_class, \
kernel_name, \ kernel_name, \
......
...@@ -563,7 +563,7 @@ struct KernelRegistrar { ...@@ -563,7 +563,7 @@ struct KernelRegistrar {
meta_kernel_fn, \ meta_kernel_fn, \
cpp_dtype) \ cpp_dtype) \
static const ::phi::KernelRegistrar PD_CONCATENATE( \ static const ::phi::KernelRegistrar PD_CONCATENATE( \
__reg_pt_kernel_##kernel_name##_##backend##_##layout##_, registrar_id)( \ __reg_phi_kernel_##kernel_name##_##backend##_##layout##_, registrar_id)( \
reg_type, \ reg_type, \
#kernel_name, \ #kernel_name, \
#backend, \ #backend, \
...@@ -586,7 +586,7 @@ struct KernelRegistrar { ...@@ -586,7 +586,7 @@ struct KernelRegistrar {
cpp_dtype, \ cpp_dtype, \
...) \ ...) \
static const ::phi::KernelRegistrar PD_CONCATENATE( \ static const ::phi::KernelRegistrar PD_CONCATENATE( \
__reg_pt_kernel_##kernel_name##_##backend##_##layout##_, registrar_id)( \ __reg_phi_kernel_##kernel_name##_##backend##_##layout##_, registrar_id)( \
reg_type, \ reg_type, \
#kernel_name, \ #kernel_name, \
#backend, \ #backend, \
...@@ -617,7 +617,7 @@ struct KernelRegistrar { ...@@ -617,7 +617,7 @@ struct KernelRegistrar {
cpp_dtype, \ cpp_dtype, \
...) \ ...) \
static const ::phi::KernelRegistrar PD_CONCATENATE( \ static const ::phi::KernelRegistrar PD_CONCATENATE( \
__reg_pt_kernel_##kernel_name##_##backend##_##layout##_, registrar_id)( \ __reg_phi_kernel_##kernel_name##_##backend##_##layout##_, registrar_id)( \
reg_type, \ reg_type, \
#kernel_name, \ #kernel_name, \
#backend, \ #backend, \
...@@ -648,7 +648,7 @@ struct KernelRegistrar { ...@@ -648,7 +648,7 @@ struct KernelRegistrar {
cpp_dtype, \ cpp_dtype, \
...) \ ...) \
static const ::phi::KernelRegistrar PD_CONCATENATE( \ static const ::phi::KernelRegistrar PD_CONCATENATE( \
__reg_pt_kernel_##kernel_name##_##backend##_##layout##_, registrar_id)( \ __reg_phi_kernel_##kernel_name##_##backend##_##layout##_, registrar_id)( \
reg_type, \ reg_type, \
#kernel_name, \ #kernel_name, \
#backend, \ #backend, \
...@@ -679,7 +679,7 @@ struct KernelRegistrar { ...@@ -679,7 +679,7 @@ struct KernelRegistrar {
cpp_dtype, \ cpp_dtype, \
...) \ ...) \
static const ::phi::KernelRegistrar PD_CONCATENATE( \ static const ::phi::KernelRegistrar PD_CONCATENATE( \
__reg_pt_kernel_##kernel_name##_##backend##_##layout##_, registrar_id)( \ __reg_phi_kernel_##kernel_name##_##backend##_##layout##_, registrar_id)( \
reg_type, \ reg_type, \
#kernel_name, \ #kernel_name, \
#backend, \ #backend, \
...@@ -710,7 +710,7 @@ struct KernelRegistrar { ...@@ -710,7 +710,7 @@ struct KernelRegistrar {
cpp_dtype, \ cpp_dtype, \
...) \ ...) \
static const ::phi::KernelRegistrar PD_CONCATENATE( \ static const ::phi::KernelRegistrar PD_CONCATENATE( \
__reg_pt_kernel_##kernel_name##_##backend##_##layout##_, registrar_id)( \ __reg_phi_kernel_##kernel_name##_##backend##_##layout##_, registrar_id)( \
reg_type, \ reg_type, \
#kernel_name, \ #kernel_name, \
#backend, \ #backend, \
...@@ -741,7 +741,7 @@ struct KernelRegistrar { ...@@ -741,7 +741,7 @@ struct KernelRegistrar {
cpp_dtype, \ cpp_dtype, \
...) \ ...) \
static const ::phi::KernelRegistrar PD_CONCATENATE( \ static const ::phi::KernelRegistrar PD_CONCATENATE( \
__reg_pt_kernel_##kernel_name##_##backend##_##layout##_, registrar_id)( \ __reg_phi_kernel_##kernel_name##_##backend##_##layout##_, registrar_id)( \
reg_type, \ reg_type, \
#kernel_name, \ #kernel_name, \
#backend, \ #backend, \
...@@ -772,7 +772,7 @@ struct KernelRegistrar { ...@@ -772,7 +772,7 @@ struct KernelRegistrar {
cpp_dtype, \ cpp_dtype, \
...) \ ...) \
static const ::phi::KernelRegistrar PD_CONCATENATE( \ static const ::phi::KernelRegistrar PD_CONCATENATE( \
__reg_pt_kernel_##kernel_name##_##backend##_##layout##_, registrar_id)( \ __reg_phi_kernel_##kernel_name##_##backend##_##layout##_, registrar_id)( \
reg_type, \ reg_type, \
#kernel_name, \ #kernel_name, \
#backend, \ #backend, \
...@@ -803,7 +803,7 @@ struct KernelRegistrar { ...@@ -803,7 +803,7 @@ struct KernelRegistrar {
cpp_dtype, \ cpp_dtype, \
...) \ ...) \
static const ::phi::KernelRegistrar PD_CONCATENATE( \ static const ::phi::KernelRegistrar PD_CONCATENATE( \
__reg_pt_kernel_##kernel_name##_##backend##_##layout##_, registrar_id)( \ __reg_phi_kernel_##kernel_name##_##backend##_##layout##_, registrar_id)( \
reg_type, \ reg_type, \
#kernel_name, \ #kernel_name, \
#backend, \ #backend, \
...@@ -834,7 +834,7 @@ struct KernelRegistrar { ...@@ -834,7 +834,7 @@ struct KernelRegistrar {
cpp_dtype, \ cpp_dtype, \
...) \ ...) \
static const ::phi::KernelRegistrar PD_CONCATENATE( \ static const ::phi::KernelRegistrar PD_CONCATENATE( \
__reg_pt_kernel_##kernel_name##_##backend##_##layout##_, registrar_id)( \ __reg_phi_kernel_##kernel_name##_##backend##_##layout##_, registrar_id)( \
reg_type, \ reg_type, \
#kernel_name, \ #kernel_name, \
#backend, \ #backend, \
...@@ -865,7 +865,7 @@ struct KernelRegistrar { ...@@ -865,7 +865,7 @@ struct KernelRegistrar {
cpp_dtype, \ cpp_dtype, \
...) \ ...) \
static const ::phi::KernelRegistrar PD_CONCATENATE( \ static const ::phi::KernelRegistrar PD_CONCATENATE( \
__reg_pt_kernel_##kernel_name##_##backend##_##layout##_, registrar_id)( \ __reg_phi_kernel_##kernel_name##_##backend##_##layout##_, registrar_id)( \
reg_type, \ reg_type, \
#kernel_name, \ #kernel_name, \
#backend, \ #backend, \
...@@ -896,7 +896,7 @@ struct KernelRegistrar { ...@@ -896,7 +896,7 @@ struct KernelRegistrar {
cpp_dtype, \ cpp_dtype, \
...) \ ...) \
static const ::phi::KernelRegistrar PD_CONCATENATE( \ static const ::phi::KernelRegistrar PD_CONCATENATE( \
__reg_pt_kernel_##kernel_name##_##backend##_##layout##_, registrar_id)( \ __reg_phi_kernel_##kernel_name##_##backend##_##layout##_, registrar_id)( \
reg_type, \ reg_type, \
#kernel_name, \ #kernel_name, \
#backend, \ #backend, \
...@@ -927,7 +927,7 @@ struct KernelRegistrar { ...@@ -927,7 +927,7 @@ struct KernelRegistrar {
cpp_dtype, \ cpp_dtype, \
...) \ ...) \
static const ::phi::KernelRegistrar PD_CONCATENATE( \ static const ::phi::KernelRegistrar PD_CONCATENATE( \
__reg_pt_kernel_##kernel_name##_##backend##_##layout##_, registrar_id)( \ __reg_phi_kernel_##kernel_name##_##backend##_##layout##_, registrar_id)( \
reg_type, \ reg_type, \
#kernel_name, \ #kernel_name, \
#backend, \ #backend, \
...@@ -958,7 +958,7 @@ struct KernelRegistrar { ...@@ -958,7 +958,7 @@ struct KernelRegistrar {
cpp_dtype, \ cpp_dtype, \
...) \ ...) \
static const ::phi::KernelRegistrar PD_CONCATENATE( \ static const ::phi::KernelRegistrar PD_CONCATENATE( \
__reg_pt_kernel_##kernel_name##_##backend##_##layout##_, registrar_id)( \ __reg_phi_kernel_##kernel_name##_##backend##_##layout##_, registrar_id)( \
reg_type, \ reg_type, \
#kernel_name, \ #kernel_name, \
#backend, \ #backend, \
...@@ -989,7 +989,7 @@ struct KernelRegistrar { ...@@ -989,7 +989,7 @@ struct KernelRegistrar {
cpp_dtype, \ cpp_dtype, \
...) \ ...) \
static const ::phi::KernelRegistrar PD_CONCATENATE( \ static const ::phi::KernelRegistrar PD_CONCATENATE( \
__reg_pt_kernel_##kernel_name##_##backend##_##layout##_, registrar_id)( \ __reg_phi_kernel_##kernel_name##_##backend##_##layout##_, registrar_id)( \
reg_type, \ reg_type, \
#kernel_name, \ #kernel_name, \
#backend, \ #backend, \
...@@ -1035,7 +1035,7 @@ struct KernelRegistrar { ...@@ -1035,7 +1035,7 @@ struct KernelRegistrar {
static void __PD_KERNEL_args_def_FN_##kernel_name##_##backend##_##layout( \ static void __PD_KERNEL_args_def_FN_##kernel_name##_##backend##_##layout( \
const ::phi::KernelKey& kernel_key, ::phi::Kernel* kernel); \ const ::phi::KernelKey& kernel_key, ::phi::Kernel* kernel); \
static const ::phi::KernelRegistrar \ static const ::phi::KernelRegistrar \
__reg_pt_kernel_##kernel_name##_##backend##_##layout( \ __reg_phi_kernel_##kernel_name##_##backend##_##layout( \
reg_type, \ reg_type, \
#kernel_name, \ #kernel_name, \
#backend, \ #backend, \
...@@ -1055,7 +1055,7 @@ struct KernelRegistrar { ...@@ -1055,7 +1055,7 @@ struct KernelRegistrar {
static void __PD_KERNEL_args_def_FN_##kernel_name##_##backend##_##layout( \ static void __PD_KERNEL_args_def_FN_##kernel_name##_##backend##_##layout( \
const ::phi::KernelKey& kernel_key, ::phi::Kernel* kernel); \ const ::phi::KernelKey& kernel_key, ::phi::Kernel* kernel); \
static const ::phi::KernelRegistrar \ static const ::phi::KernelRegistrar \
__reg_pt_kernel_##kernel_name##_##backend##_##layout( \ __reg_phi_kernel_##kernel_name##_##backend##_##layout( \
reg_type, \ reg_type, \
#kernel_name, \ #kernel_name, \
#backend, \ #backend, \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册