org.apache.sysds.hops.rewrite

## Class RewriteSplitDagDataDependentOperators

- java.lang.Object
- - org.apache.sysds.hops.rewrite.StatementBlockRewriteRule
  - - org.apache.sysds.hops.rewrite.RewriteSplitDagDataDependentOperators

-     public class RewriteSplitDagDataDependentOperators
      extends StatementBlockRewriteRule

  Rule: Split Hop DAG after specific data-dependent operators. This is important to create recompile hooks if output dimensions are usually significantly overestimated. This is a recursive statementblock rewrite rule. NOTE: Before we used AssignmentStatement.controlStatement() in order to force statementblock cuts. However, this (1) cuts not only after but before-and-after (which prevents certain rewrites because the input operators are unknown), and (2) is statement-centric which potentially prevents the cut right after the problematic operation. TODO: Cleanup runtime to never access individual statements of potentially split statements blocks again (for consistency). However, currently it is only used in places (e.g., parfor optimizer) that are not directly affected.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `RewriteSplitDagDataDependentOperators()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `createsSplitDag()` Indicates if the rewrite potentially splits dags, which is used for phase ordering of rewrites.
    `List<StatementBlock>` | `rewriteStatementBlock(StatementBlock sb, ProgramRewriteStatus state)` Handle an arbitrary statement block.
    `List<StatementBlock>` | `rewriteStatementBlocks(List<StatementBlock> sbs, ProgramRewriteStatus sate)` Handle a list of statement blocks.

    - ### Methods inherited from class org.apache.sysds.hops.rewrite.StatementBlockRewriteRule

      `createCutVarName`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### RewriteSplitDagDataDependentOperators

          public RewriteSplitDagDataDependentOperators()

  - ### Method Detail

    - #### createsSplitDag

          public boolean createsSplitDag()

      Description copied from class: `StatementBlockRewriteRule`
      Indicates if the rewrite potentially splits dags, which is used for phase ordering of rewrites.
      Specified by:
        `createsSplitDag` in class `StatementBlockRewriteRule`
      Returns:
        true if dag splits are possible.

    - #### rewriteStatementBlock

          public List<StatementBlock> rewriteStatementBlock(StatementBlock sb,
                                                            ProgramRewriteStatus state)

      Description copied from class: `StatementBlockRewriteRule`
      Handle an arbitrary statement block. Specific type constraints have to be ensured within the individual rewrites. If a rewrite does not apply to individual blocks, it should simply return the input block.
      Specified by:
        `rewriteStatementBlock` in class `StatementBlockRewriteRule`
      Parameters:
        `sb` - statement block
        `state` - program rewrite status
      Returns:
        list of statement blocks

    - #### rewriteStatementBlocks

          public List<StatementBlock> rewriteStatementBlocks(List<StatementBlock> sbs,
                                                             ProgramRewriteStatus sate)

      Description copied from class: `StatementBlockRewriteRule`
      Handle a list of statement blocks. Specific type constraints have to be ensured within the individual rewrites. If a rewrite does not require sequence access, it should simply return the input list of statement blocks.
      Specified by:
        `rewriteStatementBlocks` in class `StatementBlockRewriteRule`
      Parameters:
        `sbs` - list of statement blocks
        `sate` - program rewrite status
      Returns:
        list of statement blocks

Copyright © 2021 The Apache Software Foundation. All rights reserved.