From 96545b51d150f38920313914816439de1522809a Mon Sep 17 00:00:00 2001 From: zhangjun Date: Sun, 17 Jan 2021 12:50:17 +0800 Subject: [PATCH] update --- core/predictor/framework/infer.h | 2 +- .../include/fluid_arm_engine.h | 34 ++++++++++--------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/core/predictor/framework/infer.h b/core/predictor/framework/infer.h index ba0c18e0..557bb2b6 100644 --- a/core/predictor/framework/infer.h +++ b/core/predictor/framework/infer.h @@ -528,7 +528,7 @@ class CloneDBReloadableInferEngine }; template -#ifdef WITH_TRT +#ifdef WITH_TRT | WITH_XPU class FluidInferEngine : public DBReloadableInferEngine { #else class FluidInferEngine : public CloneDBReloadableInferEngine { diff --git a/paddle_inference/inferencer-fluid-arm/include/fluid_arm_engine.h b/paddle_inference/inferencer-fluid-arm/include/fluid_arm_engine.h index 26d5bec8..b3db6e1a 100644 --- a/paddle_inference/inferencer-fluid-arm/include/fluid_arm_engine.h +++ b/paddle_inference/inferencer-fluid-arm/include/fluid_arm_engine.h @@ -128,14 +128,6 @@ class FluidArmAnalysisCore : public FluidFamilyCore { config.DisableGpu(); config.SetCpuMathLibraryNumThreads(1); - if (params.enable_memory_optimization()) { - config.EnableMemoryOptim(); - } - - if (params.enable_memory_optimization()) { - config.EnableMemoryOptim(); - } - if (params.use_lite()) { config.EnableLiteEngine(PrecisionType::kFloat32, true); } @@ -144,6 +136,16 @@ class FluidArmAnalysisCore : public FluidFamilyCore { config.EnableXpu(2 * 1024 * 1024); } + if (params.enable_memory_optimization()) { + config.EnableMemoryOptim(); + } + + if (params.enable_ir_optimization()) { + config.SwitchIrOptim(true); + } else { + config.SwitchIrOptim(false); + } + config.SwitchSpecifyInputNames(true); AutoLock lock(GlobalPaddleCreateMutex::instance()); _core = CreatePredictor(config); @@ -173,6 +175,14 @@ class FluidArmAnalysisDirCore : public FluidFamilyCore { config.SwitchSpecifyInputNames(true); config.SetCpuMathLibraryNumThreads(1); + if (params.use_lite()) { + config.EnableLiteEngine(PrecisionType::kFloat32, true); + } + + if (params.use_xpu()) { + config.EnableXpu(2 * 1024 * 1024); + } + if (params.enable_memory_optimization()) { config.EnableMemoryOptim(); } @@ -183,14 +193,6 @@ class FluidArmAnalysisDirCore : public FluidFamilyCore { config.SwitchIrOptim(false); } - if (params.use_lite()) { - config.EnableLiteEngine(PrecisionType::kFloat32, true); - } - - if (params.use_xpu()) { - config.EnableXpu(1 * 1024 * 1024); - } - AutoLock lock(GlobalPaddleCreateMutex::instance()); _core = CreatePredictor(config); if (NULL == _core.get()) { -- GitLab