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

Method remove_module

src/program.cpp:1306–1333  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1304}
1305
1306void program::remove_module(const std::string& name)
1307{
1308 // cppcheck-suppress assertWithSideEffect
1309 assert(is_unused_module(impl->modules, generic_get_modules(this->get_main_module()), name) and
1310 "Module used in program");
1311 assert(std::none_of(
1312 impl->modules.at(name).begin(),
1313 impl->modules.at(name).end(),
1314 [&](auto&& ins) { return references_instruction(impl->modules, ins, name); }) and
1315 "Instruction referenced in another module");
1316
1317 // if an instruction has an input out side of the current module, need to remove
1318 // the instruction from its input's outputs
1319 auto& mod = impl->modules.at(name);
1320 for(auto ins : iterator_for(mod))
1321 {
1322 auto inputs = ins->inputs();
1323 for(auto in : inputs)
1324 {
1325 if(not mod.has_instruction(in))
1326 {
1327 in->remove_output(ins);
1328 }
1329 }
1330 }
1331
1332 impl->modules.erase(name);
1333}
1334
1335void program::rename_module(const std::string& old_name, const std::string& new_name)
1336{

Callers 1

remove_unused_modulesMethod · 0.95

Calls 12

get_main_moduleMethod · 0.95
is_unused_moduleFunction · 0.85
generic_get_modulesFunction · 0.85
references_instructionFunction · 0.85
iterator_forFunction · 0.85
atMethod · 0.80
eraseMethod · 0.80
none_ofFunction · 0.50
beginMethod · 0.45
endMethod · 0.45
inputsMethod · 0.45
has_instructionMethod · 0.45

Tested by

no test coverage detected