MultithreadAnalyzer

public final class MultithreadAnalyzer extends DataFlowAnalyzer

Analysis of multithread clauses for e.g. OpenMP or Cuda. At present, computes two things:

  • For every Block, whether this block is run multithread, and if so the (zones of) variables that are shared

  • For every multithread region, a collection of indexes used in the primal code to refer to shared variables, which may be used to prove that accesses to differentiated shared variables are conflict-free.

Fields

blockInstancesAfter

BlockStorage<MTInstances> blockInstancesAfter

blockInstancesBefore

BlockStorage<MTInstances> blockInstancesBefore

freeInstances

MTInstances freeInstances

loopModifiedZones

BlockStorage<BoolVector> loopModifiedZones

Constructors

MultithreadAnalyzer

public MultithreadAnalyzer(CallGraph cg)

Methods

analyze

protected boolean analyze()

analyzeSharedAdjointConflicts

public void analyzeSharedAdjointConflicts(Unit unit, ActivityPattern activity, CallGraphDifferentiator cgDifferentiator)

Main method: for the given “unit”, builds all contexts and all instance numbers, then collects all future (read or writes) of multithread shared (primal and adjoint) variables, then, from these collections, fills each context with its list of conflict-free knowledge (from the primal) and its list of conflict-free questions (for the adjoint), finally on each context, (hopefully) calls Z3 with knowledge and questions, and consequently fills the resulting BoolVector of conflict-free conflict-free shared adjoint variables, which is attached to the ParallelInfoOfBlock of the parallel region header Block.

attachInstances

public static void attachInstances(Tree expr, MTInstances instances, Instruction instr, boolean inIndex)

buildConflicts

public void buildConflicts(ParallelInfoOfBlock parallelRegionInfo, boolean isQuestion)

buildContexts

public void buildContexts()

buildInstances

public void buildInstances()

collectAllSharedUses

public void collectAllSharedUses(CallGraphDifferentiator cgDifferentiator)

collectOneSharedVarUse

public void collectOneSharedVarUse(Tree expr, MTInstances instances, Instruction instr, boolean justRead, SharedVarUses[] sharedVarUses)

dumpExistingContexts

public void dumpExistingContexts()

getConflictFreeSharedAdjointZones

public BoolVector getConflictFreeSharedAdjointZones(Block block)

getSharedZonesOfBlock

public BoolVector getSharedZonesOfBlock(Block block)

Returns the detected shared zones for the given Block.

getSharedZonesOfUnit

public BoolVector getSharedZonesOfUnit(Unit unit)

Returns the detected shared zones for the given Unit.

initializeCGForRootUnit

protected void initializeCGForRootUnit()

initializeCGForUnit

protected Object initializeCGForUnit()

initializeInitBlock

protected void initializeInitBlock()

initializeUnit

protected void initializeUnit()

isGPU

public boolean isGPU(Unit unit)

propagateValuesStaticallyThroughBlock

protected void propagateValuesStaticallyThroughBlock()

run

public void run()

Runs detection.

runAnalysis

public static void runAnalysis(CallGraph callGraph)

terminateCGForUnit

protected void terminateCGForUnit()

terminateUnit

protected boolean terminateUnit()