Commit b888b61d authored by umang yadav's avatar umang yadav
Browse files

Fix tidy

parent f079b678
......@@ -49,7 +49,7 @@ static literal get_scalar(instruction_ref ins)
if(ins->name() == "contiguous")
return get_scalar(ins->inputs().front());
const auto& s = ins->get_shape();
if(s.elements() != 1 && not(s.scalar()))
if(s.elements() != 1 and not(s.scalar()))
return {};
if(not ins->can_eval())
return {};
......@@ -97,10 +97,10 @@ Step 3:
Create modules using information collected in step 2 and insert run_on_target instructions.
*/
struct AutoGenRootModules
struct auto_gen_root_modules
{
AutoGenRootModules(migraphx::program& p, const target_assignments& target_assignments)
auto_gen_root_modules(migraphx::program& p, const target_assignments& target_assignments)
: tass(target_assignments)
{
auto* mm = p.get_main_module();
......@@ -182,7 +182,7 @@ struct AutoGenRootModules
std::unordered_set<instruction_ref> same_tid_ins_set_copy = {};
std::swap(same_tid_ins_set_copy, same_tid_ins_set);
std::swap(same_tid_ins_vec_copy, same_tid_ins_vec);
for(auto sub_mod : ins->module_inputs())
for(auto* sub_mod : ins->module_inputs())
{
find_subgraphs(sub_mod, p);
}
......@@ -344,7 +344,7 @@ struct AutoGenRootModules
void generate_root_modules(migraphx::program& p, const target_assignments& tass)
{
AutoGenRootModules(p, tass);
auto_gen_root_modules(p, tass);
}
} // namespace MIGRAPHX_INLINE_NS
......
......@@ -43,7 +43,6 @@
#include <iostream>
#include <queue>
#include <queue>
#include <sstream>
#include <algorithm>
#include <set>
......@@ -180,23 +179,24 @@ It does it by first finding subgraphs supported on a given target based on assig
It is possible that instructions have multiple target assignments and part of multiple subgraphs.
Current logic is simple and assigns entire subgraph containing supported instruction to a particular
target on first seen basis and doesn't find the "best" target assignment.
Assumes that all instructions will have target_assignment after this.
Assumes that all relevant (compute and reshaper) instructions will have target_assignment after
this.
*/
target_assignments program::get_target_assignments(const std::vector<target>& targets,
assignment_options options)
{
const auto m = options.metric;
const auto metric = options.metric;
target_assignments p;
const auto* mod = get_main_module();
const auto* mm = get_main_module();
std::vector<std::pair<std::size_t, supported_segments>> target_subgraphs;
target_subgraphs.reserve(targets.size());
for(auto tid : range(targets.size()))
{
target_subgraphs.push_back(std::make_pair(tid, targets[tid].find_supported(mod, m)));
}
for(const auto ins : iterator_for(*mod))
auto tr = range(targets.size());
std::transform(tr.begin(), tr.end(), std::back_inserter(target_subgraphs), [&](auto tid) {
return std::make_pair(tid, targets[tid].find_supported(mm, metric));
});
for(const auto ins : iterator_for(*mm))
{
if(contains(p, ins))
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment