Code quality: More overhead reduction

This commit is contained in:
Philippe Tillet
2016-10-06 11:58:36 -04:00
parent b21024cd37
commit 5a35877b31

View File

@@ -131,21 +131,22 @@ namespace runtime
void execute(execution_handler const & c, profiles::map_type & profiles) void execute(execution_handler const & c, profiles::map_type & profiles)
{ {
typedef isaac::array array; typedef isaac::array array;
expression_tree tree = c.x();
/*----Optimize----*/ /*----Optimize----*/
// detail::optimize(tree); // detail::optimize(tree);
/*----Process-----*/ /*----Process-----*/
driver::Context const & context = tree.context(); expression_tree const & reftree = c.x();
size_t rootidx = tree.root(); driver::Context const & context = reftree.context();
size_t rootidx = reftree.root();
std::vector<std::shared_ptr<array> > temporaries; std::vector<std::shared_ptr<array> > temporaries;
expression_type final_type; expression_type final_type;
/*----Matrix Product-----*/ /*----Matrix Product-----*/
if(symbolic::preset::gemm::args args = symbolic::preset::gemm::check(tree.data(), rootidx)){ if(symbolic::preset::gemm::args args = symbolic::preset::gemm::check(reftree.data(), rootidx)){
final_type = args.type; final_type = args.type;
} }
/*----Default-----*/ /*----Default-----*/
else else
{ {
expression_tree tree = reftree;
expression_tree::node & root = tree[rootidx]; expression_tree::node & root = tree[rootidx];
expression_tree::node & lhs = tree[root.binary_operator.lhs], &rhs = tree[root.binary_operator.rhs]; expression_tree::node & lhs = tree[root.binary_operator.lhs], &rhs = tree[root.binary_operator.rhs];
expression_tree::node root_save = root, lhs_save = lhs, rhs_save = rhs; expression_tree::node root_save = root, lhs_save = lhs, rhs_save = rhs;
@@ -183,7 +184,7 @@ namespace runtime
} }
/*-----Compute final expression-----*/ /*-----Compute final expression-----*/
profiles[std::make_pair(final_type, tree[rootidx].dtype)]->execute(execution_handler(tree, c.execution_options(), c.dispatcher_options(), c.compilation_options())); profiles[std::make_pair(final_type, reftree[rootidx].dtype)]->execute(execution_handler(reftree, c.execution_options(), c.dispatcher_options(), c.compilation_options()));
} }
void execute(execution_handler const & c) void execute(execution_handler const & c)