Using Algebraic Properties and Function Fusion to Evaluate Tree Accumulations in Parallel

Akimasa Morihata
2019 Journal of Information Processing  
Parallel evaluation of tree processing using accumulation parameters tends to be difficult because the accumulation parameters may introduce data dependencies between computations for subtrees. Some proposals have broken these data dependencies by using algebraic properties such as associativity and commutativity, but, none has achieved both the capability of complex tree traversals like attribute grammars and a theoretical guarantee of parallel speedup. This paper proposes a tree processing
more » ... guage based on macro tree transducers and provides a parallel evaluation algorithm for programs written in the language. The language can express complex accumulations like attribute grammars, and moreover, the number of parallel computational steps for evaluation is proportional to the height of the input tree. This paper also shows that combining the proposed approach with function fusion for macro tree transducers leads to improvement in the parallel computational complexity. Although comparable complexity improvement can be obtained from known parallel algorithms, the proof and parallel evaluation algorithm here are remarkably simpler. Guarantee of Parallel Speedup The naive approach that parallelizes apparently parallelizable parts is not acceptable. As accumulative tree processing is generally not suitable for parallel evaluation, such a naive approach would probably result in poor parallel speedup. As Amdahl's law explains, to achieve significant parallel speedup, most computations should be parallelized. In other words, the parallelization should improve the asymptotic computational complexity. Some existing approaches provide a guarantee of parallel speedup, but the guarantee tends to make the parallel algorithm more complex and less expressive. To satisfy these requirements, this paper focuses on macro tree transducers (MTTs) [5], [9] . MTTs are simple but more expressive than attributed tree transducers (ATTs), which are tree transformations modeled by attribute grammars. Therefore, MTTs can express complex tree traversals like attribute grammars. MTTs do not allow arbitrary accumulative computations. In MTTs, values bound to accumulation parameters can be used but cannot be examined by, for example, conditionals or pattern matching. This restriction seems suitable for parallel computing. Roughly speaking, while accumulation parameters are computed by other threads, the succeeding computation, which will not be seriously affected by the accumulation parameters, may be able to speculatively processed. For this reason, it is expected that MTTs would be good candidates for resolving the trade-off between expressiveness and suitability for parallel computing. Nevertheless, MTTs are tree-to-tree transformations and cannot be used for usual computations such as additions and multiplications. In addition, MTTs cannot naturally express summarization for substructures. To resolve these issues, while the approach here follows the syntactic restriction of MTTs, it semantically uses semiring operators and also provides a support for summarization of substructures. Several properties of MTTs are known. This paper especially focuses on fusion transformations [5], [9], [11], [13] and uses them to improve the complexity of parallel tree processing. The paper first provides a parallel evaluation algorithm and shows that its number of parallel evaluation steps is proportional to the height of the input tree. Then, Shunt trees [25] is applied for improving the complexity. The shunt tree representation of a tree t contains the same information as t, and yet its height is logarithmic in the height of t. Let g be a transformation that restores the original tree from its shunt tree representation. For tree processing f , the fusion transformation for MTTs derives an MTT equivalent to the composition of f and g, f • g. The complexity of the obtained MTT is proportional to the height of the shunt tree representation, making it logarithmic in the size of the original input. This approach avoids dealing with complex parallel algorithms and thereby leads to a significantly simpler correctness proof and complexity analysis as compared to using known parallel algorithms. The three major contributions are the following: • A programming language for parallel tree processing: MTTs are applied to provide a programming language suitable for parallel evaluation. The language can naturally express attribute-grammar-like complex accumulations, as well as
doi:10.2197/ipsjjip.27.411 fatcat:ktypv3exg5hwdlqmygkg7ijpba