NewBlockGraphNode

public final class NewBlockGraphNode

Fields

assignedRef

protected Tree assignedRef

The variable that must be assigned or incremented by the final instruction.

backFlow

public TapList<NewBlockGraphArrow> backFlow

diffInstruction

protected Instruction diffInstruction

The final Instruction that will be generated for this node.

diffValue

protected Tree diffValue

The expression that is assigned or added into the assigned tree.

flow

public TapList<NewBlockGraphArrow> flow

fromInclude

protected Instruction fromInclude

When srcInstruction comes from an include, the include’ing Instruction.

iReplic

protected int iReplic

The replica number that was used to build “assignedRef” from “primRecv”.

isSparsityIntSetInstruction

public boolean isSparsityIntSetInstruction

Whether this instruction is coming from computing the sparsity of differentiated instruction.

kind

protected int kind

The general kind of the final Tree. In {PLAIN, INCREMENT_VARIABLE, SET_VARIABLE}.

nbDeps

public int nbDeps

neededMultiIter

protected IterDescriptor neededMultiIter

non-null if node must be run in multi-dir style, i.e. in a loop on directions.

overwritesUsed

protected boolean overwritesUsed

True if this instruction reads a value that it then overwrites. Default is true because this is safest.

plainTrees

protected TapList<Tree> plainTrees

When the trees are created at NewBlockGraphNode creation time (e.g. for kind==PLAIN, as opposed to kind==SET_VARIABLE or INCREMENT_VARIABLE) this field holds the list of these trees. This holds only one Tree at the beginning, but may hold several trees after node’s are merged.

preComments

protected Tree preComments

The prefix comments that must be attached to the future Instruction of this node. postfix comments are always null.

preCommentsBlock

protected Tree preCommentsBlock

The prefix comments that must be attached to the future Instruction of this node. postfix comments are always null.

primRecv

protected Tree primRecv

The primal variable whose diff is “assignedRef”.

rank

public int rank

requiresRelease

public boolean requiresRelease

Special for sparsity mode. True when this is (upcoming) instruction will imply a release of block of memory or not.

srcInstruction

protected Instruction srcInstruction

The primal Instruction that causes this differentiated code.

subOrder

public int subOrder

text

public String text

tree

protected Tree tree

The final Tree of the instruction for this Node. May be given at creation time (e.g. when kind==PLAIN) Alternatively, may be null (e.g. when kind==SET_VARIABLE or INCREMENT_VARIABLE) and will be deduced from the contents of whereMask, assigned, and diffValue.

whereMask

protected InstructionMask whereMask

The where context that must be applied to the final tree.

Constructors

NewBlockGraphNode

protected NewBlockGraphNode(int kind, Tree tree, IterDescriptor neededMultiIter, Instruction srcInstruction, InstructionMask whereMask)

Methods

attachCommentsToTree

protected void attachCommentsToTree()

buildInstruction

protected void buildInstruction(SymbolTable srcSymbolTable, SymbolTable bwdSymbolTable, DifferentiationEnv adEnv, Unit diffUnit)

fuseWith

protected boolean fuseWith(NewBlockGraphNode otherNode)

Fuses this node with the “otherNode”.

Returns

true when this node must disappear and be merged into “otherNode”. @return false when “otherNode” must disappear and be merged into this node.

gatherMultiInstructions

protected void gatherMultiInstructions(SymbolTable diffSymbolTable, DifferentiationEnv adEnv, Unit diffUnit)

hasManyInstructions

protected boolean hasManyInstructions()

interestingFuseWith

protected boolean interestingFuseWith(NewBlockGraphNode otherNode, NewBlockGraph thisGraph)
Returns

true if the fusion of “this” followed by “otherNode” is possible and profitable.

recomputeText

protected void recomputeText()

toString

public String toString()