#include "pass/ConstantLoweringPass.h"
#include "pass/PermutationOperationPass.h"
#include "pass/PermutationInsertionPass.h"
+#include "pass/PermutationEliminationPass.h"
#include "ir/GraphIterator.h"
#include "verifier/Verifier.h"
#include "backend/Backend.h"
pass::PermutationInsertionPass pi_pass(*this);
pi_pass.run();
- // Implemented code no longer works.
- // pass::PermutationEliminationPass pe_pass(*this);
- // pe_pass.run();
+
+ pass::PermutationEliminationPass pe_pass(*this);
+ pe_pass.run();
_op_seqs.dump("merged and sorted operations with permutation", _graph.operations());
}
const auto lower_info = getLowerInfo(index);
const auto &shape = object.shape();
- std::string def_ops = operation_index_to_string(object.getDef());
+ std::string def_ops =
+ object.getDef().valid() ? std::to_string(object.getDef().value()) : "N/A";
std::string use_ops = operation_index_to_string(object.getUses());
std::string def_layouts = factors_to_string(lower_info->def_factors());
std::string use_layouts = factors_to_string(lower_info->use_factors());
for (const auto &input : op_seq.getInputs() | Remove::DUPLICATED | ir::Remove::UNDEFINED)
{
const auto &input_obj = _graph.operands().at(input);
- for (const auto &def : input_obj.getDef())
+ auto def = input_obj.getDef();
+ if (def.valid())
{
branched_set.insert(def);
if (branched_set.size() > 1)
// Check for branching down
for (const auto &output : node.getOutputs() | Remove::DUPLICATED)
{
+ // TODO Fix this workaround for the case of model outputs that are used by another operation
+ // This is needed since the branching is decided by operation, but for model outputs,
+ // there is controlflow backen(use backend) but no actual use operation exists
+ if (_graph.getOutputs().contains(output))
+ return false;
+
const auto &output_obj = _graph.operands().at(output);
for (const auto &use : output_obj.getUses())
{