diff options
author | Tuowen Zhao <ztuowen@gmail.com> | 2016-09-26 15:18:38 -0600 |
---|---|---|
committer | Tuowen Zhao <ztuowen@gmail.com> | 2016-09-26 15:18:38 -0600 |
commit | 15e8ff480e7a75f4dce8c8d41da157cf51bd3cb8 (patch) | |
tree | 9bbdc313f0614689e9276ed615dd780f1faccfd6 | |
parent | f4474891acec5918f94bc126fed8eb9bb2792912 (diff) | |
download | chill-15e8ff480e7a75f4dce8c8d41da157cf51bd3cb8.tar.gz chill-15e8ff480e7a75f4dce8c8d41da157cf51bd3cb8.tar.bz2 chill-15e8ff480e7a75f4dce8c8d41da157cf51bd3cb8.zip |
namespaced error
-rw-r--r-- | include/chill_error.hh | 35 | ||||
-rw-r--r-- | src/dep.cc | 2 | ||||
-rwxr-xr-x | src/ir_clang.cc | 24 | ||||
-rw-r--r-- | src/omegatools.cc | 14 | ||||
-rw-r--r-- | src/transformations/loop.cc | 68 | ||||
-rw-r--r-- | src/transformations/loop_basic.cc | 58 | ||||
-rw-r--r-- | src/transformations/loop_datacopy.cc | 16 | ||||
-rw-r--r-- | src/transformations/loop_extra.cc | 4 | ||||
-rw-r--r-- | src/transformations/loop_tile.cc | 20 | ||||
-rw-r--r-- | src/transformations/loop_unroll.cc | 18 |
10 files changed, 131 insertions, 128 deletions
diff --git a/include/chill_error.hh b/include/chill_error.hh index 7321e75..20a8362 100644 --- a/include/chill_error.hh +++ b/include/chill_error.hh @@ -6,23 +6,26 @@ * \brief CHiLL runtime exceptions */ -//! for loop transformation problem -struct loop_error : public std::runtime_error { - loop_error(const std::string &msg) : std::runtime_error(msg) {} -}; +namespace chill { + namespace error { + //! for loop transformation problem + struct loop : public std::runtime_error { + loop(const std::string &msg) : std::runtime_error(msg) {} + }; -//! for generic compiler intermediate code handling problem -struct ir_error : public std::runtime_error { - ir_error(const std::string &msg) : std::runtime_error(msg) {} -}; + //! for generic compiler intermediate code handling problem + struct ir : public std::runtime_error { + ir(const std::string &msg) : std::runtime_error(msg) {} + }; -//! for specific for expression to preburger math translation problem -struct ir_exp_error : public ir_error { - ir_exp_error(const std::string &msg) : ir_error(msg) {} -}; - -struct omega_error : public std::runtime_error { - omega_error(const std::string &msg) : std::runtime_error(msg) {} -}; + //! for specific for expression to preburger math translation problem + struct ir_exp : public ir { + ir_exp(const std::string &msg) : ir(msg) {} + }; + struct omega : public std::runtime_error { + omega(const std::string &msg) : std::runtime_error(msg) {} + }; + } +} #endif @@ -381,7 +381,7 @@ std::vector<DependenceVector> DependenceVector::permute( } if (((violated == 1) && !quasi) && !is_scalar_dependence) { - throw ir_error("dependence violation"); + throw chill::error::ir("dependence violation"); } diff --git a/src/ir_clang.cc b/src/ir_clang.cc index e0699a5..da20d3c 100755 --- a/src/ir_clang.cc +++ b/src/ir_clang.cc @@ -1432,7 +1432,7 @@ int IR_chillArraySymbol::elem_size() const { //if(at) { // return (vd_->getASTContext().getTypeSize(at->getElementType())) / 8; //} else - // throw ir_error("Symbol is not an array!"); + // throw chill::error::ir("Symbol is not an array!"); //return 0; } @@ -1514,7 +1514,7 @@ omega::CG_outputRepr *IR_chillConstantRef::convert() { return result; */ } else - throw ir_error("constant type not supported"); + throw chill::error::ir("constant type not supported"); } @@ -1524,7 +1524,7 @@ IR_Ref *IR_chillConstantRef::clone() const { else if (type_ == IR_CONSTANT_FLOAT) return new IR_chillConstantRef(ir_, f_); else - throw ir_error("constant type not supported"); + throw chill::error::ir("constant type not supported"); } // ---------------------------------------------------------------------------- @@ -2537,7 +2537,7 @@ std::vector<IR_ArrayRef *> IR_clangCode::FindArrayRef(const omega::CG_outputRepr std::vector<IR_ArrayRef *> a = FindArrayRef(r); delete r; std::copy(a.begin(), a.end(), back_inserter(arrays)); - } else throw ir_error("control structure not supported"); + } else throw chill::error::ir("control structure not supported"); } */ /* @@ -2558,7 +2558,7 @@ std::vector<IR_ArrayRef *> IR_clangCode::FindArrayRef(const omega::CG_outputRepr std::vector<IR_ArrayRef *> a1 = FindArrayRef(r1); delete r1; std::copy(a1.begin(), a1.end(), back_inserter(arrays)); - } //else throw ir_error("Invalid expr. type passed to FindArrayRef"); + } //else throw chill::error::ir("Invalid expr. type passed to FindArrayRef"); } */ return arrays; @@ -2721,7 +2721,7 @@ IR_Block *IR_clangCode::MergeNeighboringControlStructures(const std::vector<IR_C parent = loop->parent; } else { if (parent != loop->parent) { - throw ir_error("controls to merge not at the same level"); + throw chill::error::ir("controls to merge not at the same level"); } } CBlock->addStatement(loop); @@ -2736,7 +2736,7 @@ IR_Block *IR_clangCode::MergeNeighboringControlStructures(const std::vector<IR_C parent = blockstmts[j]->parent; } else { if (parent != blockstmts[j]->parent) { - throw ir_error( + throw chill::error::ir( "ir_clang.cc IR_clangCode::MergeNeighboringControlStructures controls to merge not at the same level"); } } @@ -2745,7 +2745,7 @@ IR_Block *IR_clangCode::MergeNeighboringControlStructures(const std::vector<IR_C break; } default: - throw ir_error("unrecognized control to merge"); + throw chill::error::ir("unrecognized control to merge"); } } // for each control @@ -2912,7 +2912,7 @@ void IR_clangCode::ReplaceCode(IR_Control *old, omega::CG_outputRepr *repr) { //tf_old = static_cast<IR_chillBlock *>(old)->getStmtList()[0]; break; default: - throw ir_error("control structure to be replaced not supported"); + throw chill::error::ir("control structure to be replaced not supported"); break; } @@ -3150,7 +3150,7 @@ Expr *op1, *op2; v.push_back(repr); break; default: - throw ir_error("operation not supported"); + throw chill::error::ir("operation not supported"); } */ //} else if(UnaryOperator *uop = dyn_cast<UnaryOperator>(e)) { @@ -3166,14 +3166,14 @@ Expr *op1, *op2; v.push_back(repr); break; default: - throw ir_error("operation not supported"); + throw chill::error::ir("operation not supported"); } */ //} else if(ConditionalOperator *cop = dyn_cast<ConditionalOperator>(e)) { //omega::CG_chillRepr *repr; // TODO: Handle conditional operator here - //} else throw ir_error("operand type UNsupported"); + //} else throw chill::error::ir("operand type UNsupported"); return v; } diff --git a/src/omegatools.cc b/src/omegatools.cc index 07b12f5..6d54591 100644 --- a/src/omegatools.cc +++ b/src/omegatools.cc @@ -81,7 +81,7 @@ void exp2formula(IR_Code *ir, std::vector<CG_outputRepr *> v = ir->QueryExpOperand(repr); IR_ConstantRef *ref = static_cast<IR_ConstantRef *>(ir->Repr2Ref(v[0])); if (!ref->is_integer()) - throw ir_exp_error("non-integer constant coefficient"); + throw chill::error::ir_exp("non-integer constant coefficient"); coef_t c = ref->integer(); if (rel == IR_COND_GE || rel == IR_COND_GT) { @@ -285,7 +285,7 @@ void exp2formula(IR_Code *ir, delete ref; term = v[0]; } else - throw ir_exp_error("not presburger expression"); + throw chill::error::ir_exp("not presburger expression"); F_Exists *f_exists = f_root->add_exists(); Variable_ID e = f_exists->declare(tmp_e()); @@ -818,7 +818,7 @@ void exp2formula(IR_Code *ir, default: - throw ir_exp_error("unsupported operand type"); + throw chill::error::ir_exp("unsupported operand type"); } } @@ -910,7 +910,7 @@ Relation arrays2relation(IR_Code *ir, std::vector<Free_Var_Decl *> &freevars, exp2formula(ir, r, f_and, freevars, repr_dst, e2, 'r', IR_COND_EQ, false, uninterpreted_symbols, uninterpreted_symbols_stringrepr); } - catch (const ir_exp_error &e) { + catch (const chill::error::ir_exp &e) { has_complex_formula = true; } @@ -1332,7 +1332,7 @@ void exp2constraint(IR_Code *ir, Relation &r, F_And *f_root, break; } default: - throw ir_exp_error("unrecognized conditional expression"); + throw chill::error::ir_exp("unrecognized conditional expression"); } } @@ -2336,7 +2336,7 @@ Relation replace_set_var_as_another_set_var(const omega::Relation &new_relation, h.update_coef(r.input_var(new_pos), cvi.curr_coef()); else - throw omega_error( + throw chill::error::omega( "relation contains set vars other than that to be replicated!"); break; @@ -3043,7 +3043,7 @@ CG_outputRepr *construct_int_floor(CG_outputBuilder *ocg, const Relation &R, }; if (!result.first) { delete repr; - throw omega_error( + throw chill::error::omega( "Can't generate bound expression with wildcard not involved in floor definition"); } diff --git a/src/transformations/loop.cc b/src/transformations/loop.cc index 10dc7bb..d34f415 100644 --- a/src/transformations/loop.cc +++ b/src/transformations/loop.cc @@ -501,7 +501,7 @@ bool Loop::init_loop(std::vector<ir_tree_node *> &ir_tree, exp2formula(ir, r, f_root, freevar, ub, v, 's', cond, true, uninterpreted_symbols[i], uninterpreted_symbols_stringrepr[i]); else - throw ir_error("loop condition not supported"); + throw chill::error::ir("loop condition not supported"); if ((ir->QueryExpOperation(lp->lower_bound()) @@ -550,12 +550,12 @@ bool Loop::init_loop(std::vector<ir_tree_node *> &ir_tree, exp2formula(ir, r, f_root, freevar, ub, v, 's', IR_COND_LT, true, uninterpreted_symbols[i], uninterpreted_symbols_stringrepr[i]); else - throw ir_error("loop condition not supported"); + throw chill::error::ir("loop condition not supported"); vars_to_be_reversed.push_back(lp->index()->name()); } else - throw ir_error("loop step size zero"); - } catch (const ir_error &e) { + throw chill::error::ir("loop step size zero"); + } catch (const chill::error::ir &e) { actual_code[loc] = static_cast<IR_Block *>(ir_stmt[loc]->content)->extract(); for (int i = 0; i < itn->children.size(); i++) @@ -604,7 +604,7 @@ bool Loop::init_loop(std::vector<ir_tree_node *> &ir_tree, exp2constraint(ir, r, f_and, freevar, cond, true, uninterpreted_symbols[i], uninterpreted_symbols_stringrepr[i]); } - } catch (const ir_error &e) { + } catch (const chill::error::ir&e) { std::vector<ir_tree_node *> *t; if (itn->parent == NULL) t = &ir_tree; @@ -1104,17 +1104,17 @@ int Loop::get_dep_dim_of(int stmt_num, int level) const { if (level < 1) return -1; if (level > stmt[stmt_num].loop_level.size()) - throw loop_error("incorrect loop level information for statement " + throw chill::error::loop("incorrect loop level information for statement " + to_string(stmt_num)); break; default: - throw loop_error( + throw chill::error::loop( "unknown loop level information for statement " + to_string(stmt_num)); } trip_count++; if (trip_count >= stmt[stmt_num].loop_level.size()) - throw loop_error( + throw chill::error::loop( "incorrect loop level information for statement " + to_string(stmt_num)); } @@ -1406,7 +1406,7 @@ int Loop::getLexicalOrder(int stmt_num, int level) const { } } - throw loop_error( + throw chill::error::loop( "can't find lexical order for statement " + to_string(stmt_num) + "'s loop level " + to_string(level)); } @@ -1579,7 +1579,7 @@ void update_successors(int n, int m = i->first; if (node_num[m] != -1) - throw loop_error("Graph input for fusion has cycles not a DAG!!"); + throw chill::error::loop("Graph input for fusion has cycles not a DAG!!"); std::vector<bool> check_ = g.getEdge(n, m); @@ -1690,7 +1690,7 @@ Graph<std::set<int>, bool> Loop::construct_induced_graph_at_level( && dvs[k].has_been_carried_at(dep_dim))) { if (is_connected_i_to_j || has_true_edge_i_to_j) - throw loop_error( + throw chill::error::loop( "Graph input for fusion has cycles not a DAG!!"); if (dvs[k].is_data_dependence() @@ -1784,7 +1784,7 @@ std::vector<std::set<int> > Loop::typed_fusion(Graph<std::set<int>, bool> g, if (work_list.empty() || (s2.size() != g.vertex.size())) { std::cout << s2.size() << "\t" << g.vertex.size() << std::endl; - throw loop_error("Input for fusion not a DAG!!"); + throw chill::error::loop("Input for fusion not a DAG!!"); } @@ -1816,9 +1816,9 @@ std::vector<std::set<int> > Loop::typed_fusion(Graph<std::set<int>, bool> g, try { update_successors(n, node_num, cant_fuse_with, g, work_list, type_list, types); - } catch (const loop_error &e) { + } catch (const chill::error::loop&e) { - throw loop_error( + throw chill::error::loop( "statements cannot be fused together due to negative dependence"); } @@ -1845,9 +1845,9 @@ std::vector<std::set<int> > Loop::typed_fusion(Graph<std::set<int>, bool> g, try { update_successors(n, node_num, cant_fuse_with, g, work_list, type_list, types); - } catch (const loop_error &e) { + } catch (const chill::error::loop&e) { - throw loop_error( + throw chill::error::loop( "statements cannot be fused together due to negative dependence"); } @@ -1863,9 +1863,9 @@ std::vector<std::set<int> > Loop::typed_fusion(Graph<std::set<int>, bool> g, try { update_successors(n, node_num, cant_fuse_with, g, work_list, type_list, types); - } catch (const loop_error &e) { + } catch (const chill::error::loop&e) { - throw loop_error( + throw chill::error::loop( "statements cannot be fused together due to negative dependence"); } @@ -2030,7 +2030,7 @@ void Loop::setLexicalOrder(int dim, const std::set<int> &active, std::vector<std::set<int> > s = g.topoSort(); if (s.size() != g.vertex.size()) - throw loop_error( + throw chill::error::loop( "cannot separate statements with different loop types at loop level " + to_string(level)); @@ -2973,7 +2973,7 @@ void Loop::scalar_expand(int stmt_num, const std::vector<int> &levels, break; } default: - throw loop_error("unsupported array index expression"); + throw chill::error::loop("unsupported array index expression"); } } if ((*ei).get_const() != 0) @@ -3026,7 +3026,7 @@ void Loop::scalar_expand(int stmt_num, const std::vector<int> &levels, ub_list.push_back(*gi); } if (lb_list.size() == 0 || ub_list.size() == 0) - throw loop_error("failed to calcuate array footprint size"); + throw chill::error::loop("failed to calcuate array footprint size"); // build lower bound representation std::vector<CG_outputRepr *> lb_repr_list; @@ -3069,7 +3069,7 @@ void Loop::scalar_expand(int stmt_num, const std::vector<int> &levels, break; } default: - throw loop_error( + throw chill::error::loop( "cannot calculate temporay array size statically"); } } @@ -3093,7 +3093,7 @@ void Loop::scalar_expand(int stmt_num, const std::vector<int> &levels, break; } default: - throw loop_error( + throw chill::error::loop( "cannot calculate temporay array size statically"); } } @@ -3201,7 +3201,7 @@ void Loop::scalar_expand(int stmt_num, const std::vector<int> &levels, break; } default: - throw loop_error( + throw chill::error::loop( "failed to generate array index bound code"); } } @@ -3625,7 +3625,7 @@ void Loop::scalar_expand(int stmt_num, const std::vector<int> &levels, CG_outputRepr *temp = tmp_array_ref->convert()->clone(); if (ir->QueryExpOperation(stmt[stmt_num].code) != IR_OP_PLUS_ASSIGNMENT) - throw ir_error( + throw chill::error::ir( "Statement is not a += accumulation statement"); fprintf(stderr, "replacing in a +=\n"); @@ -3723,7 +3723,7 @@ void Loop::scalar_expand(int stmt_num, const std::vector<int> &levels, CG_outputRepr *temp = tmp_ptr_array_ref->convert()->clone(); if (ir->QueryExpOperation(stmt[stmt_num].code) != IR_OP_PLUS_ASSIGNMENT) - throw ir_error( + throw chill::error::ir( "Statement is not a += accumulation statement"); stmt[newStmt_num].code = ir->builder()->CreatePlusAssignment(0, temp->clone(), rhs); @@ -4056,7 +4056,7 @@ std::set<std::string> inspect_loop_bounds(IR_Code *ir, const Relation &R, std::map<std::string, std::vector<omega::CG_outputRepr *> > &uninterpreted_symbols) { if (!R.is_set()) - throw loop_error("Input R has to be a set not a relation!"); + throw chill::error::loop("Input R has to be a set not a relation!"); std::set<std::string> vars; @@ -4108,7 +4108,7 @@ CG_outputRepr *create_counting_loop_body(IR_Code *ir, const Relation &R, std::map<std::string, std::vector<omega::CG_outputRepr *> > &uninterpreted_symbols) { if (!R.is_set()) - throw loop_error("Input R has to be a set not a relation!"); + throw chill::error::loop("Input R has to be a set not a relation!"); CG_outputRepr *ub, *lb; ub = NULL; @@ -4133,7 +4133,7 @@ CG_outputRepr *create_counting_loop_body(IR_Code *ir, const Relation &R, if ((*gi).get_coef(v) > 0) { if (ub != NULL) - throw ir_error( + throw chill::error::ir( "bound expression too complex!"); ub = ir->builder()->CreateInvoke(s, @@ -4143,7 +4143,7 @@ CG_outputRepr *create_counting_loop_body(IR_Code *ir, const Relation &R, } else { if (lb != NULL) - throw ir_error( + throw chill::error::ir( "bound expression too complex!"); lb = ir->builder()->CreateInvoke(s, uninterpreted_symbols.find(s)->second); @@ -4191,7 +4191,7 @@ std::map<std::string, std::vector<std::string> > recurse_on_exp_for_arrays( IR_PointerArrayRef *ref_ = dynamic_cast<IR_PointerArrayRef *>(ir->Repr2Ref(exp)); if (ref == NULL && ref_ == NULL) - throw loop_error("Array symbol unidentifiable!"); + throw chill::error::loop("Array symbol unidentifiable!"); if (ref != NULL) { std::vector<std::string> s0; @@ -4204,7 +4204,7 @@ std::map<std::string, std::vector<std::string> > recurse_on_exp_for_arrays( for (std::map<std::string, std::vector<std::string> >::iterator j = a0.begin(); j != a0.end(); j++) { if (j->second.size() != 1 && (j->second)[0] != "") - throw loop_error( + throw chill::error::loop( "indirect array references not allowed in guard!"); s.push_back(j->first); } @@ -4223,7 +4223,7 @@ std::map<std::string, std::vector<std::string> > recurse_on_exp_for_arrays( for (std::map<std::string, std::vector<std::string> >::iterator j = a0.begin(); j != a0.end(); j++) { if (j->second.size() != 1 && (j->second)[0] != "") - throw loop_error( + throw chill::error::loop( "indirect array references not allowed in guard!"); s.push_back(j->first); } @@ -4404,7 +4404,7 @@ std::vector<std::string> construct_iteration_order( if (s == arrays[k]) found = true; if (!found) - throw loop_error("guard condition not solvable"); + throw chill::error::loop("guard condition not solvable"); } } else { bool found = false; diff --git a/src/transformations/loop_basic.cc b/src/transformations/loop_basic.cc index 1be0981..1afb9be 100644 --- a/src/transformations/loop_basic.cc +++ b/src/transformations/loop_basic.cc @@ -115,7 +115,7 @@ void Loop::permute(int stmt_num, int level, const std::vector<int> &pi) { if (min_dep_dim > max_dep_dim) return; if (max_dep_dim - min_dep_dim + 1 != t.size()) - throw loop_error("cannot update the dependence graph after permuation"); + throw chill::error::loop("cannot update the dependence graph after permuation"); std::vector<int> dep_pi(dep.num_dim()); for (int i = 0; i < min_dep_dim; i++) dep_pi[i] = i; @@ -157,7 +157,7 @@ void Loop::permute(int stmt_num, int level, const std::vector<int> &pi) { break; } default: - throw loop_error("unknown dependence type"); + throw chill::error::loop("unknown dependence type"); } } g.connect(i, j->first, dv); @@ -183,7 +183,7 @@ void Loop::permute(int stmt_num, int level, const std::vector<int> &pi) { case DEP_CONTROL: break; default: - throw loop_error("unknown dependence type"); + throw chill::error::loop("unknown dependence type"); } g.connect(i, j->first, dv); } @@ -217,7 +217,7 @@ void Loop::permute(int stmt_num, int level, const std::vector<int> &pi) { break; } default: - throw loop_error( + throw chill::error::loop( "unknown loop level information for statement " + to_string(*i)); } @@ -243,7 +243,7 @@ void Loop::permute(int stmt_num, int level, const std::vector<int> &pi) { break; } default: - throw loop_error( + throw chill::error::loop( "unknown loop level information for statement " + to_string(*i)); } @@ -351,7 +351,7 @@ void Loop::permute(const std::set<int> &active, const std::vector<int> &pi) { if (min_dep_dim > max_dep_dim) return; if (max_dep_dim - min_dep_dim + 1 != t.size()) - throw loop_error("cannot update the dependence graph after permuation"); + throw chill::error::loop("cannot update the dependence graph after permuation"); std::vector<int> dep_pi(num_dep_dim); for (int i = 0; i < min_dep_dim; i++) dep_pi[i] = i; @@ -393,7 +393,7 @@ void Loop::permute(const std::set<int> &active, const std::vector<int> &pi) { break; } default: - throw loop_error("unknown dependence type"); + throw chill::error::loop("unknown dependence type"); } } g.connect(i, j->first, dv); @@ -419,7 +419,7 @@ void Loop::permute(const std::set<int> &active, const std::vector<int> &pi) { case DEP_CONTROL: break; default: - throw loop_error("unknown dependence type"); + throw chill::error::loop("unknown dependence type"); } g.connect(i, j->first, dv); } @@ -452,7 +452,7 @@ void Loop::permute(const std::set<int> &active, const std::vector<int> &pi) { break; } default: - throw loop_error( + throw chill::error::loop( "unknown loop level information for statement " + to_string(*i)); } @@ -478,7 +478,7 @@ void Loop::permute(const std::set<int> &active, const std::vector<int> &pi) { break; } default: - throw loop_error( + throw chill::error::loop( "unknown loop level information for statement " + to_string(*i)); } @@ -605,7 +605,7 @@ std::set<int> Loop::split(int stmt_num, int level, const Relation &cond) { if (dv.type != DEP_CONTROL) if (dv.hasNegative(dimension) && !dv.quasi) - throw loop_error( + throw chill::error::loop( "loop error: Split is illegal, dependence violation!"); } @@ -662,7 +662,7 @@ std::set<int> Loop::split(int stmt_num, int level, const Relation &cond) { if (dv.hasNegative(dimension) && !dv.quasi) - throw loop_error( + throw chill::error::loop( "loop error: Split is illegal, dependence violation!"); } @@ -723,7 +723,7 @@ std::set<int> Loop::split(int stmt_num, int level, const Relation &cond) { if (dv.hasNegative(dimension) && !dv.quasi) - throw loop_error( + throw chill::error::loop( "loop error: Split is illegal, dependence violation!"); } @@ -777,7 +777,7 @@ std::set<int> Loop::split(int stmt_num, int level, const Relation &cond) { if (dv.hasNegative(dimension) && !dv.quasi) - throw loop_error( + throw chill::error::loop( "loop error: Split is illegal, dependence violation!"); } @@ -1030,7 +1030,7 @@ void Loop::skew(const std::set<int> &stmt_nums, int level, if ((dv.isCarried(dep_dim) && dv.hasNegative(dep_dim)) && !dv.quasi) - throw loop_error( + throw chill::error::loop( "loop error: Skewing is illegal, dependence violation!"); dv.lbounds[dep_dim] = lb; dv.ubounds[dep_dim] = ub; @@ -1040,7 +1040,7 @@ void Loop::skew(const std::set<int> &stmt_nums, int level, if ((dv.isCarried(dep_dim) && dv.hasNegative(dep_dim)) && !dv.quasi) - throw loop_error( + throw chill::error::loop( "loop error: Skewing is illegal, dependence violation!"); } } @@ -1256,7 +1256,7 @@ void Loop::fuse(const std::set<int> &stmt_nums, int level) { for (int k = 0; k < dvs.size(); k++) if (dvs[k].isCarried(dep_dim) && dvs[k].hasNegative(dep_dim)) - throw loop_error( + throw chill::error::loop( "loop error: statements " + to_string(*ii) + " and " + to_string(*jj) + " cannot be fused together due to negative dependence"); @@ -1264,7 +1264,7 @@ void Loop::fuse(const std::set<int> &stmt_nums, int level) { for (int k = 0; k < dvs.size(); k++) if (dvs[k].isCarried(dep_dim) && dvs[k].hasNegative(dep_dim)) - throw loop_error( + throw chill::error::loop( "loop error: statements " + to_string(*jj) + " and " + to_string(*ii) + " cannot be fused together due to negative dependence"); @@ -1300,9 +1300,9 @@ void Loop::fuse(const std::set<int> &stmt_nums, int level) { dep_dim); std::cout << g; s = typed_fusion(g, s2); - } catch (const loop_error &e) { + } catch (const chill::error::loop&e) { - throw loop_error( + throw chill::error::loop( "statements cannot be fused together due to negative dependence"); } @@ -1359,9 +1359,9 @@ void Loop::fuse(const std::set<int> &stmt_nums, int level) { dep_dim); std::cout<< g; s = typed_fusion(g); - } catch (const loop_error &e) { + } catch (const chill::error::loop&e) { - throw loop_error( + throw chill::error::loop( "statements cannot be fused together due to negative dependence"); } @@ -1417,7 +1417,7 @@ void Loop::fuse(const std::set<int> &stmt_nums, int level) { } } else - throw loop_error("Typed Fusion Error"); + throw chill::error::loop("Typed Fusion Error"); */ } @@ -1518,7 +1518,7 @@ void Loop::distribute(const std::set<int> &stmt_nums, int level) { std::vector<std::set<int> > s2 = g2.topoSort(); // nothing to distribute if (s2.size() == 1) - throw loop_error( + throw chill::error::loop( "loop error: no statement can be distributed due to dependence cycle"); std::vector<std::set<int> > s3; for (int i = 0; i < s2.size(); i++) { @@ -1603,7 +1603,7 @@ std::vector<std::vector<std::string> > constructInspectorVariables(IR_Code *ir, CG_outputRepr *subscript = (*i)->index(0); if ((*i)->n_dim() > 1) - throw ir_error( + throw chill::error::ir( "multi-dimensional array support non-existent for flattening currently"); while (ir->QueryExpOperation(subscript) == IR_OP_ARRAY_VARIABLE) { @@ -1627,7 +1627,7 @@ std::vector<std::vector<std::string> > constructInspectorVariables(IR_Code *ir, break; if (j == index.size()) - throw ir_error("Non index variable in array expression"); + throw chill::error::ir("Non index variable in array expression"); int k; for (k = 0; k < to_return.size(); k++) @@ -1758,7 +1758,7 @@ void Loop::normalize(int stmt_num, int loop_level) { Relation bound = get_loop_bound(r, loop_level, this->known); if (!bound.has_single_conjunct() || !bound.is_satisfiable() || bound.is_tautology()) - throw loop_error("unable to extract loop bound for normalize"); + throw chill::error::loop("unable to extract loop bound for normalize"); // extract the loop stride coef_t stride; @@ -1772,7 +1772,7 @@ void Loop::normalize(int stmt_num, int loop_level) { abs(result.first.get_coef(bound.set_var(loop_level)))); if (stride != 1) - throw loop_error( + throw chill::error::loop( "normalize currently only handles unit stride, non unit stride present in loop bounds"); GEQ_Handle lb; @@ -1831,7 +1831,7 @@ void Loop::normalize(int stmt_num, int loop_level) { } } else - throw loop_error("loop bounds too complex for normalize!"); + throw chill::error::loop("loop bounds too complex for normalize!"); } diff --git a/src/transformations/loop_datacopy.cc b/src/transformations/loop_datacopy.cc index 69fbd5b..c14e838 100644 --- a/src/transformations/loop_datacopy.cc +++ b/src/transformations/loop_datacopy.cc @@ -329,7 +329,7 @@ bool Loop::datacopy_privatized(const std::vector<std::pair<int, std::vector<IR_A fastest_changing_dimension = 0; break; default: - throw loop_error("unsupported array layout"); + throw chill::error::loop("unsupported array layout"); } // OK, parameter sanity checked @@ -579,7 +579,7 @@ bool Loop::datacopy_privatized(const std::vector<std::pair<int, std::vector<IR_A break; } default: - throw loop_error("unsupported array index expression"); + throw chill::error::loop("unsupported array index expression"); } } if ((*ei).get_const() != 0) @@ -620,7 +620,7 @@ bool Loop::datacopy_privatized(const std::vector<std::pair<int, std::vector<IR_A ub_list.push_back(*gi); } if (lb_list.size() == 0 || ub_list.size() == 0) - throw loop_error("failed to calcuate array footprint size"); + throw chill::error::loop("failed to calcuate array footprint size"); //fprintf(stderr, "dp3: build lower bound representation\n"); // build lower bound representation @@ -687,7 +687,7 @@ bool Loop::datacopy_privatized(const std::vector<std::pair<int, std::vector<IR_A break; } default: - throw loop_error("cannot calculate temporay array size statically"); + throw chill::error::loop("cannot calculate temporay array size statically"); } } h.update_const(ub_list[j].get_const()); @@ -710,7 +710,7 @@ bool Loop::datacopy_privatized(const std::vector<std::pair<int, std::vector<IR_A break; } default: - throw loop_error("cannot calculate temporay array size statically"); + throw chill::error::loop("cannot calculate temporay array size statically"); } } h.update_const(lb_list[k].get_const()); @@ -774,7 +774,7 @@ bool Loop::datacopy_privatized(const std::vector<std::pair<int, std::vector<IR_A break; } default: - throw loop_error("failed to generate array index bound code"); + throw chill::error::loop("failed to generate array index bound code"); } } } @@ -818,7 +818,7 @@ bool Loop::datacopy_privatized(const std::vector<std::pair<int, std::vector<IR_A std::swap(index_sz[0], index_sz[i]); break; default: - throw loop_error("unsupported array layout"); + throw chill::error::loop("unsupported array layout"); } } @@ -1007,7 +1007,7 @@ bool Loop::datacopy_privatized(const std::vector<std::pair<int, std::vector<IR_A break; } default: - throw loop_error("unsupported array layout"); + throw chill::error::loop("unsupported array layout"); } cur_index++; } diff --git a/src/transformations/loop_extra.cc b/src/transformations/loop_extra.cc index ee54815..216f586 100644 --- a/src/transformations/loop_extra.cc +++ b/src/transformations/loop_extra.cc @@ -120,7 +120,7 @@ void Loop::peel(int stmt_num, int level, int peel_amount) { } } if (!found_bound) - throw loop_error("can't find lower bound for peeling at loop level " + to_string(level)); + throw chill::error::loop("can't find lower bound for peeling at loop level " + to_string(level)); for (int i = 1; i <= peel_amount; i++) { Relation r(level); @@ -183,7 +183,7 @@ void Loop::peel(int stmt_num, int level, int peel_amount) { } } if (!found_bound) - throw loop_error("can't find upper bound for peeling at loop level " + to_string(level)); + throw chill::error::loop("can't find upper bound for peeling at loop level " + to_string(level)); for (int i = 1; i <= -peel_amount; i++) { Relation r(level); diff --git a/src/transformations/loop_tile.cc b/src/transformations/loop_tile.cc index 0a1808b..7281462 100644 --- a/src/transformations/loop_tile.cc +++ b/src/transformations/loop_tile.cc @@ -70,7 +70,7 @@ void Loop::tile(int stmt_num, int level, int tile_size, int outer_level, stmt[*i].loop_level[l - 1].payload) && dv.hasPositive( stmt[*i].loop_level[l - 1].payload)) - throw loop_error( + throw chill::error::loop( "loop error: Tiling is illegal, dependence violation!"); } else { @@ -87,7 +87,7 @@ void Loop::tile(int stmt_num, int level, int tile_size, int outer_level, if (dim3 < level - 1) if (dv.isCarried(dim3) && dv.hasPositive(dim3)) - throw loop_error( + throw chill::error::loop( "loop error: Tiling is illegal, dependence violation!"); } } @@ -167,7 +167,7 @@ void Loop::tile(int stmt_num, int level, int tile_size, int outer_level, } if (!bound.has_single_conjunct()) - throw loop_error("cannot handle tile bounds"); + throw chill::error::loop("cannot handle tile bounds"); } // separate lower and upper bounds @@ -183,10 +183,10 @@ void Loop::tile(int stmt_num, int level, int tile_size, int outer_level, } } if (lb_list.size() == 0) - throw loop_error( + throw chill::error::loop( "unable to calculate tile controlling loop lower bound"); if (ub_list.size() == 0) - throw loop_error( + throw chill::error::loop( "unable to calculate tile controlling loop upper bound"); // find the simplest lower bound for StridedTile or simplest iteration count for CountedTile @@ -352,7 +352,7 @@ void Loop::tile(int stmt_num, int level, int tile_size, int outer_level, break; } default: - throw loop_error("cannot handle tile bounds"); + throw chill::error::loop("cannot handle tile bounds"); } } h.update_const(lb_list[simplest_lb].get_const()); @@ -387,7 +387,7 @@ void Loop::tile(int stmt_num, int level, int tile_size, int outer_level, break; } default: - throw loop_error("cannot handle tile bounds"); + throw chill::error::loop("cannot handle tile bounds"); } } h1.update_const(lb_list[simplest_lb].get_const()); @@ -455,7 +455,7 @@ void Loop::tile(int stmt_num, int level, int tile_size, int outer_level, break; } default: - throw loop_error("cannot handle tile bounds"); + throw chill::error::loop("cannot handle tile bounds"); } } h.update_const(ub_list[simplest_ub].get_const()); @@ -490,7 +490,7 @@ void Loop::tile(int stmt_num, int level, int tile_size, int outer_level, break; } default: - throw loop_error("cannot handle tile bounds"); + throw chill::error::loop("cannot handle tile bounds"); } } h1.update_const(-ub_list[simplest_ub].get_const()); @@ -569,7 +569,7 @@ void Loop::tile(int stmt_num, int level, int tile_size, int outer_level, stmt[*i].loop_level[j - 1].payload++; break; default: - throw loop_error( + throw chill::error::loop( "unknown loop level type for statement " + to_string(*i)); } diff --git a/src/transformations/loop_unroll.cc b/src/transformations/loop_unroll.cc index 3238d50..fb82228 100644 --- a/src/transformations/loop_unroll.cc +++ b/src/transformations/loop_unroll.cc @@ -73,19 +73,19 @@ std::set<int> Loop::unroll(int stmt_num, int level, int unroll_amount, /*if (dv.isCarried(dim2) && (dv.hasNegative(dim2) && !dv.quasi)) - throw loop_error( + throw chill::error::loop( "loop error: Unrolling is illegal, dependence violation!"); if (dv.isCarried(dim2) && (dv.hasPositive(dim2) && dv.quasi)) - throw loop_error( + throw chill::error::loop( "loop error: Unrolling is illegal, dependence violation!"); */ bool safe = false; if (dv.isCarried(dim2) && dv.hasPositive(dim2)) { if (dv.quasi) - throw loop_error( + throw chill::error::loop( "loop error: a quasi dependence with a positive carried distance"); if (!dv.quasi) { if (dv.lbounds[dim2] != posInfinity) { @@ -127,7 +127,7 @@ std::set<int> Loop::unroll(int stmt_num, int level, int unroll_amount, if (dv.hasPositive(dim3)) break; else if (dv.hasNegative(dim3)) - throw loop_error( + throw chill::error::loop( "loop error: Unrolling is illegal, dependence violation!"); } } @@ -168,7 +168,7 @@ std::set<int> Loop::unroll(int stmt_num, int level, int unroll_amount, Relation bound = get_loop_bound(hull, level, this->known); if (!bound.has_single_conjunct() || !bound.is_satisfiable() || bound.is_tautology()) - throw loop_error("unable to extract loop bound for unrolling"); + throw chill::error::loop("unable to extract loop bound for unrolling"); // extract the loop stride coef_t stride; @@ -231,7 +231,7 @@ std::set<int> Loop::unroll(int stmt_num, int level, int unroll_amount, break; } default: - throw loop_error("failed to calculate overflow amount"); + throw chill::error::loop("failed to calculate overflow amount"); } } overflow_table[i][j][NULL] += ub_list[j].get_const(); @@ -261,7 +261,7 @@ std::set<int> Loop::unroll(int stmt_num, int level, int unroll_amount, break; } default: - throw loop_error("failed to calculate overflow amount"); + throw chill::error::loop("failed to calculate overflow amount"); } } overflow_table[i][j][NULL] += lb_list[i].get_const(); @@ -374,7 +374,7 @@ std::set<int> Loop::unroll(int stmt_num, int level, int unroll_amount, if (is_split_illegal) { rhs->clear(); delete rhs; - throw loop_error( + throw chill::error::loop( "cannot split cleanup code at loop level " + to_string(cleanup_split_level) + " due to overflow variable data dependence"); @@ -1112,7 +1112,7 @@ std::set<int> Loop::unroll(int stmt_num, int level, int unroll_amount, dvs11.push_back(dv); dvs22.push_back(dv); } else - throw loop_error( + throw chill::error::loop( "unrolled statements lumped together illegally"); } else { coef_t lb = dv.lbounds[dep_dim]; |