Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions paddle/fluid/inference/api/analysis_predictor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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()) {
Expand Down
14 changes: 14 additions & 0 deletions test/cpp/jit/layer_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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";

Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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";
Expand Down