[ 
https://issues.apache.org/jira/browse/SYSTEMML-2168?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Matthias Boehm updated SYSTEMML-2168:
-------------------------------------
    Description: 
In several algorithms like {{scripts/algorithms/GLM-predict.dml}}, we see 
unnecessary right indexing operations that are not yet automatically removed. 
For example, in the following script
{code}
y_prob [, 1]  = exp (linear_terms);
y_prob [, 2]  = 1.0 - y_prob [, 1];
{code}
the second access to {{y_prob [, 1]}} causes an unnecessary indexing operation 
and intermediate. We should rewrite this pattern to directly consume the output 
from {{exp (linear_terms)}} instead.

In detail, this task entails the following steps, which might be a good 
opportunity to get in touch with SystemML's internal representation of 
high-level operators:
* Create a new test case for this rewrite in package 
{{org.apache.sysml.test.integration.functions.misc}} similar to other test 
classes prefixed with {{Rewrite*}}.
* Add a new rewrite to {{RewriteAlgebraicSimplificationDynamic}} to recognize 
the pattern of {{Indexing(LeftIndexing(X, y, indexrange1),indexrange2)}} with 
{{indexrange1==indexrange2}} and rewrite this to {{y}}. Note that there is a 
rewrite that replaces two subsequent leftindexing operations with an append, so 
this new rewrite should be invoked before {{fuseLeftIndexingChainToAppend}}.


  was:
In several algorithms like {{scripts/algorithms/GLM-predict.dml}}, we see 
unnecessary right indexing operations that are not yet automatically removed. 
For example, in the following script
{code}
y_prob [, 1]  = exp (linear_terms);
y_prob [, 2]  = 1.0 - y_prob [, 1];
{code}
the second access to {{y_prob [, 1]}} causes an unnecessary indexing operations 
and intermediate. We should rewrite this pattern to directly consume the output 
from {{exp (linear_terms)}} instead.

In detail, this task entails the following steps, which might be a good 
opportunity to get in touch with SystemML's internal representation of 
high-level operators:
* Create a new test case for this rewrite in package 
{{org.apache.sysml.test.integration.functions.misc}} similar to other test 
classes prefixed with {{Rewrite*}}.
* Add a new rewrite to {{RewriteAlgebraicSimplificationDynamic}} to recognize 
the pattern of {{Indexing(LeftIndexing(X, y, indexrange1),indexrange2)}} with 
{{indexrange1==indexrange2}} and rewrite this to {{y}}. Note that there is a 
rewrite that replaces two subsequent leftindexing operations with an append, so 
this new rewrite should be invoked before {{fuseLeftIndexingChainToAppend}}.



> New rewrite for removal of unnecessary right indexing
> -----------------------------------------------------
>
>                 Key: SYSTEMML-2168
>                 URL: https://issues.apache.org/jira/browse/SYSTEMML-2168
>             Project: SystemML
>          Issue Type: Task
>            Reporter: Matthias Boehm
>            Priority: Major
>
> In several algorithms like {{scripts/algorithms/GLM-predict.dml}}, we see 
> unnecessary right indexing operations that are not yet automatically removed. 
> For example, in the following script
> {code}
> y_prob [, 1]  = exp (linear_terms);
> y_prob [, 2]  = 1.0 - y_prob [, 1];
> {code}
> the second access to {{y_prob [, 1]}} causes an unnecessary indexing 
> operation and intermediate. We should rewrite this pattern to directly 
> consume the output from {{exp (linear_terms)}} instead.
> In detail, this task entails the following steps, which might be a good 
> opportunity to get in touch with SystemML's internal representation of 
> high-level operators:
> * Create a new test case for this rewrite in package 
> {{org.apache.sysml.test.integration.functions.misc}} similar to other test 
> classes prefixed with {{Rewrite*}}.
> * Add a new rewrite to {{RewriteAlgebraicSimplificationDynamic}} to recognize 
> the pattern of {{Indexing(LeftIndexing(X, y, indexrange1),indexrange2)}} with 
> {{indexrange1==indexrange2}} and rewrite this to {{y}}. Note that there is a 
> rewrite that replaces two subsequent leftindexing operations with an append, 
> so this new rewrite should be invoked before 
> {{fuseLeftIndexingChainToAppend}}.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to