org.apache.sysds.hops.rewrite

## Class RewriteRemoveReadAfterWrite

- java.lang.Object
- - org.apache.sysds.hops.rewrite.HopRewriteRule
  - - org.apache.sysds.hops.rewrite.RewriteRemoveReadAfterWrite

-     public class RewriteRemoveReadAfterWrite
      extends HopRewriteRule

  Rule: RemoveReadAfterWrite. If there is a persistent read with the same filename as a persistent write, and read has a higher line number than the write, we remove the read and consume the write input directly. This is important for two reasons (1) correctness and (2) performance. Without this rewrite, we could not guarantee the order of read-after-write because there is not data dependency

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `RewriteRemoveReadAfterWrite()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and 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.

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

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

- - ### Constructor Detail

    - #### RewriteRemoveReadAfterWrite

          public RewriteRemoveReadAfterWrite()

  - ### 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 class `HopRewriteRule`
      Parameters:
        `roots` - high-level operator roots
        `state` - 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 class `HopRewriteRule`
      Parameters:
        `root` - high-level operator root
        `state` - program rewrite status
      Returns:
        high-level operator

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