Commutativity Analysis: A New Analysis Framework for Parallelizing Compilers Martin C. Rinard Pedro C. Diniz Department of Computer Science University of California, Santa Barbara Santa Barbara, CA Presented by Hardiyanto Wibisono
Introduction Data dependence analysis: Inadequate for computations that manipulate dynamic, pointer-based data structures. Inadequate for computations that manipulate dynamic, pointer-based data structures. Need to perform complicated analysis to extract global properties of the data structure topology. Need to perform complicated analysis to extract global properties of the data structure topology. Inherent inability to parallelize computations that manipulate graphs. Inherent inability to parallelize computations that manipulate graphs. By using commutativity analysis, we can automatically recognize and exploit commuting operations to generate parallel code.
Building Blocks Designed to work with separable operation Designed to work with separable operation Commutativity Testing Commutativity Testing Instance Variables Invoked Operations Symbolic Execution Symbolic Execution Extensions Extensions Extent Constants Auxiliary Operations
Algorithm Pass Given a method, this pass identifies the set of extent constant variables, auxiliary operations, computing the extent as set of method and then checking the commutativity
Extent Constant Variables Using abstract interpretation to compute a read set and write set of storage descriptors that accurately represent how the computation may read and write data. Using abstract interpretation to compute a read set and write set of storage descriptors that accurately represent how the computation may read and write data. Prunes the read set so that it only contains storage descriptors that represent memory locations that the computation does not write. Prunes the read set so that it only contains storage descriptors that represent memory locations that the computation does not write.
Extents and Auxiliary Operations Performs a depth first search of the call graph Performs a depth first search of the call graph Compute the set of call sites that always invoke auxiliary operations Compute the set of call sites that always invoke auxiliary operations Compute the extent of the method Compute the extent of the method
Reference Parameter Checks Ensure that the symbolic execution operates correctly Ensure that the symbolic execution operates correctly Enforces the constraint that none of the operations in the extent write their reference parameters. Enforces the constraint that none of the operations in the extent write their reference parameters. Enforces the constraint that none of the methods are invoked with a reference parameter that points into the receiver Enforces the constraint that none of the methods are invoked with a reference parameter that points into the receiver
Separability The method never accesses an instance variable after it executes a call site that may invoke an operation in the extent. The method never accesses an instance variable after it executes a call site that may invoke an operation in the extent. The method only writes local variables or instance variables of the receiver and only reads parameters, local variables, instance variables of the receiver or extent constant variables. The method only writes local variables or instance variables of the receiver and only reads parameters, local variables, instance variables of the receiver or extent constant variables.
Commutativity Testing After checking dependence and symbolically executable, this pass comparing the two expression with both execution order
Symbolic Analysis Symbolically manipulates the expression on RHS using current set of bindings Symbolically manipulates the expression on RHS using current set of bindings Organize the RHS into a simplified form for comparison Organize the RHS into a simplified form for comparison Sort the operands according to an arbitrary order on expressions Sort the operands according to an arbitrary order on expressions
Experimental Result (Barnes-Hut)
Experimental Result (Water)
Future Research Relative Commutativity Relative Commutativity Analysis Granularity Analysis Granularity A Message-Passing Implementation A Message-Passing Implementation Pointer Analysis Pointer Analysis
Discussion