# Package org.apache.sysds.hops.rewrite

- Class Summary
  Class | Description
  --- | ---
  HopDagValidator | This class allows to check hop dags for validity, e.g., parent-child linking.
  HopRewriteRule | Base class for all hop rewrites in order to enable generic application of all rules.
  HopRewriteUtils |
  MarkForLineageReuse |
  ProgramRewriter | This program rewriter applies a variety of rule-based rewrites on all hop dags of the given program in one pass over the entire program.
  ProgramRewriteStatus |
  RewriteAlgebraicSimplificationDynamic | Rule: Algebraic Simplifications.
  RewriteAlgebraicSimplificationStatic | Rule: Algebraic Simplifications.
  RewriteBlockSizeAndReblock | Rule: BlockSizeAndReblock.
  RewriteCommonSubexpressionElimination | Rule: CommonSubexpressionElimination.
  RewriteCompressedReblock | Rule: Compressed Re block if config compressed.linalg is enabled, we inject compression directions after read of matrices if number of rows is above 1000 and cols at least 1.
  RewriteConstantFolding | Rule: Constant Folding.
  RewriteElementwiseMultChainOptimization | Prerequisite: RewriteCommonSubexpressionElimination must run before this rule.
  RewriteFederatedExecution |
  RewriteFederatedExecution.PrivacyConstraintRetriever | FederatedUDF for retrieving privacy constraint of data stored in file name.
  RewriteForLoopVectorization | Rule: Simplify program structure by pulling if or else statement body out (removing the if statement block ifself) in order to allow intra-procedure analysis to propagate exact statistics.
  RewriteGPUSpecificOps |
  RewriteHoistLoopInvariantOperations | Rule: Simplify program structure by hoisting loop-invariant operations out of while, for, or parfor loops.
  RewriteIndexingVectorization | Rule: Indexing vectorization.
  RewriteInjectSparkLoopCheckpointing | Rule: Insert checkpointing operations for caching purposes.
  RewriteInjectSparkPReadCheckpointing | Rule: BlockSizeAndReblock.
  RewriteMarkLoopVariablesUpdateInPlace | Rule: Mark loop variables that are only read/updated through cp left indexing for update in-place.
  RewriteMatrixMultChainOptimization | Rule: Determine the optimal order of execution for a chain of matrix multiplications Solution: Classic Dynamic Programming Approach: Currently, the approach based only on matrix dimensions Goal: To reduce the number of computations in the run-time (map-reduce) layer
  RewriteMatrixMultChainOptimizationSparse | Rule: Determine the optimal order of execution for a chain of matrix multiplications Solution: Classic Dynamic Programming Approach: Currently, the approach based only on matrix dimensions and sparsity estimates using the MNC sketch Goal: To reduce the number of computations in the run-time (map-reduce) layer
  RewriteMergeBlockSequence | Rule: Simplify program structure by merging sequences of last-level statement blocks in order to create optimization opportunities.
  RewriteRemoveDanglingParentReferences | This rewrite is a general-purpose cleanup pass that removes any dangling parent references in one pass through the hop DAG.
  RewriteRemoveEmptyBasicBlocks | Rule: Simplify program structure by removing empty last-level blocks, which may originate from the original program or due to a sequence of rewrites (e.g., checkpoint injection and subsequent IPA).
  RewriteRemoveForLoopEmptySequence | Rule: Simplify program structure by removing (par)for statements iterating over an empty sequence, i.e., (par)for-loops without a single iteration.
  RewriteRemovePersistentReadWrite | This rewrite is a custom rewrite for JMLC in order to replace all persistent reads and writes with transient reads and writes from the symbol table.
  RewriteRemoveReadAfterWrite | Rule: RemoveReadAfterWrite.
  RewriteRemoveUnnecessaryBranches | Rule: Simplify program structure by pulling if or else statement body out (removing the if statement block ifself) in order to allow intra-procedure analysis to propagate exact statistics.
  RewriteRemoveUnnecessaryCasts | Rule: RemoveUnnecessaryCasts.
  RewriteSplitDagDataDependentOperators | Rule: Split Hop DAG after specific data-dependent operators.
  RewriteSplitDagUnknownCSVRead | Rule: Split Hop DAG after CSV reads with unknown size.
  RewriteTransientWriteParentHandling | Rule: Eliminate for Transient Write DataHops to have no parents Solution: Move parent edges of Transient Write Hop to parent of its child Reason: Transient Write not being a root messes up analysis for Lop's to Instruction translation (according to Amol)
  StatementBlockRewriteRule | Base class for all hop rewrites in order to enable generic application of all rules.

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