MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle / ApplyIrPass

Function ApplyIrPass

paddle/fluid/framework/executor_cache.cc:171–208  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

169}
170
171std::unique_ptr<pir::Program> ApplyIrPass(
172 pir::Program *program,
173 phi::Place place,
174 const std::set<std::string> &no_need_buffer_names) {
175#if defined(PADDLE_WITH_CUSTOM_DEVICE)
176 if (!FLAGS_enable_custom_engine.empty()) {
177 std::string custom_engine_translate_pass = FLAGS_enable_custom_engine;
178 std::istringstream ss(custom_engine_translate_pass);
179 std::string pass;
180 std::vector<std::string> passes;
181
182 while (std::getline(ss, pass, ',')) {
183 passes.push_back(pass);
184 VLOG(4) << "Add CustomEngine pass : " << pass;
185 }
186
187 pir::PassManager pass_pm(pir::IrContext::Instance(), 3);
188 for (std::string custom_pass : passes) {
189 pass_pm.AddPass(pir::PassRegistry::Instance().Get(custom_pass));
190 pass_pm.Run(program);
191 }
192 }
193#endif
194 auto ir_res = pir::PdOpLowerToKernelPass(program, place);
195
196 if (FLAGS_pir_apply_inplace_pass) {
197 pir::PassManager pm(pir::IrContext::Instance(), 3);
198 pm.AddPass(pir::CreateInplacePass(no_need_buffer_names));
199 pm.Run(ir_res.get());
200
201 if (FLAGS_print_ir) {
202 std::cout << "IR After inplace -------------------" << std::endl;
203 std::cout << *ir_res << std::endl;
204 }
205 }
206
207 return ir_res;
208}
209
210std::unique_ptr<pir::Program> ApplyRemoveShadowFeedPass(
211 std::unique_ptr<pir::Program> program,

Callers 3

RunProgramImplFunction · 0.85
RunProgramGradImplFunction · 0.85

Calls 9

InstanceFunction · 0.85
PdOpLowerToKernelPassFunction · 0.85
CreateInplacePassFunction · 0.85
emptyMethod · 0.45
push_backMethod · 0.45
AddPassMethod · 0.45
GetMethod · 0.45
RunMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected