Skip to content

Commit

Permalink
Merge branch 'p4a-packages' into p4a
Browse files Browse the repository at this point in the history
* p4a-packages:
  oops...
  Ensure the variable  is always defined in setup_pips.sh
  ignore some functions for the validation
  andorre was updated
  document new feature.
  add ability to ignore some functions
  correct name of the function that disapear?
  add some test case for ICM with declaration statement inside the loop
  modify placement of affectation of indices
  For ICM, reindent some functions, add static attribute for some function, use macro pips_debug instead of ifdebug() {fprintf(stderr, ...);}, add more debug message, minor typo correction, -->> In function icm_loop_rwt, modify the order in the generate code beteween the loop body and the affectation of the loop indices; -->> In function SimplifyGraph, add a test to discriminate declaration statement (for effects on environment),        and propose a workaround for declaration statement, but (in theory) no proof of it works, and (in practice) not really validate it (not enough test case)
  update vc check
  add help option
  add bound option
  activate deps in phase0 & phase2
  activate deps on phase0 & phase2
  pipsmake-rc.tex: some limited reorganization of the documentation about properties related to the printouts of data dependence graphs
  add explicit include dependencies for phase0
  WIP: explicit header generation dependencies for phase0 this commit is mostly for testing purpose, to check whether it reduces the occasional automatic compilation fails
  ignore++
  svn ignore++
  semantics/expression.c: bug fix for casee for08 submitted by Nelson Lossing
  Semantics-New: for08 is no longer a but, for09 is analyzed but not precisely; same for update01, declared as a bug because of the lack of accuracy in the analysis in some code due to Nelson Lossing
  comment execution of dot to generate png
  update to new signature
  use context sort to avoid global variables.
  new result permitted by improve cumulated_in_effect, pips:r22288
  Modify r_in_effects_of_sequence function to improve the cumulated_in_effects for declaration (now at declaration time we keep the information that the declared variable can be READ in the following code, when before we simply don't consider at all the variable declared). This function certainly make some memory leak, but I don't understand enough when the lists are modified in place or when a list is created (so when we must freed some of these lists)
  add tpips file to handle __bswap_xx functions added by #include<stdlib.h>
  add more information for debug message
  correct test case Effects/Live_Paths.sub/for03.c, to not access a negative cell of an array
  Semantics-New/for08.c: bug submitted by Nelson
  Transformations/Unroll.sub: derived entities now supported in unrolling (unroll20 and 21), but not their initializations (unroll22 and 23)
  ri-util/clone_statement.c and variable.c: new support for derived entities, i.e. struct union and enum; the new function(s) in variable.c should be in entity.c if variable is understood in a strict way; but the code for derived entities is a variation of a pre-existing code for variables
  Transformations/Unroll.sub: unroll19 no longer a bug; unroll20 and 21: new bugs dur to bad handling of struct declarations
  transformations/loop_unroll.c: update dependent types as constant types when a full unroll is performed
  Transformations/Unroll.sub/unroll18,c: dependent type is detected and the loop is not unrolled
  Transformations/Unroll.sub/unroll18,c: dependent type is detected and the loop is not unrolled
  transformations/loop_unroll.c: do not unroll loops with dependent types
  Transformations/Unroll.sub: perform renaming on typedef types
  ri-util/clone_statement.c: fix storage for typedef variables, and fix declarations for variables declared with a typedef; no validation of recursive typedefs
  Add comments. the function intent is not so clear, and it is probably buggy one way or another.
  transformations/flatten_code.c: cosmetic braces added
  ri-util/clone_statement.c: bug fix
  code cleanup after a discussion with CA
  FIX bad commit done in r22279: add no break in comment to not redo it.
  reindentation add effect_pointer_function file in documentation, to inventory pointer functions that are use to compute effects/region and the functions that can be pointed add inside code, comment for functions that can be pointed for effect pointer functions add some 'break;' statement after pips_internal_error(), in switch case to avoid warning
  Transformations/Flatten_code.sub: add cases requiring no renaming + updates for enum01, struct01 and union01
  transformations/flatten_code: new way to compute the current scope
  ri-util/statement.c: typo fix in comment
  transformations/flatten_code.c: a bit more permissive to handle some VLA cases
  transformations/flatten_code.c: let us be more flexible for vla formal parameters because their declarations are not moved and thus do not generate scheduling issues
  Transformations/Flatten_code: vla01 added to check detection of variable length arrays
  ri-util/type.c: dependent_type_p() added; transformations/flattened_code.c: detection of variable-length arrays added to avoid generating wrong C code
  Transformations/Flatten_code: enum01 and 02 added
  transformations/flatten_code.c: forgotten enum case
  C_syntax/decl48: a typedef was not displayed in the symbol table
  ri-util/clone_statement.c: bug fix for typedef replication; but the underlying problems, which are that typedef do not need to be replicated if they are moved at the beginning of the statement, or that they cannot be moved safely at the beginning of the statement when they refer dependent types, are not handled
  Transformations/Faltten_code.sub: union01 and 02 added, better results for most recent cases; struct01.bug is more a feature than a bug...
  transformations/flatten_code.c: add type renaming to process typedef properly
  Transformations/Faltten_code.sub: struct01 and struct02 added as bugs; struct01 could be called a feature because the resulting code could still be compiled
  Transformations/Flatten_code.sub: typedef01 is no longer a bug (revision 22270); typedef02 is a new bug...
  transformations/flatten_code: a first bug fix for typedefed types
  add flatten code issue with dependent type
  flatten code issue for typedef
  modify Rice/for06.tpips, to generate dependence graph and not usedefchain (2 .png are create after the execution of the tpips in the result folder)
  improve output of dependence graph, instead of just R/W, show R/W for data, RE/WE for environment declaration, RT/WT for type definition
  remake indentation of some functions in ricedg/util.c
  Transformations/Unroll: unroll18 and 19; bugs with unrolling; similar to unroll16 and 17, but with a dependent type
  Transformations/Unroll: unroll16 and 17 to show bug(s) when typedef statements are unrolled; it would be safer to perform unrolling by adding an extra-level of braces and then by applying other passes to remove the braces; the current unroll passes are trying to do too much and do not do it well; this is linked to the paper prepared by Nelson and Pierre about source-to-source transformations in C
  Semantics-New: for07, bug found by Nelson Lossing; no core dump any more, but wrong result for loop distribution nevertheless; this new bug is for Nelson...
  ri-util/entity.c: bug fix for typedef_entity_p(); the previous version only worked for typedef statements placed at the highest possible scope level
  add new exemple for that use DISTRIBUTER
  remove pipsgroup email addresses
  Add MEMORY_EFFECTS_ONLY check for distributer pass
  remove a pips_debug(0, ...)
  Additional filter to eliminate calls being simple initialization of  scalar variables
  To deal with restructured for loops, and call encapsulated in expressions These calls are initialization of iterators and do not have to be taken into account
  add another dependant_type example
  add a reduction + return value for exemple on dependant type
  add example for live path with dependant type
  Improve Transformations/feron test case.
  add a dead code elimination pass to Expressions/fs06
  To deal with cornerturn 3D to 5D
  Update Transformations/Scalarization.sub/sven04 output.
  Remove fs06.bug, add fs06.result/test
  Fix ticket #750.
  add test case for MEMORY_EFFECTS_ONLY property in conjunction with forward substitution
  pipsmake-rc.tex: fix a few typos related to live paths
  Fix MEMORY_EFFECTS_ONLY FALSE preventing partial evaluation for feron example
  pips.bib: a few TOPLAS references added
  pipsmake-rc.tex: double publication for specialization slicing, PLDI and TOPLAS
  pipsmake-rc.tex: reference to specialization slicing added; note: the documentation of the cloning passes is very poor
  Semantics-New: masse_vmcai_2014_06 test cases added for a bug with transformer lists
  transformer: bug fix for transformer list
  typo fix in src/README
  add usage info for setup_pips.sh
  fix setup_pips.sh failing if gfortran or g77 are not installed
  Preprocessor: update for bug cominc
  preprocessor/lexer.l: improved error message for Preprocessor/cominc.c, TRAC Ticket 748
  Test case for ticket #748
  tpips and result for analyse of regionout01
  add an example for automatic distrib that can't be good for region out
  add some more examples for automatic generation of distributed code with what we want as result
  add some more examples for futur automatic generation of code distributed (for the second phase)
  add some example for futur automatic generation of code distributed
  -add information in documentation -modify scope of two functions (add static) -modify substitute_entity_in_expression to use gen_context_multi_recurse
  update validation with modifiation done by r22214
  correct new_controlizer, unspaghettify was made too early  so move to make it after modification with loop cotrolizer
  Semantics: give up some information in the transformers of while loops
  Semantics: give up some information in the transformers of while loops
  Semantics-New: give up some information in the transformers of while loops
  semantics/expression.c: bug fix for modulo abstraction
  semantics/linear: bug fix for modulo abstraction of expressions with implicitly coerced types
  linear/sc/smith.c: bug fix
  alias-classes: improved dprint() for transformers
  ri-util/expression.c: expression_opposite_p() added
  transformer: support for abstraction of modulo by a constant
  semantics: use the old algorithm for loops for the time being because the new one seems much slower
  semantics/expression.c: handling of modulo by a constant, update for multiplication abstraction
  validation/Regions: comments updated for Old.sub/jacobi02 because of change in outlining
  validation/Pointers: two bugs related to (modified?) handling of call sites
  validation/Crough: implict output formatting replaced by explicit formatting; Fortran double precision or real*8 seems to be implented as real*4 both by f77 and gfortran...
  valildation/Preprocessor: improved line numbering, empty lines better preserved
  add an example of difference between old and new controlizer
  update the doc
  Fix for typo in pipsmake-rc.tex
  undo r22162, modify macro effect_any_entity to use effect_to_entity
  remove function effect_to_entity, already present as a macro effect_any_entity
  add information about function make_entity_copy_... add a free to correct a memory leak modify make_entity_copy to use generic_mak_entity_copy
  add comment into the documentation
  pragma: rename dir to add .result
  add examples with pragma
  doc correct a typo
  add a comment for polylib
  check etags.
  reindent & add some comments here & there.
  ticks is currently *NOT* 60 on Linux.
  allow to override the ETAGS generator.
  Semantics-New: a few new test cases for Vivien
  matrix/smith.c: function matrices_to_1D_lattice() added
  minore cleanup while reading the code
  flip-flop01.later added temporarily
  Semantics-New: Dilig test case from OOPSLA 2013 added
  add host.
  alias-classes: assignment.c and points_to_interprocedural_analysis.c removed
  alias-classes: emami.c and points_to_analysis_general_algorithm.c removed; a few useless functions removed from constant-path-utils.c
  ri-util/ri-util-local.h: DEFAULT_POINTER_TYPE_SIZE is made constant to improve the portability of the PIPS validation suite
  documentation for eclipse: correct some typo add more informations
  alias-classes/README: additional explanation about the naming of obsolete functions
  minor typo
  documentation for eclipse: modify svn url to scm url add some remarks
  add svn info to log.
  get-pips4u.sh: display path for python2.7 instead of 2.6
  Fix SVN urls in get-pips4u.sh
  Define missing variables in setup_pips.sh
  setup_pips.sh does not fail if there is no development branch
  validation: new comments linked to outlining
  accel-util/outlining.c: use (more) specific comments for new variable declarations; large impact on validation...
  ri-util: clean up in declarations.c, new function added in util.c
  Do not block PIPS compilation with cproto warning in setup_pips.sh
  Enable -jX compilation flag in setup_pips.sh
  semantics/loop.c: comments added, semantics unchanged
  Improvements and refactoring in setup_pips.sh
  Semantics-New/flip-flop02: the result expected for flip-flop01 is obtained with an external while loop; the issue seems to be linked to the analysis of DO loops vs the analysis of WHILE loops; all loops are assumed analyzed in a unified way, but DO loops are still processed with an older function that seemed to work well-enough to avoid a validation nightmare in case it were upgraded with the unified algorithm; also, flip-flop03 is added
  validation/Outlining: three bug files added for a unique underlying bug. See Ticket 746
  outlining.c: comments added for outliner_patch_parameters()
  pipsmake-rc.tex: comments about Pass Outlining slighlty modified
  Task_parallelization/Instrumentation.sub: the validation is a joke; only one test case is defined; and a bug  is detected by gcc...; also we have to  think about rating the different passes automagically in pipsmake-rc.tex with the numbers of test cases and bugs...
  Task_parallelization/SPMDization.sub/communications01: the test file was empty; I have no idea if the out file is correct or not; this should be dealt with by Dounia...
  Gpu/matmul04: bug and internal error in kernel_load_store pass
  Demo/SC95.sub: improved accuracy due to a better approximation of a square by the semantics pass9es); the accuracy would improved even more if transformers were computed in context
  Effects/Old.sub/dereferencing03: I validate the new result because it is correct; the old result was correct too because it was an over-approximation; the source code is bugged wrt the standard; the execution should core dump; I do not know if the semantics of cumulated pointer effects is defined precisely enough in case of core dumps...; maybe we should not use too many buggy pieces of code in the validation; errors with pointers are not exploited by Pass control_simplification
  AcceleratorUtils/Isolate_statement.sub/isolate14: new bug declared; Serge might have forgotten a sort before code generation
  Scalopes/wcdma_original.bug: nobody to perform maintenance; not a recent bug on April 4th, 2014
  Shameless attempt to normalize coding style in setup_pips.sh
  Check availability of ncurses.h in setup_pips.sh
  workaround for make clean failing in a svn branch
  Fix a typo in Semantics-New/README
  Updated dependency check for install script setup_pips.sh
  Remove dependency to the venerable text editor ed
  add missing file for auto stuff


Former-commit-id: 86bc504ec1b723185b62daeb870653a7249035ea
  • Loading branch information
keryell committed Dec 6, 2014
2 parents 16c4013 + 43d568c commit 53d62b9
Show file tree
Hide file tree
Showing 417 changed files with 31,134 additions and 17,158 deletions.
2 changes: 1 addition & 1 deletion packages/PIPS/linear/src/README
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ The C data type for the coefficients is Value. It can be set to 32 or
64 bit integers, but is incompatible with big nums. Arithmetic
overflows are trapped.

The library is also interfaced with the Janus libray.
The library is also interfaced with the Janus library.

BUILDING THE LIBRARIES
----------------------
Expand Down
84 changes: 58 additions & 26 deletions packages/PIPS/linear/src/Tests/sc_proj.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,46 +37,78 @@ extern char * sc_internal_symbol_table(char *);
int main(int argc, char * const argv[])
{
// option management
bool reverse = false;
int debug = 0;
int opt;
while ((opt = getopt(argc, argv, "rD")) != -1) {
bool reverse = false, bound = false;
int debug = 0, opt;
while ((opt = getopt(argc, argv, "bhrD")) != -1) {
switch (opt) {
case 'r': reverse = true; break;
case 'b': bound = true; break;
case 'D': debug++; break;
case 'h':
fprintf(stdout,
"usage: %s [-r or -b] variables... < system\n"
"\tdefault: project listed variables\n"
"\t-r: project all but the listed variables\n"
"\t-b: show bounds on listed variables\n",
argv[0]);
exit(0);
default: exit(1);
}
}
// get system
// only one of -r and -b
assert(!(reverse && bound));

// get system from stdin
Psysteme s;
bool ok = sc_fscan(stdin, &s);
assert(ok);
if (debug >= 2) sc_fprint(stderr, s, *variable_default_name);
// project & simplify
if (reverse) {
Pbase bnext;
for (Pbase b = sc_base(s); b && s; b = bnext) {
// Oops: the system may be nullifed by sc_projection...
// so the next iteration must not rely on it
bnext = vecteur_succ(b);
bool keep = false;
for (int i = optind; i < argc; i++) {
if (strcmp(argv[i], vecteur_var(b)) == 0) {
keep = true;
break;
}
}
if (!keep)
s = sc_projection(s, vecteur_var(b));
}

// get command arguments as a base
Pbase arg_base = BASE_NULLE;
for (int i = optind; i < argc; i++)
arg_base = base_add_variable(arg_base, sc_internal_symbol_table(argv[i]));

Pbase proj_base;
if (reverse || bound) {
proj_base = vect_copy(sc_base(s));
for (Pbase b = arg_base; b != BASE_NULLE; b = vecteur_succ(b))
proj_base = base_remove_variable(proj_base, vecteur_var(b));
}
else {
for(int i = optind; i < argc && s; i++)
s = sc_projection(s, sc_internal_symbol_table(argv[i]));
proj_base = vect_copy(arg_base);
}
if (debug) sc_fprint(stderr, s, *variable_default_name);

// project all "proj_base" variables
for (Pbase b = proj_base; b != BASE_NULLE; b = vecteur_succ(b))
s = sc_projection(s, vecteur_var(b));

// cleanup
sc_nredund(&s);

if (debug) sc_fprint(stderr, s, *variable_default_name);

// print out result
sc_fprint(stdout, s, *variable_default_name);
if (bound) {
// we must bound each remaining variables
for (Pbase b = arg_base; b != BASE_NULLE; b = vecteur_succ(b)) {
Variable keep = vecteur_var(b);
Psysteme sb = sc_copy(s);
// YES, we use *s* base
for (Pbase c = sc_base(s); c != BASE_NULLE; c = vecteur_succ(c)) {
if (vecteur_var(c) != keep)
sb = sc_projection(sb, vecteur_var(c));
}
sc_nredund(&sb);
sc_fprint(stdout, sb, *variable_default_name);
sc_rm(sb);
}
}
else
sc_fprint(stdout, s, *variable_default_name);

base_rm(arg_base);
base_rm(proj_base);
sc_rm(s);
return 0;
}
32 changes: 32 additions & 0 deletions packages/PIPS/linear/src/deps.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
ifdef USE_DEPS
fwd-contrainte:fwd-vecteur
fwd-sc:fwd-contrainte
fwd-sc:fwd-vecteur
fwd-ray_dte:fwd-contrainte
fwd-ray_dte:fwd-vecteur
fwd-sommet:fwd-contrainte
fwd-sommet:fwd-ray_dte
fwd-sommet:fwd-sc
fwd-sommet:fwd-vecteur
fwd-sparse_sc:fwd-contrainte
fwd-sparse_sc:fwd-matrice
fwd-sparse_sc:fwd-matrix
fwd-sparse_sc:fwd-sc
fwd-sparse_sc:fwd-vecteur
fwd-sg:fwd-ray_dte
fwd-sg:fwd-sommet
fwd-sg:fwd-vecteur
fwd-polynome:fwd-vecteur
fwd-union:fwd-contrainte
fwd-union:fwd-polyedre
fwd-union:fwd-sc
fwd-union:fwd-sommet
fwd-union:fwd-vecteur
fwd-polyedre:fwd-contrainte
fwd-polyedre:fwd-polynome
fwd-polyedre:fwd-ray_dte
fwd-polyedre:fwd-sc
fwd-polyedre:fwd-sg
fwd-polyedre:fwd-sommet
fwd-polyedre:fwd-vecteur
endif # USE_DEPS
27 changes: 20 additions & 7 deletions packages/PIPS/linear/src/local.mk
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# $Id$

# arithmetique:
# vecteur[arithmetique]: vectors
# contrainte[vecteur]: constraints
# sc[contrainte,vecteur]: systems (equalities and inequalities)
# arithmetique:
# vecteur[arithmetique]: vectors
# contrainte[vecteur]: constraints
# sc[contrainte,vecteur]: systems (equalities and inequalities)
# matrice: rational dense matrices
# ray_dte:
# ray_dte:
# sommet[ray_dte,vecteur]: for constraints, systems and functions (?)
# plint[sommet,matrice,sc]: integer linear programming
# sparse_sc[matrice,sc]: sparse systems
Expand All @@ -28,8 +28,21 @@ FWD_DIRS = \
polyedre \
doxygen \
linearlibs

# plint \
# plint
# Tests

FWD_PARALLEL = 1

ifeq ($(FWD_TARGET),phase0)
USE_DEPS = 1
else ifeq ($(FWD_TARGET),phase2)
USE_DEPS = 1
endif

# (re)build inter library header dependencies
deps.mk:
{ \
echo 'ifdef USE_DEPS'; \
inc2deps.sh $(FWD_DIRS) | sed -e 's/:/:fwd-/;s/^/fwd-/'; \
echo 'endif # USE_DEPS'; \
} > $@
83 changes: 82 additions & 1 deletion packages/PIPS/linear/src/matrix/smith.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,5 +149,86 @@ Pmatrix Q;
matrix_print(Q);
#endif
}


/* Under the assumption A x = B, A[n,m] and B[n], compute the 1-D
* lattice for x_i as
*
* x_i = gcd lambda + c
*
* when possible, using the Smith form of A, with D = P A Q and P and
* Q unimodular
*
* inv(P) S inv(Q) x = b
*
* inv(P) S y = b => S y = P b => some components of y are constants, yc
*
* y = inv(Q) x => x = Q y
*
* c = Q y_c
*
* gcd = gcd_{j s.t. yc_j = 0} Q_{i,j}
*
* Return false if the system Ax=b has no solution
*
* This implements a partial parametric resolution of A x = B. It
* might be better from an engineering viewpoint to solve the system
* fully and then to exploit the equation for x_i.
*/
int matrices_to_1D_lattice(Pmatrix A, Pmatrix B, int n, int m, int i, Value * gcd_p, Value * c_p)
{
// The number of equations is smaller than the number of variables
// Not necessarily because you may have redundant equations
// assert(n<=m);
int success = 1;
Pmatrix P, D, Q;
P = matrix_new(n,n);
D = matrix_new(n,m);
Q = matrix_new(m,m);
matrix_smith(A,P,D,Q);
// Compute P b
Pmatrix Pb = matrix_new(n, 1);
matrix_multiply(P, B, Pb);
// Compute yc by solving D yc = P b
Pmatrix yc = matrix_new(m, 1);
int j;
for(j=1; j <= m; j++)
MATRIX_ELEM(yc, j, 1) = VALUE_ZERO;
// FI: it might be sufficient to check the pseudo-diagonal element Dii
for(j=1; j <= n; j++) {
Value Pbj = MATRIX_ELEM(Pb, j, 1);
if(!value_zero_p(Pbj)) {
Value Djj = MATRIX_ELEM(D, j, j);
if(!value_zero_p(Djj)) {
Value r = modulo(Pbj, Djj);
if(value_zero_p(r))
MATRIX_ELEM(yc, j, 1) = DIVIDE(Pbj, Djj);
else
success = false;
}
}
}
if(success) {
// Compute the constant term "c" and the gcd "gcd" with x = Q yc
*c_p = VALUE_ZERO;
for(j=1; j <= n; j++) {
*c_p += value_mult(MATRIX_ELEM(Q, i, j), MATRIX_ELEM(yc, j, 1));
}
*gcd_p = VALUE_ZERO;
for(j=n+1; j <= m; j++) {
if(value_zero_p(*gcd_p))
*gcd_p = MATRIX_ELEM(Q, i, j);
else if(!value_zero_p(MATRIX_ELEM(Q, i, j)))
*gcd_p = pgcd(*gcd_p, MATRIX_ELEM(Q, i, j));
}
// With no information at all, the gcd default value is one
if(value_zero_p(*gcd_p))
*gcd_p = VALUE_ONE;
*c_p = modulo(*c_p, *gcd_p);
}
free(P);
free(Pb);
free(D);
free(Q);
free(yc);
return success;
}
5 changes: 4 additions & 1 deletion packages/PIPS/linear/src/sc/sc-local.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ typedef struct Ssysteme {
int nb_ineq;
int dimension;
Pbase base;
} *Psysteme,Ssysteme;
} *Psysteme,Ssysteme;

/* - Traitement des overflows :
* ~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -242,4 +242,7 @@ les anciens noms des fonctions */

typedef int (*two_int_infop)[2];

typedef int (* constraint_cmp_func_t)
(const Pcontrainte *, const Pcontrainte *, void *);

#endif /* SYSTEME */
Loading

0 comments on commit 53d62b9

Please sign in to comment.