An exact data dependence testing method for quadratic expressions
Introduction
Optimization and parallelization of loops are the most significant transformations when restructuring serial programs into parallel forms. These transformations require array data dependence analysis to determine whether a loop, or parts of a loop, can be executed in parallel without violating semantics. When a loop has no dependence across iterations, it can be executed in parallel; otherwise, the loop must be run sequentially. Standard array dependence analysis can only be applied using linear constraints. In other words, the expressions must be in the form a1x1 + a2x2 + ⋯ + anxn + a0, where a0, ak are integer constants and xk are loop index variables for 1 ⩽ k ⩽ n. Expressions that cannot be written in this form are called nonlinear expressions. In [21], it is stated that precise and efficient testing methods are very important for many loops to be found on usual benchmarks. For example, it reports that Perfect Benchmarks present 5242 cases for array subscripts with unknown loop invariant coefficients, 6503 cases for array subscripts caused either by loop variant coefficients or nonlinear operators on the loop indices contained in the expressions, and 4304 cases for array references contained in the array subscripts were found.
The problem of finding integer-valued solutions to a system of linear or quadratic equations is NP-hard. Therefore, in practice, most popular data dependence analysis algorithms are applied to solve particular cases of this problem. Several well-known methods of data dependence analysis exist for dealing with one-dimensional arrays under constant or variable bounds – the GCD test and Banerjee’s method [1], [2], the I test and the direction vector I test [18], [22], the extended I test [6], the generalized direction vector I test [10] and the interval reduction test [16]. Several popular methods of data dependence analysis exist for handling multi-dimensional coupled arrays under constant or variable bounds – the generalized GCD test [1], [2], Lambda test [19], the generalized Lambda test [7], the multi-dimensional I test [11], the multi-dimensional direction vector I test [12], Power test [29] and Omega test [23]. There are several well-known data dependence analysis algorithms applicable for arrays with linear subscripts with symbolic coefficients or with nonlinear subscripts under symbolic bounds – the infinity Banerjee test [2], [21], Range test [4] and the infinity Lambda test [9].
Important data dependence testing methods for dealing with those 16049 cases above on Perfect Benchmarks consist of the Range test [4], Access Range test [20], analysis of pointers [14], analysis and parallelism exploited of static and dynamic memory reference analysis [25], [28], Region test [26] and optimization analysis of array data permutation [24]. In terms of application scope, these methods are very accurate. From [17], a new predecessor/successor approach is developed in which high-level predecessor/successor information is recorded and processed efficiently. Usually, the performance of a dependence chain approach degrades markedly for a hot-spot access pattern; however, this scheme works very efficiently in this case.
This work presents the Quadratic test, a dependence test that handles quadratic expression array subscripts. This proposed method first checks whether a quadratic equation is monotonically increasing or decreasing, then reduces the integer solution interval of each variable using repeated projection. Once the effective integer solution interval of any dependence function shrinks to empty, this dependence constraint system has no integer solution; otherwise, all integer solutions can be found. In practical applications, one only needs to check whether a solution exists in the dependence system. In this situation, the Quadratic test only needs to mark a loop as parallel when interval of the integer solution is proven empty.
The rest of this paper is organized as follows. Section 2 briefly reviews the problem of data dependence for arrays with quadratic expression array subscripts. Section 3 gives an overview of the range propagation to determine whether a quadratic equation is a monotone function. In Section 4, the proposed Quadratic test is presented. Section 5 provides two examples that can be parallelized using the Quadratic test and cannot be handled effectively by current parallelization schemes. Section 6 presents experimental results that demonstrate the effectiveness of the Quadratic test. Finally, conclusions are given in Section 7.
Section snippets
Background
To simplify presentation of the Quadratic test, we assume that we have a perfectly nested loop, as shown in Fig. 1. We also assume that test array A has only one dimension. The array access functions f and g can be linear or quadratic expressions. Moreover, we assume that all loop strides equal 1. Extending the proposed test to handle imperfectly nested loops with multidimensional arrays is not difficult. For arrays with m dimensions, the proposed method checks whether a solution exists for
Range propagation techniques
Determining monotony is easy for linear subscripts. However, monotony can also be determined for numerous nonlinear expressions by testing whether the difference between two consecutive values is always positive or negative. Before this study describes the Quadratic test, we define the monotone property for a particular loop index. Definition 2 A function f(i1, i2, …, ip) has monotonically increasing for index ik (with lower bound lk and upper bound uk) if and only ifwhere lk
The Quadratic test
In the dependence problem for real programs, most dependence equations have no more than two variables [2]. Thus, this section focuses on a two-variable quadratic equation problem. The Quadratic test is easily extended to a dependence equation with more than two variables. This discussion of the Quadratic test begins by defining some notations. Definition 3 Let a be an integer. DefineIn other words, a+ = a and a− = 0 for a ⩾ 0, while a+ = 0 and a− = −a for a ⩽ 0. It is trivial for a = a+ − a−. Lemma 1 Let L, U
Examples
Consider the loop in Fig. 2, the dependence equation between S1 and S2 is y = (x2 − 1)/2. For starters, we prove whether (x2 − 1)/2 is monotonically increasing or decreasing for loop I. By using the techniques described in Section 3. We must compare ((x + 1)2 − 1)/2 with (x2 − 1)/2, where x = [1:5], to see if the difference is always greater than zero or less than zero. First, we calculate the difference, which is x+1/2. Then, we substitute [1:5] for x in x + 1/2, getting [3/2:11/2]. From this range, we can
Experimental results
A parallel tool was developed from [8]. The parallel tool consists of a scanner, parser and integrated data dependence testing methods. It inputs a source program, extracts each loop embedded in the source program, and generates all data dependence relations among arrays embedded in each loop in a source program. This work implemented the Quadratic test and Range test [4] in the parallel tool using C language.
This study applied the Quadratic test and performed experiments in the parallel tool
Conclusion
Many codes and benchmarks exist whereby parallelism exploitation can be improved by automatically examining data dependences contained in their loops. In this study, the Quadratic test was proposed to deal with one-dimensional array references with constant bounds and quadratic equations. The Quadratic test accurately found all integer solutions for one-dimensional array references with constant bounds and quadratic equations. However, the Range test, Access Range test, and Region test were not
References (29)
- et al.
The extension of the I test
Parallel Comput.
(1998) - et al.
The Infinity Lambda test: a multi-dimensional version of Banerjee’s Infinity test
Parallel Comput.
(2000) - et al.
The Generalized Direction Vector I test
Parallel Comput.
(2001) - et al.
A multi-dimensional version of the I test
Parallel Comput.
(2001) - et al.
A precise dependence analysis for multi-dimensional arrays under specific dependence direction
J. Syst. Softw.
(2002) - et al.
Data dependence analysis for array references
J. Syst. Softw.
(2000) - et al.
Predecessor/successor approach for high-performance run-time wavefront scheduling
Inform. Sci.
(2006) - et al.
A compiler for exploiting nested parallelism in open MP programs
Parallel Comput.
(2005) Dependence Analysis for Supercomputing
(1988)Dependence Analysis
(1997)
Performance analysis of parallelizing compilers on the perfect benchmarks program
IEEE Trans. Parallel Distribut. Syst.
Nonlinear and symbolic data dependence testing
IEEE Trans. Parallel Distribut. Syst.
The Generalized Lambda test: a multi-dimensional version of Banerjee’s algorithm
Int. J. Parallel Distribut. Syst. Network
Cited by (5)
K-DT: a formal system for the evaluation of linear data dependence testing techniques
2018, Journal of SupercomputingAn improved nonlinear data dependence test
2015, Journal of SupercomputingQP test: A dependence test for quadratic array subscripts
2013, IET SoftwareA nonlinear array subscripts dependence test
2012, Proceedings of the 14th IEEE International Conference on High Performance Computing and Communications, HPCC-2012 - 9th IEEE International Conference on Embedded Software and Systems, ICESS-2012