Code quality: removed obsolete/dead code
This commit is contained in:
@@ -96,17 +96,12 @@ std::string hash(expression_tree const & tree)
|
||||
}
|
||||
|
||||
//Set arguments
|
||||
void set_arguments(expression_tree const & tree, driver::Kernel & kernel, unsigned int & current_arg, fusion_policy_t fusion_policy)
|
||||
void set_arguments(expression_tree const & tree, driver::Kernel & kernel, unsigned int & current_arg)
|
||||
{
|
||||
driver::backend_type backend = tree.context().backend();
|
||||
|
||||
//Create binder
|
||||
std::unique_ptr<symbolic_binder> binder;
|
||||
if (fusion_policy==FUSE_SEQUENTIAL)
|
||||
binder.reset(new bind_sequential(backend));
|
||||
else
|
||||
binder.reset(new bind_independent(backend));
|
||||
|
||||
std::unique_ptr<symbolic_binder> binder(new bind_independent(backend));
|
||||
//assigned
|
||||
std::vector<size_t> assignee = symbolic::find(tree, [&](expression_tree::node const & node){return node.type==COMPOSITE_OPERATOR_TYPE && is_assignment(node.binary_operator.op.type);});
|
||||
for(size_t& x: assignee) x = tree[x].binary_operator.lhs;
|
||||
@@ -168,18 +163,13 @@ std::shared_ptr<object> make_symbolic(Args&&... args)
|
||||
return std::shared_ptr<object>(new T(std::forward<Args>(args)...));
|
||||
}
|
||||
|
||||
symbols_table symbolize(fusion_policy_t fusion_policy, isaac::expression_tree const & tree)
|
||||
symbols_table symbolize(isaac::expression_tree const & tree)
|
||||
{
|
||||
driver::Context const & context = tree.context();
|
||||
|
||||
//binder
|
||||
symbols_table table;
|
||||
std::unique_ptr<symbolic_binder> binder;
|
||||
if (fusion_policy==FUSE_SEQUENTIAL)
|
||||
binder.reset(new bind_sequential(context.backend()));
|
||||
else
|
||||
binder.reset(new bind_independent(context.backend()));
|
||||
|
||||
std::unique_ptr<symbolic_binder> binder(new bind_independent(context.backend()));
|
||||
//assigned
|
||||
std::vector<size_t> assignee = symbolic::find(tree, [&](expression_tree::node const & node){return node.type==COMPOSITE_OPERATOR_TYPE && is_assignment(node.binary_operator.op.type);});
|
||||
for(size_t& x: assignee) x = tree[x].binary_operator.lhs;
|
||||
|
@@ -101,10 +101,10 @@ std::string to_string(operation_type type)
|
||||
case CAST_DOUBLE_TYPE : return "(double)";
|
||||
|
||||
//dot
|
||||
case MATRIX_PRODUCT_NN_TYPE: return "matmatNN";
|
||||
case MATRIX_PRODUCT_NT_TYPE: return "matmatNT";
|
||||
case MATRIX_PRODUCT_TN_TYPE: return "matmatTN";
|
||||
case MATRIX_PRODUCT_TT_TYPE: return "matmatTT";
|
||||
case GEMM_NN_TYPE: return "matmatNN";
|
||||
case GEMM_NT_TYPE: return "matmatNT";
|
||||
case GEMM_TN_TYPE: return "matmatTN";
|
||||
case GEMM_TT_TYPE: return "matmatTT";
|
||||
|
||||
//others
|
||||
case RESHAPE_TYPE: return "reshape";
|
||||
|
@@ -30,7 +30,7 @@ namespace symbolic
|
||||
namespace preset
|
||||
{
|
||||
|
||||
void matrix_product::handle_node(expression_tree::data_type const & tree, size_t root, args & a)
|
||||
void gemm::handle_node(expression_tree::data_type const & tree, size_t root, args & a)
|
||||
{
|
||||
expression_tree::node const & node = tree[root];
|
||||
if(node.type != COMPOSITE_OPERATOR_TYPE)
|
||||
@@ -40,16 +40,16 @@ void matrix_product::handle_node(expression_tree::data_type const & tree, size_t
|
||||
expression_tree::node const & right = tree[node.binary_operator.rhs];
|
||||
|
||||
//Matrix-Matrix product node
|
||||
if(node.binary_operator.op.type_family==MATRIX_PRODUCT)
|
||||
if(node.binary_operator.op.type_family==GEMM)
|
||||
{
|
||||
if(left.type==DENSE_ARRAY_TYPE) a.A = &left;
|
||||
if(right.type==DENSE_ARRAY_TYPE) a.B = &right;
|
||||
switch(node.binary_operator.op.type)
|
||||
{
|
||||
case MATRIX_PRODUCT_NN_TYPE: a.type = MATRIX_PRODUCT_NN; break;
|
||||
case MATRIX_PRODUCT_NT_TYPE: a.type = MATRIX_PRODUCT_NT; break;
|
||||
case MATRIX_PRODUCT_TN_TYPE: a.type = MATRIX_PRODUCT_TN; break;
|
||||
case MATRIX_PRODUCT_TT_TYPE: a.type = MATRIX_PRODUCT_TT; break;
|
||||
case GEMM_NN_TYPE: a.type = GEMM_NN; break;
|
||||
case GEMM_NT_TYPE: a.type = GEMM_NT; break;
|
||||
case GEMM_TN_TYPE: a.type = GEMM_TN; break;
|
||||
case GEMM_TT_TYPE: a.type = GEMM_TT; break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
@@ -59,7 +59,7 @@ void matrix_product::handle_node(expression_tree::data_type const & tree, size_t
|
||||
{
|
||||
//alpha*PROD
|
||||
if(left.type==VALUE_SCALAR_TYPE && right.type==COMPOSITE_OPERATOR_TYPE
|
||||
&& right.binary_operator.op.type_family==MATRIX_PRODUCT)
|
||||
&& right.binary_operator.op.type_family==GEMM)
|
||||
{
|
||||
a.alpha = cast(value_scalar(left.scalar, left.dtype), node.dtype);
|
||||
handle_node(tree, node.binary_operator.rhs, a);
|
||||
@@ -74,13 +74,13 @@ void matrix_product::handle_node(expression_tree::data_type const & tree, size_t
|
||||
}
|
||||
}
|
||||
|
||||
matrix_product::args matrix_product::check(expression_tree::data_type const & tree, size_t root)
|
||||
gemm::args gemm::check(expression_tree::data_type const & tree, size_t root)
|
||||
{
|
||||
expression_tree::node const & node = tree[root];
|
||||
expression_tree::node const & left = tree[node.binary_operator.lhs];
|
||||
expression_tree::node const & right = tree[node.binary_operator.rhs];
|
||||
numeric_type dtype = node.dtype;
|
||||
matrix_product::args result ;
|
||||
gemm::args result ;
|
||||
if(dtype==INVALID_NUMERIC_TYPE)
|
||||
return result;
|
||||
result.alpha = value_scalar(1, dtype);
|
||||
|
Reference in New Issue
Block a user