MCPcopy Create free account
hub / github.com/ROCm/AMDMIGraphX / run_passes

Function run_passes

src/pass_manager.cpp:203–236  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

201module& get_module(module_pass_manager& mpm) { return mpm.get_module(); }
202
203void run_passes(program& prog, module_ref root_mod, const std::vector<pass>& passes, tracer trace)
204{
205 if(enabled(MIGRAPHX_TRACE_PASSES{}))
206 trace = tracer{std::cout};
207 std::unordered_set<module_ref> visited;
208 for(const auto& p : passes)
209 {
210 auto tree = prog.get_module_tree();
211 std::vector<module_ref> sub_mods = root_mod->get_sub_modules();
212 sub_mods.insert(sub_mods.begin(), root_mod);
213 visited.clear();
214 for(const auto& mod : reverse(sub_mods))
215 {
216 if(mod->bypass())
217 continue;
218 if(not visited.insert(mod).second)
219 continue;
220 module_pm mpm{mod, root_mod, &trace};
221 mpm.prog = &prog;
222 auto parents = range(tree.equal_range(mod));
223 auto nparents = distance(parents);
224 if(nparents == 0)
225 mpm.common_parent = nullptr;
226 else if(nparents == 1)
227 mpm.common_parent = parents.begin()->second;
228 else
229 // Just set common parent to main module when there is muliple parents for now
230 // TODO: Compute the common parent
231 mpm.common_parent = prog.get_main_module();
232 mpm.run_pass(p);
233 }
234 run_pass(prog, p, trace);
235 }
236}
237
238void run_passes(module& mod, const std::vector<pass>& passes, tracer trace)
239{

Callers 15

run_passFunction · 0.85
run_passFunction · 0.85
run_passFunction · 0.85
TEST_CASEFunction · 0.85
run_fp8_ocp_to_fnuzFunction · 0.85
run_simplify_qdqFunction · 0.85
run_cse_pcFunction · 0.85
run_passFunction · 0.85
run_passFunction · 0.85
run_passFunction · 0.85
run_passFunction · 0.85
run_passFunction · 0.85

Calls 13

distanceFunction · 0.85
get_module_treeMethod · 0.80
get_sub_modulesMethod · 0.80
bypassMethod · 0.80
get_main_moduleMethod · 0.80
enabledFunction · 0.70
run_passFunction · 0.70
reverseFunction · 0.50
rangeFunction · 0.50
insertMethod · 0.45
beginMethod · 0.45
clearMethod · 0.45

Tested by 15

run_passFunction · 0.68
run_passFunction · 0.68
run_passFunction · 0.68
TEST_CASEFunction · 0.68
run_fp8_ocp_to_fnuzFunction · 0.68
run_simplify_qdqFunction · 0.68
run_cse_pcFunction · 0.68
run_passFunction · 0.68
run_passFunction · 0.68
run_passFunction · 0.68
run_passFunction · 0.68
run_passFunction · 0.68