Package org.apache.sysds.hops.rewrite
Class RewriteRemoveUnnecessaryCasts
java.lang.Object
org.apache.sysds.hops.rewrite.HopRewriteRule
org.apache.sysds.hops.rewrite.RewriteRemoveUnnecessaryCasts
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 -
Method Summary
Modifier and TypeMethodDescriptionrewriteHopDAG(Hop root, ProgramRewriteStatus state) Handle a predicate hop DAG with exactly one root.rewriteHopDAGs(ArrayList<Hop> roots, ProgramRewriteStatus state) Handle a generic (last-level) hop DAG with multiple roots.
-
Constructor Details
-
RewriteRemoveUnnecessaryCasts
public RewriteRemoveUnnecessaryCasts()
-
-
Method Details
-
rewriteHopDAGs
Description copied from class:HopRewriteRuleHandle a generic (last-level) hop DAG with multiple roots.- Specified by:
rewriteHopDAGsin classHopRewriteRule- Parameters:
roots- high-level operator rootsstate- program rewrite status- Returns:
- list of high-level operators
-
rewriteHopDAG
Description copied from class:HopRewriteRuleHandle a predicate hop DAG with exactly one root.- Specified by:
rewriteHopDAGin classHopRewriteRule- Parameters:
root- high-level operator rootstate- program rewrite status- Returns:
- high-level operator
-