提交 38ddd716 编写于 作者: H halsay

bug fixes

上级 c67b701f
...@@ -35,7 +35,6 @@ namespace ops = paddle_mobile::operators; ...@@ -35,7 +35,6 @@ namespace ops = paddle_mobile::operators;
REGISTER_OPERATOR_CPU(batch_norm, ops::BatchNormOp); REGISTER_OPERATOR_CPU(batch_norm, ops::BatchNormOp);
#endif #endif
#ifdef PADDLE_MOBILE_MALI_GPU #ifdef PADDLE_MOBILE_MALI_GPU
USE_OP_MALI_GPU(batch_norm);
REGISTER_OPERATOR_MALI_GPU(batch_norm, ops::BatchNormOp); REGISTER_OPERATOR_MALI_GPU(batch_norm, ops::BatchNormOp);
#endif #endif
#ifdef PADDLE_MOBILE_FPGA #ifdef PADDLE_MOBILE_FPGA
......
...@@ -76,7 +76,7 @@ namespace ops = paddle_mobile::operators; ...@@ -76,7 +76,7 @@ namespace ops = paddle_mobile::operators;
REGISTER_OPERATOR_CPU(fusion_conv_add, ops::FusionConvAddOp); REGISTER_OPERATOR_CPU(fusion_conv_add, ops::FusionConvAddOp);
#endif #endif
#ifdef PADDLE_MOBILE_MALI_GPU #ifdef PADDLE_MOBILE_MALI_GPU
REGISTER_OPERATOR_MALI_GPU(conv_add, ops::FusionConvAddOp); REGISTER_OPERATOR_MALI_GPU(fusion_conv_add, ops::FusionConvAddOp);
#endif #endif
#ifdef PADDLE_MOBILE_FPGA #ifdef PADDLE_MOBILE_FPGA
#endif #endif
......
...@@ -96,7 +96,7 @@ static framework::FusionOpRegistrar convadd_registrar( ...@@ -96,7 +96,7 @@ static framework::FusionOpRegistrar convadd_registrar(
USE_OP_CPU(fusion_conv_add); USE_OP_CPU(fusion_conv_add);
#endif #endif
#ifdef PADDLE_MOBILE_MALI_GPU #ifdef PADDLE_MOBILE_MALI_GPU
USE_OP_MALI_GPU(conv_add); USE_OP_MALI_GPU(fusion_conv_add);
#endif #endif
#ifdef PADDLE_MOBILE_FPGA #ifdef PADDLE_MOBILE_FPGA
#endif #endif
......
...@@ -80,7 +80,7 @@ namespace ops = paddle_mobile::operators; ...@@ -80,7 +80,7 @@ namespace ops = paddle_mobile::operators;
REGISTER_OPERATOR_CPU(fusion_fc, ops::FusionFcOp); REGISTER_OPERATOR_CPU(fusion_fc, ops::FusionFcOp);
#endif #endif
#ifdef PADDLE_MOBILE_MALI_GPU #ifdef PADDLE_MOBILE_MALI_GPU
REGISTER_OPERATOR_MALI_GPU(fc, ops::FusionFcOp); REGISTER_OPERATOR_MALI_GPU(fusion_fc, ops::FusionFcOp);
#endif #endif
#ifdef PADDLE_MOBILE_FPGA #ifdef PADDLE_MOBILE_FPGA
#endif #endif
......
...@@ -78,7 +78,7 @@ extern framework::FusionOpRegistrar fc_registrar(new FusionFcMatcher()); ...@@ -78,7 +78,7 @@ extern framework::FusionOpRegistrar fc_registrar(new FusionFcMatcher());
#ifndef CONV_CPU_REGISTER #ifndef CONV_CPU_REGISTER
#define CONV_CPU_REGISTER #define CONV_CPU_REGISTER
static framework::FusionOpRegistrar fc_registrar(new FusionFcMatcher()); extern framework::FusionOpRegistrar fc_registrar(new FusionFcMatcher());
#endif #endif
#endif #endif
...@@ -93,7 +93,7 @@ static framework::FusionOpRegistrar fc_registrar(new FusionFcMatcher()); ...@@ -93,7 +93,7 @@ static framework::FusionOpRegistrar fc_registrar(new FusionFcMatcher());
USE_OP_CPU(fusion_fc); USE_OP_CPU(fusion_fc);
#endif #endif
#ifdef PADDLE_MOBILE_MALI_GPU #ifdef PADDLE_MOBILE_MALI_GPU
USE_OP_MALI_GPU(fc); USE_OP_MALI_GPU(fusion_fc);
#endif #endif
#ifdef PADDLE_MOBILE_FPGA #ifdef PADDLE_MOBILE_FPGA
#endif #endif
......
文件模式从 100644 更改为 100755
...@@ -225,6 +225,7 @@ class AclParameters { ...@@ -225,6 +225,7 @@ class AclParameters {
bool is_global_pool; bool is_global_pool;
bool is_channel_concat; bool is_channel_concat;
bool is_bypass;
std::vector<framework::LoDTensor *> in_tensor; std::vector<framework::LoDTensor *> in_tensor;
}; };
......
文件模式从 100644 更改为 100755
文件模式从 100644 更改为 100755
...@@ -136,7 +136,7 @@ bool BatchNormKernel<GPU_MALI, float>::Init(BatchNormParam* param) { ...@@ -136,7 +136,7 @@ bool BatchNormKernel<GPU_MALI, float>::Init(BatchNormParam* param) {
acl_op = new AclBatchNormOp<GPU_MALI, float>(); acl_op = new AclBatchNormOp<GPU_MALI, float>();
this->SetAclOp((void*)acl_op, (void*)this); this->SetAclOp((void*)acl_op, (void*)this);
} }
if (acl_op->Bypass_acl(param)) { if (acl_op->Bypass_acl(*param)) {
std::cout << "init acl failed" << std::endl; std::cout << "init acl failed" << std::endl;
return false; return false;
} }
......
...@@ -102,14 +102,14 @@ class AclConcatOp : public acl::ACLOperator { ...@@ -102,14 +102,14 @@ class AclConcatOp : public acl::ACLOperator {
}; };
template <> template <>
bool ConcatKernel<GPU_MALI, float>::Init(const ConcatParam& param) const { bool ConcatKernel<GPU_MALI, float>::Init(ConcatParam* param) {
AclConcatOp<GPU_MALI, float>* acl_op = AclConcatOp<GPU_MALI, float>* acl_op =
reinterpret_cast<AclConcatOp<GPU_MALI, float>*>(this->GetAclOp()); reinterpret_cast<AclConcatOp<GPU_MALI, float>*>(this->GetAclOp());
if (acl_op == nullptr) { if (acl_op == nullptr) {
acl_op = new AclConcatOp<GPU_MALI, float>(); acl_op = new AclConcatOp<GPU_MALI, float>();
this->SetAclOp((void*)acl_op, (void*)this); this->SetAclOp((void*)acl_op, (void*)this);
} }
if (acl_op->Bypass_acl(param)) { if (acl_op->Bypass_acl(*param)) {
std::cout << "init acl failed" << std::endl; std::cout << "init acl failed" << std::endl;
return false; return false;
} }
......
...@@ -196,15 +196,14 @@ class AclConvAddOp : public acl::ACLOperator { ...@@ -196,15 +196,14 @@ class AclConvAddOp : public acl::ACLOperator {
}; };
template <> template <>
bool ConvAddKernel<GPU_MALI, float>::Init( bool ConvAddKernel<GPU_MALI, float>::Init(FusionConvAddParam* param) {
const FusionConvAddParam& param) const {
AclConvAddOp<GPU_MALI, float>* acl_op = AclConvAddOp<GPU_MALI, float>* acl_op =
reinterpret_cast<AclConvAddOp<GPU_MALI, float>*>(this->GetAclOp()); reinterpret_cast<AclConvAddOp<GPU_MALI, float>*>(this->GetAclOp());
if (acl_op == nullptr) { if (acl_op == nullptr) {
acl_op = new AclConvAddOp<GPU_MALI, float>(); acl_op = new AclConvAddOp<GPU_MALI, float>();
this->SetAclOp((void*)acl_op, (void*)this); this->SetAclOp((void*)acl_op, (void*)this);
} }
if (acl_op->Bypass_acl(param)) { if (acl_op->Bypass_acl(*param)) {
std::cout << "init acl failed" << std::endl; std::cout << "init acl failed" << std::endl;
return false; return false;
} }
......
...@@ -203,7 +203,7 @@ bool ConvKernel<GPU_MALI, float>::Init(ConvParam* param) { ...@@ -203,7 +203,7 @@ bool ConvKernel<GPU_MALI, float>::Init(ConvParam* param) {
acl_op = new AclConvOp<GPU_MALI, float>(); acl_op = new AclConvOp<GPU_MALI, float>();
this->SetAclOp((void*)acl_op, (void*)this); this->SetAclOp((void*)acl_op, (void*)this);
} }
if (acl_op->Bypass_acl(param)) { if (acl_op->Bypass_acl(*param)) {
std::cout << "init acl failed" << std::endl; std::cout << "init acl failed" << std::endl;
return false; return false;
} }
......
文件模式从 100644 更改为 100755
文件模式从 100644 更改为 100755
...@@ -20,6 +20,7 @@ limitations under the License. */ ...@@ -20,6 +20,7 @@ limitations under the License. */
#ifdef PADDLE_MOBILE_MALI_GPU #ifdef PADDLE_MOBILE_MALI_GPU
#include "acl_operator.h" #include "acl_operator.h"
#include "framework/operator.h" #include "framework/operator.h"
#include "operators/kernel/central-arm-func/lrn_arm_func.h"
#include "operators/op_param.h" #include "operators/op_param.h"
namespace paddle_mobile { namespace paddle_mobile {
...@@ -59,12 +60,15 @@ class AclLrnOp : public acl::ACLOperator { ...@@ -59,12 +60,15 @@ class AclLrnOp : public acl::ACLOperator {
acl_configure(lrn, this, norm_info); acl_configure(lrn, this, norm_info);
} }
void Set_bypass(bool bypass) { args.is_bypass = bypass; }
void RunAcl(void* input, void* output) { void RunAcl(void* input, void* output) {
acl::ACLOperator::acl_run(input, output); acl::ACLOperator::acl_run(input, output);
} }
bool Bypass_acl(const LrnParam& param) { bool Bypass_acl(const LrnParam& param) {
bool bypass_acl = false; bool bypass_acl = false;
AclParametersByContext(param); AclParametersByContext(param);
InitAclLayer(param);
// for performance, more groups impact GPU performance // for performance, more groups impact GPU performance
if (this->force_bypass_acl_path_) { if (this->force_bypass_acl_path_) {
bypass_acl = true; bypass_acl = true;
...@@ -107,13 +111,18 @@ class AclLrnOp : public acl::ACLOperator { ...@@ -107,13 +111,18 @@ class AclLrnOp : public acl::ACLOperator {
}; };
template <> template <>
bool LrnKernel<GPU_MALI, float>::Init(const LrnParam& param) const { bool LrnKernel<GPU_MALI, float>::Init(LrnParam* param) {
AclLrnOp<GPU_MALI, float>* acl_op = AclLrnOp<GPU_MALI, float>* acl_op =
reinterpret_cast<AclLrnOp<GPU_MALI, float>*>(this->GetAclOp()); reinterpret_cast<AclLrnOp<GPU_MALI, float>*>(this->GetAclOp());
if (acl_op == nullptr) { if (acl_op == nullptr) {
acl_op = new AclLrnOp<GPU_MALI, float>(); acl_op = new AclLrnOp<GPU_MALI, float>();
this->SetAclOp((void*)acl_op, (void*)this); this->SetAclOp((void*)acl_op, (void*)this);
} }
if (acl_op->Bypass_acl(*param)) {
acl_op->Set_bypass(true);
std::cout << "init acl failed" << std::endl;
return true;
}
return true; return true;
} }
...@@ -125,14 +134,14 @@ void LrnKernel<GPU_MALI, float>::Compute(const LrnParam& param) const { ...@@ -125,14 +134,14 @@ void LrnKernel<GPU_MALI, float>::Compute(const LrnParam& param) const {
if (acl_op == nullptr) { if (acl_op == nullptr) {
return; return;
} }
if (acl_op->Bypass_acl(param)) { acl::AclParameters& args = acl_op->getargs();
std::cout << "init acl failed" << std::endl; if (args.is_bypass) {
std::cout << "bypass op" << std::endl;
LrnCompute<float>(param);
return; return;
} }
acl::AclParameters& args = acl_op->getargs();
const float* input_data = (const float*)args.input_data; const float* input_data = (const float*)args.input_data;
const float* output_data = (const float*)args.output_data; const float* output_data = (const float*)args.output_data;
acl_op->InitAclLayer(param);
for (int n = 0; n < args.batch; ++n) { for (int n = 0; n < args.batch; ++n) {
acl_op->RunAcl((void*)input_data, (void*)output_data); acl_op->RunAcl((void*)input_data, (void*)output_data);
input_data += args.in_depth * args.in_cols * args.in_rows; input_data += args.in_depth * args.in_cols * args.in_rows;
......
文件模式从 100644 更改为 100755
...@@ -180,14 +180,14 @@ class AclPoolOp : public acl::ACLOperator { ...@@ -180,14 +180,14 @@ class AclPoolOp : public acl::ACLOperator {
}; };
template <> template <>
bool PoolKernel<GPU_MALI, float>::Init(const PoolParam& param) const { bool PoolKernel<GPU_MALI, float>::Init(PoolParam* param) {
AclPoolOp<GPU_MALI, float>* acl_op = AclPoolOp<GPU_MALI, float>* acl_op =
reinterpret_cast<AclPoolOp<GPU_MALI, float>*>(this->GetAclOp()); reinterpret_cast<AclPoolOp<GPU_MALI, float>*>(this->GetAclOp());
if (acl_op == nullptr) { if (acl_op == nullptr) {
acl_op = new AclPoolOp<GPU_MALI, float>(); acl_op = new AclPoolOp<GPU_MALI, float>();
this->SetAclOp((void*)acl_op, (void*)this); this->SetAclOp((void*)acl_op, (void*)this);
} }
if (acl_op->Bypass_acl(param)) { if (acl_op->Bypass_acl(*param)) {
std::cout << "init acl failed" << std::endl; std::cout << "init acl failed" << std::endl;
return false; return false;
} }
......
...@@ -100,14 +100,14 @@ class AclReluOp : public acl::ACLOperator { ...@@ -100,14 +100,14 @@ class AclReluOp : public acl::ACLOperator {
}; };
template <> template <>
bool ReluKernel<GPU_MALI, float>::Init(const ReluParam& param) const { bool ReluKernel<GPU_MALI, float>::Init(ReluParam* param) {
AclReluOp<GPU_MALI, float>* acl_op = AclReluOp<GPU_MALI, float>* acl_op =
reinterpret_cast<AclReluOp<GPU_MALI, float>*>(this->GetAclOp()); reinterpret_cast<AclReluOp<GPU_MALI, float>*>(this->GetAclOp());
if (acl_op == nullptr) { if (acl_op == nullptr) {
acl_op = new AclReluOp<GPU_MALI, float>(); acl_op = new AclReluOp<GPU_MALI, float>();
this->SetAclOp((void*)acl_op, (void*)this); this->SetAclOp((void*)acl_op, (void*)this);
} }
if (acl_op->Bypass_acl(param)) { if (acl_op->Bypass_acl(*param)) {
std::cout << "init acl failed" << std::endl; std::cout << "init acl failed" << std::endl;
return false; return false;
} }
......
文件模式从 100644 更改为 100755
...@@ -97,14 +97,14 @@ class AclSoftmaxOp : public acl::ACLOperator { ...@@ -97,14 +97,14 @@ class AclSoftmaxOp : public acl::ACLOperator {
}; };
template <> template <>
bool SoftmaxKernel<GPU_MALI, float>::Init(const SoftmaxParam& param) const { bool SoftmaxKernel<GPU_MALI, float>::Init(SoftmaxParam* param) {
AclSoftmaxOp<GPU_MALI, float>* acl_op = AclSoftmaxOp<GPU_MALI, float>* acl_op =
reinterpret_cast<AclSoftmaxOp<GPU_MALI, float>*>(this->GetAclOp()); reinterpret_cast<AclSoftmaxOp<GPU_MALI, float>*>(this->GetAclOp());
if (acl_op == nullptr) { if (acl_op == nullptr) {
acl_op = new AclSoftmaxOp<GPU_MALI, float>(); acl_op = new AclSoftmaxOp<GPU_MALI, float>();
this->SetAclOp((void*)acl_op, (void*)this); this->SetAclOp((void*)acl_op, (void*)this);
} }
if (acl_op->Bypass_acl(param)) { if (acl_op->Bypass_acl(*param)) {
std::cout << "init acl failed" << std::endl; std::cout << "init acl failed" << std::endl;
return false; return false;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册