org.apache.sysds.runtime.controlprogram.parfor.opt

## Class ProgramRecompiler

- java.lang.Object
- - org.apache.sysds.runtime.controlprogram.parfor.opt.ProgramRecompiler

-     public class ProgramRecompiler
      extends Object

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ProgramRecompiler()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static boolean` | `containsAtLeastOneFunction(ProgramBlock pb)`
    `static ArrayList<ProgramBlock>` | `generatePartitialRuntimeProgram(Program rtprog, ArrayList<StatementBlock> sbs)`
    `static LocalVariableMap` | `getReusableScalarVariables(DMLProgram prog, StatementBlock parforSB, LocalVariableMap vars)`
    `static boolean` | `isApplicableForReuseVariable(DMLProgram prog, StatementBlock parforSB, String var)` This function determines if an parfor input variable is guaranteed to be read-only across multiple invocations of parfor optimization (e.g., in a surrounding while loop).
    `static void` | `replaceConstantScalarVariables(StatementBlock sb, LocalVariableMap vars)`
    `static void` | `rFindAndRecompileIndexingHOP(StatementBlock sb, ProgramBlock pb, String var, ExecutionContext ec, boolean force)` NOTE: if force is set, we set and recompile the respective indexing hops; otherwise, we release the forced exec type and recompile again.

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

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

- - ### Constructor Detail

    - #### ProgramRecompiler

          public ProgramRecompiler()

  - ### Method Detail

    - #### generatePartitialRuntimeProgram

          public static ArrayList<ProgramBlock> generatePartitialRuntimeProgram(Program rtprog,
                                                                                ArrayList<StatementBlock> sbs)

    - #### rFindAndRecompileIndexingHOP

          public static void rFindAndRecompileIndexingHOP(StatementBlock sb,
                                                          ProgramBlock pb,
                                                          String var,
                                                          ExecutionContext ec,
                                                          boolean force)

      NOTE: if force is set, we set and recompile the respective indexing hops; otherwise, we release the forced exec type and recompile again. Hence, any changes can be exactly reverted with the same access behavior.
      Parameters:
        `sb` - statement block
        `pb` - program block
        `var` - variable
        `ec` - execution context
        `force` - if true, set and recompile the respective indexing hops

    - #### getReusableScalarVariables

          public static LocalVariableMap getReusableScalarVariables(DMLProgram prog,
                                                                    StatementBlock parforSB,
                                                                    LocalVariableMap vars)

    - #### replaceConstantScalarVariables

          public static void replaceConstantScalarVariables(StatementBlock sb,
                                                            LocalVariableMap vars)

    - #### isApplicableForReuseVariable

          public static boolean isApplicableForReuseVariable(DMLProgram prog,
                                                             StatementBlock parforSB,
                                                             String var)

      This function determines if an parfor input variable is guaranteed to be read-only across multiple invocations of parfor optimization (e.g., in a surrounding while loop). In case of invariant variables we can reuse partitioned matrices and propagate constants for better size estimation.
      Parameters:
        `prog` - dml program
        `parforSB` - parfor statement block
        `var` - variable
      Returns:
        true if can reuse variable

    - #### containsAtLeastOneFunction

          public static boolean containsAtLeastOneFunction(ProgramBlock pb)

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