diff --git a/paddle/fluid/inference/api/analysis_predictor.cc b/paddle/fluid/inference/api/analysis_predictor.cc index 93db56e97b748e..1fea93eb68afb4 100644 --- a/paddle/fluid/inference/api/analysis_predictor.cc +++ b/paddle/fluid/inference/api/analysis_predictor.cc @@ -139,6 +139,7 @@ #include "paddle/pir/include/pass/pass_registry.h" COMMON_DECLARE_bool(pir_apply_inplace_pass); +COMMON_DECLARE_bool(enable_pir_api); namespace paddle { namespace { @@ -390,6 +391,10 @@ AnalysisPredictor::AnalysisPredictor(const AnalysisConfig &config) if (config_.shape_range_info_collected()) { config_.SwitchIrOptim(false); } + if (FLAGS_enable_pir_api) { + config_.EnableNewExecutor(true); + config_.EnableNewIR(true); + } if (config_.new_executor_enabled()) { config_.EnableMemoryOptim(false); if (config_.new_ir_enabled()) { diff --git a/test/cpp/jit/layer_test.cc b/test/cpp/jit/layer_test.cc index 42fd976f6dbdd3..57c7bd9dedfbd9 100644 --- a/test/cpp/jit/layer_test.cc +++ b/test/cpp/jit/layer_test.cc @@ -55,6 +55,8 @@ PD_DECLARE_KERNEL(mean, GPU, ALL_LAYOUT); PD_DECLARE_KERNEL(scale, GPU, ALL_LAYOUT); #endif +COMMON_DECLARE_bool(enable_pir_api); + namespace paddle { namespace jit { using DenseTensor = phi::DenseTensor; @@ -77,6 +79,9 @@ TEST(CpuLayerTest, Function) { } TEST(CpuLayerTest, Construct) { + if (FLAGS_enable_pir_api) { + return; + } auto place = phi::CPUPlace(); std::string path = "./multi_program_load/export"; paddle::platform::Timer timer; @@ -125,6 +130,9 @@ TEST(CpuLayerTest, Construct) { } TEST(CpuLayerTest, Clone) { + if (FLAGS_enable_pir_api) { + return; + } auto place = phi::CPUPlace(); std::string path = "./multi_program_load/export"; @@ -161,6 +169,9 @@ TEST(CpuLayerTest, Clone) { #if defined(PADDLE_WITH_CUDA) TEST(GpuLayerTest, Construct) { + if (FLAGS_enable_pir_api) { + return; + } auto place = phi::GPUPlace(); std::string path = "./multi_program_load/export"; @@ -189,6 +200,9 @@ TEST(GpuLayerTest, Construct) { } TEST(GpuLayerTest, Clone) { + if (FLAGS_enable_pir_api) { + return; + } auto place = phi::GPUPlace(); std::string path = "./multi_program_load/export";