Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/cloog/options.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ struct cloogoptions
int noblocks ; /* 1 if I don't want to make statement blocks, 0 otherwise. */
int noscalars ; /* 1 if I don't want to use scalar dimensions, 0 otherwise. */
int nosimplify; /* 1 if I don't want to simplify polyhedra, 0 otherwise. */
int scop_options;/* 1 if osl_cloogoptions are to be used */
} ;


Expand Down
2 changes: 1 addition & 1 deletion osl
Submodule osl updated 54 files
+2 −2 AUTHORS
+35 −8 CMakeLists.txt
+16 −0 COPYING
+2 −107 ChangeLog
+6 −5 Makefile.am
+1 −1 README
+9 −9 configure.ac
+27 −5 doc/Makefile.am
+115 −33 doc/openscop.texi
+4 −0 include/osl/body.h
+6 −2 include/osl/extensions/extbody.h
+1 −0 include/osl/extensions/null.h
+139 −0 include/osl/extensions/pluto_unroll.h
+9 −4 include/osl/generic.h
+64 −31 include/osl/int.h
+6 −1 include/osl/macros.h
+2 −0 include/osl/osl.h
+36 −34 include/osl/relation.h
+1 −1 include/osl/relation_list.h
+2 −1 include/osl/scop.h.in
+4 −1 include/osl/statement.h
+31 −3 include/osl/strings.h
+1 −0 include/osl/util.h
+33 −25 m4/ax_submodule.m4
+1 −3 source/body.c
+1 −1 source/extensions/arrays.c
+6 −5 source/extensions/clay.c
+6 −5 source/extensions/comment.c
+1 −1 source/extensions/coordinates.c
+1 −1 source/extensions/dependence.c
+1 −1 source/extensions/extbody.c
+17 −17 source/extensions/irregular.c
+1 −1 source/extensions/loop.c
+1 −1 source/extensions/null.c
+422 −0 source/extensions/pluto_unroll.c
+1 −1 source/extensions/scatnames.c
+1 −1 source/extensions/symbols.c
+4 −4 source/extensions/textual.c
+6 −4 source/generic.c
+597 −137 source/int.c
+2 −0 source/interface.c
+52 −8 source/relation.c
+7 −7 source/relation_list.c
+4 −5 source/scop.c
+63 −33 source/statement.c
+42 −8 source/strings.c
+24 −5 source/util.c
+15 −8 tests/Makefile.am
+420 −0 tests/osl_int.c
+192 −0 tests/osl_pluto_unroll.c
+100 −0 tests/osl_relation_set_precision.c
+10 −17 tests/osl_test.c
+37 −0 tests/test_just_pluto_unroll.scop
+52 −0 tests/test_just_statement_extension.scop
120 changes: 118 additions & 2 deletions source/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@

#ifdef OSL_SUPPORT
#include <osl/scop.h>
#include <osl/extensions/cloogoptions.h>
#endif


Expand Down Expand Up @@ -160,6 +161,7 @@ void cloog_options_print(FILE * foo, CloogOptions * options)
fprintf(foo,"noscalars = %3d.\n",options->noscalars) ;
fprintf(foo,"noblocks = %3d.\n",options->noblocks) ;
fprintf(foo,"nosimplify = %3d.\n",options->nosimplify) ;
fprintf(foo,"scopoptions = %3d.\n",options->scop_options) ;
}


Expand All @@ -182,6 +184,7 @@ void cloog_options_free(CloogOptions *options)
#endif
free(options->fs);
free(options->ls);
free(options->name);
free(options);
}

Expand Down Expand Up @@ -237,6 +240,7 @@ void cloog_options_help()
" (default setting: stdout).\n"
#ifdef OSL_SUPPORT
" -openscop Input file has OpenScop format.\n"
" -scopoptions Use options passed via extension in the scop.\n"
#endif
" -v, --version Display the version information (and more).\n"
" -q, --quiet Don't print any informational messages.\n"
Expand Down Expand Up @@ -341,7 +345,7 @@ CloogOptions *cloog_options_malloc(CloogState *state)
options->strides = 0 ; /* Generate a code with unit strides. */
options->sh = 0; /* Compute actual convex hull. */
options->first_unroll = -1; /* First level to unroll: none. */
options->name = "";
options->name = NULL;
/* OPTIONS FOR PRETTY PRINTING */
options->esp = 1 ; /* We want Equality SPreading.*/
options->fsp = 1 ; /* The First level to SPread is the first. */
Expand All @@ -363,6 +367,7 @@ CloogOptions *cloog_options_malloc(CloogState *state)
options->noblocks = 0 ; /* I do want to make statement blocks.*/
options->noscalars = 0 ; /* I do want to use scalar dimensions.*/
options->nosimplify = 0 ; /* I do want to simplify polyhedra.*/
options->scop_options = 0 ; /* Use command line options by default.*/

return options ;
}
Expand Down Expand Up @@ -457,6 +462,13 @@ void cloog_options_read(CloogState *state, int argc, char **argv,
else
if (strcmp(argv[i],"-nosimplify") == 0)
(*options)->nosimplify = 1 ;
else
if (strcmp(argv[i],"-scopoptions") == 0)
#ifdef OSL_SUPPORT
(*options)->scop_options = 1;
#else
cloog_die("CLooG has not been compiled with OpenScop support.\n");
#endif
else
if ((strcmp(argv[i],"-struct") == 0) || (strcmp(argv[i],"-structure") == 0))
(*options)->structure = 1 ;
Expand Down Expand Up @@ -494,7 +506,7 @@ void cloog_options_read(CloogState *state, int argc, char **argv,
else
{ if (!input_is_set)
{ input_is_set = 1 ;
(*options)->name = argv[i] ;
(*options)->name = strdup(argv[i]);
/* stdin is a special value, when used, we set input to standard input. */
if (strcmp(argv[i],"stdin") == 0)
*input = stdin ;
Expand All @@ -515,6 +527,101 @@ void cloog_options_read(CloogState *state, int argc, char **argv,
}

#ifdef OSL_SUPPORT
/**
* This function extracts CLooG option values from
* an OpenScop osl_cloogtopions extension
* In case no options are found in scop, it keeps the default options
*
* \param[in] scop Input Scop.
* \param[out] options Updated CloogOptions
* \return
*/
void cloog_options_extract_from_scop(osl_scop_p scop, CloogOptions *options){
int j=0;
osl_cloogoptions_p ops = NULL;

if (!options)
cloog_die("Options must be provided.\n");

if (!scop)
cloog_die("SCoP must be provided.\n");

ops = osl_generic_lookup(scop->extension, OSL_URI_CLOOGOPTIONS);

if (ops!=NULL) {
/* OPTIONS FOR LOOP GENERATION */
if (ops->l_set)
options->l = ops->l ;
if (ops->f_set)
options->f = ops->f ;

if (ops->fs_ls_size_set)
options->fs_ls_size = ops->fs_ls_size;
if (ops->ls_set) {
free(options->ls);
if (options->fs_ls_size) { //malloc(0) returns non-NULL ptr
options->ls = (int*) malloc( ops->fs_ls_size*sizeof(int) );
if (options->ls==NULL)
cloog_die("memory overflow.\n");

for (j=0; j< options->fs_ls_size; j++) {
options->ls[j] = ops->ls[j];
}
}
}
if (ops->fs_set) {
free(options->fs);
if (options->fs_ls_size) { //malloc(0) returns non-NULL ptr
options->fs = (int*) malloc( ops->fs_ls_size*sizeof(int) );
if (options->fs==NULL)
cloog_die("memory overflow.\n");

for (j=0; j< options->fs_ls_size; j++) {
options->fs[j] = ops->fs[j];
}
}
}

if (ops->stop_set)
options->stop = ops->stop ;
if (ops->strides_set)
options->strides = ops->strides;
if (ops->sh_set)
options->sh = ops->sh;
if (ops->first_unroll_set)
options->first_unroll = ops->first_unroll;

if (ops->name_set) {
if(options->name)
free(options->name);
options->name = strdup(ops->name);
}
/* OPTIONS FOR PRETTY PRINTING */
if (ops->esp_set)
options->esp = ops->esp;
if (ops->fsp_set)
options->fsp = ops->fsp;
if (ops->otl_set)
options->otl = ops->otl;
if (ops->block_set)
options->block = ops->block;
if (ops->compilable_set)
options->compilable = ops->compilable;
if (ops->callable_set)
options->callable = ops->callable;
if (ops->quiet_set)
options->quiet = ops->quiet;
if (ops->save_domains_set)
options->save_domains = ops->save_domains;
/* MISC OPTIONS */
if (ops->language_set)
options->language = ops->language;
if (ops->openscop_set)
options->openscop = ops->openscop;

options->scop_options = 1;
}
}
/**
* This function extracts CLooG option values from an OpenScop scop and
* updates an existing CloogOption structure with those values. If the
Expand All @@ -528,13 +635,22 @@ void cloog_options_copy_from_osl_scop(osl_scop_p scop,
cloog_die("Options must be provided.\n");

if (scop) {

/* "use options provided in scop" specified */
if (options->scop_options) {
/* Extract the cloogoptions from osl_scop*/
cloog_options_extract_from_scop(scop, options);
}

/* Extract the language. */
if (!strcmp(scop->language, "FORTRAN"))
options->language = CLOOG_LANGUAGE_FORTRAN;
else
options->language = CLOOG_LANGUAGE_C;

/* Store the input SCoP in the option structure. */
if(options->scop)
osl_scop_free(options->scop);
options->scop = scop;
}
}
Expand Down
4 changes: 4 additions & 0 deletions source/program.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ static void print_iterator_declarations(FILE *file, CloogProgram *program,
}
}

#ifdef OSL_SUPPORT
static int get_osl_loop_flags (osl_scop_p scop) {
int flags = 0;
osl_loop_p ll = osl_generic_lookup(scop->extension, OSL_URI_LOOP);
Expand Down Expand Up @@ -360,6 +361,7 @@ static void print_iterator_declarations_osl(FILE *file, CloogProgram *program,
if(loopflags & CLAST_PARALLEL_VEC)
print_declarations(file, 2, vecvar);
}
#endif

static void print_callable_preamble(FILE *file, CloogProgram *program,
CloogOptions *options)
Expand Down Expand Up @@ -403,6 +405,7 @@ static void print_callable_postamble(FILE *file, CloogProgram *program)
fprintf(file, "}\n");
}

#ifdef OSL_SUPPORT
/*
* add tags clast loops according to information in scop's osl_loop extension
*/
Expand Down Expand Up @@ -458,6 +461,7 @@ int annotate_loops(osl_scop_p program, struct clast_stmt *root){

return ret;
}
#endif


/**
Expand Down