Automatic A Posteriori Verication of Certain Global Source-code Restructuring Transformations K.C. Shashidhar∗ IMEC vzw, Kapeldreef 75, B-3001, Heverlee, Belgium [email protected] Program optimization process is sometimes justiably referred to as a necessary evil, for it raises the question of correctness of the optimized program, which is often at stake. In order to lend credence to the process, it is required that eective verication and testing methods and tools are well in place. Many solutions exist which address the various facets of this requirement. But for many practical situations, the solutions on oer are clearly less than satisfactory; in our work we address one such situation. Our endeavour is to provide a fully automatic technique to verify certain state-of-the-art optimizing program transformations applied on the multi-dimensional data dominated kernels of signal processing algorithms during the design of multimedia applications for embedded systems. We have made some progress and developed and implemented a technique that provides a posteriori proof of functional equivalence of the initial and transformed programs for some important transformations [3]. The technique is based on extracting and reasoning on the geometric domains representing the dependencies between the output and the input variables, which are preserved under the transformations considered. It also provides useful error diagnostics to identify and debug the program. In what follows, we discuss the intuitive idea behind our method.

1 Problem Statement and an Example The problem is to provide a technique to automatically verify the functional equivalence of the initial and the transformed sequential programs. We suppose that the latter has been obtained by only applying one or more of the following transformations: 1. Structure preserving and/or modifying loop transformations 2. Introduction and/or elimination of intermediate variables 3. Transformation of data-structures of intermediate variables and 4. Data-ow transformations involving expression propagation. Given the application context of such a verication technique, we are allowed to assume that the programs are in dynamic single assignment form (see Vanbroekhoven's article in this proceedings), implemented in a subset of a C-like imperative language, devoid of pointers and non-linear loop iterator and array index expressions. The following toy example is an input-output equivalent program fragment pair which is representative of the class of real-life programs whose equivalence we want to check. The example shows some of the transformations listed above applied in an intermixed fashion. But, both the programs will assign the same values to the output variable out[] at the end of execution for any given data to the in[] variable. Now the question is: how can we automatically verify this? {

{

}

for(i=0; i<128; i++) tmp[i] = f(in[i]); for(i=255; i>127; i--) out[i] = g(f(in[i])); for(i=0; i<128; i++) out[i] = g(tmp[i]);

/* s1 */ /* s2 */ /* s3 */ }

for(i=0; i<64; i++) buf1[i] = in[i]; for(i=0; i<256; i++) if((i>=0) && (i<64)){ buf2[i] = f(buf1[i]); out[i] = g(buf2[i]); } else out[i] = g(f(in[i]));

/* t1 */ /* t2 */ /* t3 */ /* t4 */

∗ Graduate student at the Department of Computer Science, Katholieke Universiteit Leuven, under the supervision of Prof. Maurice Bruynooghe and Prof. Francky Catthoor.

2

Motivation and Related Work

Application-driven and architecture-driven code transformations for program cost-optimization, more often than not, refers to transformations on the source-code. The term source-to-source is more commonly used to stress this abstraction level. There are many advantages in working at the source code level and the motivation therein is beyond the scope of this article. Naturally, many methodical design frameworks, targeted to certain specic application domains, advocate transformations of high level executable specication written in languages like C, SystemC, etc. Our own motivation comes from the Data Transfer and Storage Exploration (DTSE) design framework [1]. Complete automation of application and architecture specic transformations in a high end compiler is prohibitively complex and has more or less been understood to be infeasible. As a result, application of global source-to-source transformations on programs is essentially an interactive activity with many apply 'n' check cycles; eventually converging on an acceptable design meeting the cost constraints. Employing a tool for the application of the transformations in such an activity is an a priori solution (proposed by many) to the transformation correctness problem, but it is not practicable for various reasons. Firstly, a customized transformation tool is rarely available for the given context. Even if it is available, it is usually inexible to work with, as allowing only a predened set of transformations is very restrictive. The designers desire the exibility of applying a transformation that is not in the set when they see a clear gain in applying it. Secondly, when it is available and also extendable, requirement of skill comes in the way. Designers usually lack the skill required to add new transformations to the existing set with the required formal proofs. Finally, the correctness of the tool at hand itself is questionable. Although a predened set of transformations may have been proven to be formally correct, often there is only a prototype implementation and there is no guarantee that the prototype is a correct implementation. As a result, in practice, designers, supported by some analysis tools, manually apply complex transformations, relying mainly on a combination of application know-how, experience and ingenuity. A proof of equivalence by a separate tool can substantially increase the condence that the functionality is preserved, and this warrants the need for a posteriori methods. Equivalence checking, in general, is well-known to be undecidable. Therefore, an automated check has to be based on a decidable condition that is sucient for equivalence between initial and transformed programs. If the condition holds, the transformation is safe, ensuring the equivalence; otherwise, not much can be concluded. In the latter case, to be useful, the check should be able to pinpoint a reasonably small program fragment that is at the origin of the failure to prove equivalence. The recent work on translation validation [4], addresses a very related problem of a posteriori validating whether the target code produced by a compiler is a correct translation of the source program, providing an alternative to the verication of translators/compilers. But in this technique, a trade-o exists between the class of transformations that can be checked and the extent of compiler instrumentation that is required to provide enough information to the validator about the transformations applied. Our attempt is to provide a source-to-source transformation verication infrastructure and is complementary to translation validation.

3 Transformation Verication Framework The technique is an implementation of the scheme shown in Figure 1. Given the initial and transformed program pair, the geometrical models are extracted using static analysis from the two programs. The models are formulas that encode ane constraints on integer variables, logical connectives and quantiers, also called Presburger formulas, symbolically representing the dependency mapping between the dened variable and the operand variables. Verication involves forming the appropriate necessary and sucient equivalence conditions and checking them for each mapping in the corresponding assignment statements in the two programs. To be able to nd correspondence between the assignment statements in the two programs, in the presence of non-matching intermediate variables and distributed expressions, it is necessary to canonicalize the statements dening the output variables by eliminating the intermediate variables. Since we forbid algebraic data-ow transformations, once the statements are in canonical form, there has to be a corresponding match between the two programs in order to have equivalence of computation. After identifying the correpondences, we use Omega calculator [2] to evaluate our checks. If a condition does not hold, the transformed program is debugged with the error diagnostics generated as a result of invalidity of the condition. The equivalence checking itself is done completely oblivious of any information about either the particular transformations that have been applied or the order in which they have been applied. As a result, the check provides a proof of equivalence that is independent of the agent applying the transformations.

source-to-source transformations Initial program

Transformed program

equivalence Geometrical model

Geometrical model checking

O.K.

Not O.K. + error diagnostics

Figure 1: Transformation verication scheme Owing to lack of space, we provide only a very brief illustration of the technique on our toy example: the initial program has tmp[] as an intermediate variable and the transformed program has buf1[] and buf2[] as intermediate variables. Once we have extracted the mappings for each of the statements in the initial program, we calculate back the dependency of the output variable out[] on the input variable in[] by taking composition of the mappings across statements, essentially eliminating the intermediate variables. The resulting canonical signature of the computation dening out[] on in[] along with the associated dependency mapping between them should have an exact corresponding match in an assignment statement extracted similarly from the transformed program. There is only one canonical signature of computation for the initial program i.e., out[i] = g(f(in[i]) with the dependency mapping M := { [i] → [i] | 0 ≤ i ≤ 255 ∧ i ∈ Z} between out[] and in[]. The transformed program provides a match for this signature with the mapping M0 . A check on the equivalence of the two mappings i.e., M = M0 , holds, proving that the two programs assign exactly same values to out[].

4 Implementation and Present Status We have implemented our technique in GMV  Geometric Model Verier, a prototype tool which integrates calls to the geometrical model extractor and the Omega and coordinates the constructed checks and provides error location information to the user. GMV has successfully veried transformations applied on some real life examples with many complex loops and multi-dimensional arrays, like implementations of signal processing application cores like Durbin, Mpeg-4 motion estimation kernel and updating singular value decomposition (USVD) algorithm. The verication was possible in a push-button style and took time only in the order of few seconds. In the USVD case, it detected a bug in the transformed USVD code (400 lines of code), which was traced to a bug in the constant propagation unit of the code generator that a prototype loop transformation tool used. Presently we are investigating the particular case of a cyclic recursive dependency of an array variable on itself in the presence of computation. Currently we do not allow transformation of statements in such a cyclic dependency. A solution to this case, consistent with the rest of the analysis, will render the technique complete for the listed set of transformations. In future work we will investigate extension of the framework to handle algebraic data-ow transformations and develop a tight approximation to handle programs with non-linear loop iterator and array index expressions.

References [1] Catthoor, F., S. Wuytack, E. de Greef, F. Balasa, L. Nachtergaele, and A. Vandecappelle, Custom Memory Manage-

ment Methodology - Exploration of Memory Organization for Embedded Multimedia System Design . Kluwer Academic Publishers. 1998.

[2] Kelly, W., V. Maslov, W. Pugh, E. Rosser, T. Shpeisman, D. Wonnacott, The Omega Calculator and Library, Version 1.1.0. 1996. Available from: http://www.cs.umd.edu/projects/omega

[3] Shashidhar, K.C., M. Bruynooghe, F. Catthoor and G.Janssens. Geometric Model Checking: An Automatic Verica-

tion Technique for Loop and Data Reuse Transformations. International Workshop on Compilers Optimization Meets Compiler Verication (COCV'02). In ENTCS, Elsevier Science, Vol. 65, No.2, 2002.

[4] Zuck, L., A. Pnueli, Y. Fang and B. Goldberg. VOC: A Translation Validator for Optimizing Compilers. International Workshop on Compilers Optimization Meets Compiler Verication (COCV'02). In ENTCS, Elsevier Science, Vol. 65, No.2, 2002.

Automatic A Posteriori Veri cation of Certain Global ...

the design of multimedia applications for embedded systems. .... signature of the computation defining out[] on in[] along with the associated dependency ...

201KB Sizes 1 Downloads 158 Views

Recommend Documents

Speci cation, Veri cation and Prototyping of an ...
The development of computer-based systems can benefit from a formal approach at all levels of ... This phase is popularly called the optimization phase.

Automatic Synthesis of a Global Behavior from Multiple ...
Finite state (to get computability of the synthesis). Nondeterministic (devilish/don't ... Incomplete information on effects of actions in the domain. Action outcome ...

LA OFS_ORDO VERI NOMINIS.pdf
Iglesia en Cristo y la restitución de un mundo redimido a Dios Padre? Page 3 of 3. LA OFS_ORDO VERI NOMINIS.pdf. LA OFS_ORDO VERI NOMINIS.pdf.

TARIFF TREATMENT OF CERTAIN ... - WorldTradeLaw.net
Feb 27, 2015 - RUSSIA - TARIFF TREATMENT OF CERTAIN AGRICULTURAL. AND MANUFACTURING PRODUCTS ... agricultural and manufacturing sectors. On 31 October 2014, the European Union requested ... 1 January 2016 (sixth measure at issue). Secondly, for certa

a certain smile 1958 ...
Try one of the apps below to open or edit this item. a certain smile 1958 film_____________________________________________.pdf. a certain smile 1958 ...

a certain smile 1958 ...
Try one of the apps below to open or edit this item. a certain smile 1958 online___________________________________________.pdf. a certain smile 1958 ...

Certain Characteristics of Unlicensed Tree Expert Companies ...
(69.91%) found to be advertising tree services online were unlicensed tree experts (UnLTEs). .... other records in the listing of over 1,400 UnLTEs be- ... online directories of Verizon and AT&T telephone listings is ..... fónicas en Internet.

COMMENTS ON A CERTAIN BROADSHEET.pdf
... que alcanzó resonante éxito en. Inglaterra cuando, en 1881, se publicó. (N. del T.) 2 Se trata de La vie des abeilles (1901), de Maurice Maeterlink (1862-1949). (N. del T). Page 1 of 21. Page 2 of 21. Page 3 of 21. COMMENTS ON A CERTAIN BROADS

Certain Affinity - googleusercontent.com
Establish data driven decisions as a key pillar of the design ... analytics provider will ever have everything you need out of the box, it is great to have a solution ...

Certain Affinity - googleusercontent.com
pillar of the design process starting in pre-production ... Patrick Bergman, Business Development Manager. Background ... Ramping Up Reporting. Certain Affinity has used Google Analytics for website analytics since 2005, and began talking ...

Certain Affinity - googleusercontent.com
a successful soft launch. “The flexibility ... All other company and product names may be trademarks of the respective companies with which they are associated.

Certain Affinity
The Google Mobile App Analytics was pivotal ... first mobile title, Age of Booty: Tactics ... The most notable among those are co-development on the Left 4. Dead ...

Use of Calculated Cation- Binding Energies to Predict ...
Data was recorded using QuB software (www.qub. buffalo.edu) .... Cheeseman, J. R.; Montgomery, Jr., J. A.; Vreven, T.; Kudin, K. N.; Bu- rant, J. C.; Millam, J. M.; ...

Certain Affinity
Approach. • Establish data driven decisions as a key pillar of the design process starting in pre-production. • Integrate Google Analytics to understand and optimize UI flow, customer behavior, and accessibility. • Leverage GA for A/B testing t

Efficient approximation of the solution of certain ...
May 24, 2011 - ing an ε-approximation of such a solution by means of a homotopy contin- .... the point of view of its solution by the so-called robust universal ...

Certain Affinity
Analytics. “Google Analytics was a vital component of our overall development process. It ... Patrick Bergman, Business Development Manager ... The early inclusion of GA into the design process resulted in easy access to analytics to assist in infl

Certain Knowledge
and district attorneys investigate and prosecute crimes: Why wasn't this ... began interviewing witnesses and reviewing evidence, the state's case against ...

Generation and reactions of thiirenium ions by the Cation ... - Arkivoc
Nov 5, 2017 - Department of Synthetic Chemistry and Biological Chemistry, Graduate School of Engineering,. Kyoto University .... which is similar to the tendency of seleniranium ions reported in the literature.34 The higher frequency and the shorter

Quantum Simulation of Helium Hydride Cation ... - Research at Google
Apr 23, 2015 - hartree, which is 10 orders of magnitude below the desired chemical precision. As NV centers in ... Publication Date (Web): April 29, 2015 | doi: 10.1021/acsnano.5b01651 ... well as a host of metrology and sensing experi- ments.44,45 .

Watch A Certain Smile (1958) Full Movie Online Free ...
Watch A Certain Smile (1958) Full Movie Online Free .Mp4______________.pdf. Watch A Certain Smile (1958) Full Movie Online Free .Mp4______________.