Package org.apache.sysds.hops.rewrite
Class RewriteRemoveUnnecessaryCasts
- java.lang.Object
-
- org.apache.sysds.hops.rewrite.HopRewriteRule
-
- org.apache.sysds.hops.rewrite.RewriteRemoveUnnecessaryCasts
-
public class RewriteRemoveUnnecessaryCasts extends HopRewriteRule
Rule: RemoveUnnecessaryCasts. For all value type casts check if they are really necessary. If both cast input and output type are the same, the cast itself is redundant. There are two use case where this can arise: (1) automatically inserted casts on function inlining (in case of unknown value types), and (2) explicit script-level value type casts, that might be redundant according to the read input data. The benefit of this rewrite is negligible for scalars. However, when we support matrices with different value types, those casts might refer to matrices and with that incur large costs.
-
-
Constructor Summary
Constructors Constructor Description RewriteRemoveUnnecessaryCasts()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Hop
rewriteHopDAG(Hop root, ProgramRewriteStatus state)
Handle a predicate hop DAG with exactly one root.ArrayList<Hop>
rewriteHopDAGs(ArrayList<Hop> roots, ProgramRewriteStatus state)
Handle a generic (last-level) hop DAG with multiple roots.
-
-
-
Method Detail
-
rewriteHopDAGs
public ArrayList<Hop> rewriteHopDAGs(ArrayList<Hop> roots, ProgramRewriteStatus state)
Description copied from class:HopRewriteRule
Handle a generic (last-level) hop DAG with multiple roots.- Specified by:
rewriteHopDAGs
in classHopRewriteRule
- Parameters:
roots
- high-level operator rootsstate
- program rewrite status- Returns:
- list of high-level operators
-
rewriteHopDAG
public Hop rewriteHopDAG(Hop root, ProgramRewriteStatus state)
Description copied from class:HopRewriteRule
Handle a predicate hop DAG with exactly one root.- Specified by:
rewriteHopDAG
in classHopRewriteRule
- Parameters:
root
- high-level operator rootstate
- program rewrite status- Returns:
- high-level operator
-
-