diff --git a/core/predictor/framework/infer.h b/core/predictor/framework/infer.h index ba0c18e06c298553af10836fd488c6cffcd92226..557bb2b69f087fcaf445fa81d7734164995c2472 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 26d5bec8936ea7bb2df4f29f2aff356c3f2ef754..b3db6e1ad03d1822155918f9eb8714b6285972d1 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()) {