From 0bd5a97a056f7703c0260792496ef37fbc376df8 Mon Sep 17 00:00:00 2001 From: Cedric Bastoul Date: Fri, 14 Oct 2011 15:23:44 +0200 Subject: [PATCH] Add OpenScop support This adds OpenScop support. The textual input is added through a new -openscop option while the library input is added through a new cloog_input_from_osl_scop function. For convenience, the OpenScop Library is integrated to CLooG as a submodule. Some basic tests are provided to check that the OpenScop input is not broken. The OpenScop support is disabled by default. Signed-off-by: Cedric Bastoul --- .gitmodules | 3 + Makefile.am | 15 +++-- configure.ac | 34 +++++++++++ doc/cloog.texi | 27 +++++++++ include/cloog/domain.h | 5 ++ include/cloog/input.h | 3 + include/cloog/options.h | 4 ++ include/cloog/union_domain.h | 4 ++ osl | 1 + source/input.c | 42 ++++++++++++++ source/isl/domain.c | 63 +++++++++++++++++++++ source/options.c | 45 ++++++++++++++- source/union_domain.c | 55 ++++++++++++++++++ test/Makefile.am | 38 ++++++++++++- test/openscop/empty.c | 1 + test/openscop/empty.scop | 35 ++++++++++++ test/openscop/matmult.c | 9 +++ test/openscop/matmult.scop | 130 +++++++++++++++++++++++++++++++++++++++++++ test/openscop/union.c | 11 ++++ test/openscop/union.scop | 100 +++++++++++++++++++++++++++++++++ 20 files changed, 618 insertions(+), 7 deletions(-) create mode 160000 osl create mode 100644 test/openscop/empty.c create mode 100644 test/openscop/empty.scop create mode 100644 test/openscop/matmult.c create mode 100644 test/openscop/matmult.scop create mode 100644 test/openscop/union.c create mode 100644 test/openscop/union.scop diff --git a/.gitmodules b/.gitmodules index 8c893c2..4beaf01 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "isl"] path = isl url = git://repo.or.cz/isl.git +[submodule "osl"] + path = osl + url = git://repo.or.cz/openscop.git diff --git a/Makefile.am b/Makefile.am index 259c4ba..2b0fca2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -41,8 +41,13 @@ if BUNDLED_ISL ISL_LA = $(top_builddir)/isl/libisl.la endif -SUBDIRS = $(MAYBE_ISL) . doc test -DIST_SUBDIRS = $(MAYBE_ISL) . doc test +if BUNDLED_OSL + MAYBE_OSL = osl + OSL_LA = $(top_builddir)/osl/source/libosl.la +endif + +SUBDIRS = $(MAYBE_ISL) $(MAYBE_OSL) . doc test +DIST_SUBDIRS = $(MAYBE_ISL) $(MAYBE_OSL) . doc test ACLOCAL_AMFLAGS = -I m4 @@ -85,10 +90,10 @@ SOURCES_CORE = \ DEFAULT_INCLUDES = -I. INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include AM_CFLAGS = $(CFLAGS_WARN) -libcloog_isl_la_CPPFLAGS = @ISL_CPPFLAGS@ +libcloog_isl_la_CPPFLAGS = @ISL_CPPFLAGS@ @OSL_CPPFLAGS@ libcloog_isl_la_LDFLAGS = -version-info @versioninfo@ \ - -rpath $(libdir) @ISL_LDFLAGS@ -libcloog_isl_la_LIBADD = @ISL_LIBS@ $(ISL_LA) + -rpath $(libdir) @ISL_LDFLAGS@ @OSL_LDFLAGS@ +libcloog_isl_la_LIBADD = @ISL_LIBS@ @OSL_LIBS@ $(ISL_LA) $(OSL_LA) libcloog_isl_la_SOURCES = \ $(SOURCES_CORE) \ source/isl/domain.c \ diff --git a/configure.ac b/configure.ac index bb6e423..addb34e 100644 --- a/configure.ac +++ b/configure.ac @@ -162,6 +162,37 @@ AM_CONDITIONAL(BUNDLED_ISL, test $with_isl = bundled) AM_CONDITIONAL(NO_ISL, test $with_isl = no) +dnl /************************************************************************** +dnl * Where is the OpenScop Library? * +dnl **************************************************************************/ + +AX_SUBMODULE(osl,no|system|build|bundled,no) +osl_flag="OSL_SUPPORT" + +AC_SUBST(OSL_CPPFLAGS) +AC_SUBST(OSL_LDFLAGS) +AC_SUBST(OSL_LIBS) +case "$with_osl" in +bundled) + OSL_CPPFLAGS="-D$osl_flag -I$srcdir/osl/include -Iosl/include" + ;; +build) + OSL_CPPFLAGS="-D$osl_flag -I$osl_srcdir/include -I$with_osl_builddir/include" + OSL_LIBS="$with_osl_builddir/libosl.la" + ;; +system) + if test "x$with_osl_prefix" != "x"; then + OSL_CPPFLAGS="-D$osl_flag --I$with_osl_prefix/include" + fi + if test "x$with_osl_exec_prefix" != "x"; then + OSL_LDFLAGS="-L$with_osl_exec_prefix/lib" + fi + OSL_LIBS="-losl" +esac +AM_CONDITIONAL(BUNDLED_OSL, test $with_osl = bundled) +AM_CONDITIONAL(NO_OSL, test $with_osl = no) + + AC_DEFINE([CLOOG_INT_GMP], 1, [Use arbitrary precision integers]) AC_SUBST(GIT_INDEX) @@ -206,6 +237,9 @@ AC_CONFIG_COMMANDS([doc/gitversion.texi], if test $with_isl = bundled; then AC_CONFIG_SUBDIRS(isl) fi +if test $with_osl = bundled; then + AC_CONFIG_SUBDIRS(osl) +fi AC_CONFIG_COMMANDS_POST([ ac_configure_args="$ac_configure_args $cloog_configure_args" ]) diff --git a/doc/cloog.texi b/doc/cloog.texi index 2729f40..4dd2f7a 100644 --- a/doc/cloog.texi +++ b/doc/cloog.texi @@ -829,6 +829,7 @@ input file @code{basic.cloog} with default options by typing: * Unrolling:: * Compilable Code:: * Output:: +* OpenScop:: * Help:: * Version :: * Quiet :: @@ -1238,6 +1239,14 @@ void test(int M, int N) special value: when used, output is standard output. Default value is @code{stdout}. +@node OpenScop +@subsection OpenScop @code{-openscop} + + @code{-openscop}: this option states that the input file complies to + the OpenScop specification instead of the native file format + (@pxref{Bas11}). This option is available only if the OpenScop + support has been enabled at compile time (@pxref{Optional Features}). + @node Help @subsection Help @code{--help} or @code{-h} @@ -2456,6 +2465,19 @@ the multiple precision version. locations. If necessary, the user can specify the GMP path by giving @code{configure} the option @code{--with-gmp-prefix=PATH} and/or @code{--with-gmp-exec-prefix=PATH}. + +@item By default, the OpenScop Library (osl) support is not enabled. +@c @code{configure} will use the bundled OpenScop Library (osl). +Using the @code{--with-osl} option of @code{configure} +the user can specify that @code{no} osl, +a previously installed (@code{system}) osl, a @code{bundled} osl, or a +@code{build} osl should be used. +In the latter case, the user should also specify the build location +using @code{--with-osl-builddir=PATH}. +In case of an installed osl, +the installation location can be specified using the +@code{--with-osl-prefix=PATH} and +@code{--with-osl-exec-prefix=PATH} options of @code{configure}. @end itemize @node Uninstallation @@ -2508,6 +2530,11 @@ Architecture and Compilation Techniques, pages 7-16, Juan-les-Pins, september 2004. @item +@anchor{Bas11}[Bas11] C. Bastoul. A Specification and a Library for Data +Exchange in Polyhedral Compilation Tools. Technical Report, +Paris-Sud University, France, September 2011. + +@item @anchor{Fea92}[Fea92] P. Feautrier Some efficient solutions to the affine scheduling problem, part II: multidimensional time. International Journal of Parallel Programming, 21(6):389--420, December 1992. diff --git a/include/cloog/domain.h b/include/cloog/domain.h index 65fda66..767771b 100644 --- a/include/cloog/domain.h +++ b/include/cloog/domain.h @@ -47,6 +47,7 @@ struct cloogdomain; typedef struct cloogdomain CloogDomain ; struct cloogscattering; typedef struct cloogscattering CloogScattering; +struct osl_relation; /** @@ -123,6 +124,10 @@ CloogScattering * cloog_scattering_from_cloog_matrix(CloogState *state, /****************************************************************************** * Processing functions * ******************************************************************************/ +CloogDomain *cloog_domain_from_osl_relation(CloogState *, + struct osl_relation *); +CloogScattering *cloog_scattering_from_osl_relation(CloogState *, + struct osl_relation *); CloogConstraintSet *cloog_domain_constraints(CloogDomain *); int cloog_domain_isempty(CloogDomain *) ; CloogDomain * cloog_domain_universe(CloogState *state, unsigned dim); diff --git a/include/cloog/input.h b/include/cloog/input.h index 4ad59fa..b3d3c53 100644 --- a/include/cloog/input.h +++ b/include/cloog/input.h @@ -5,12 +5,15 @@ extern "C" { #endif +struct osl_scop; + struct clooginput { CloogDomain *context; CloogUnionDomain *ud; }; typedef struct clooginput CloogInput; +CloogInput *cloog_input_from_osl_scop(CloogState *, struct osl_scop *); CloogInput *cloog_input_read(FILE *file, CloogOptions *options); CloogInput *cloog_input_alloc(CloogDomain *context, CloogUnionDomain *ud); void cloog_input_free(CloogInput *input); diff --git a/include/cloog/options.h b/include/cloog/options.h index 64e286c..b381650 100644 --- a/include/cloog/options.h +++ b/include/cloog/options.h @@ -50,6 +50,8 @@ extern "C" */ #define CLOOG_SCALARS +struct osl_scop; + struct cloogoptions; typedef struct cloogoptions CloogOptions; @@ -94,6 +96,7 @@ struct cloogoptions /* MISC OPTIONS */ char * name ; /* Name of the input file. */ float time ; /* Time spent for code generation in seconds. */ + int openscop; /* 1 if the input file has OpenScop format, 0 otherwise. */ #ifdef CLOOG_MEMORY int memory ; /* Memory spent for code generation in kilobytes. */ #endif @@ -151,6 +154,7 @@ void cloog_options_read(CloogState *state, int argc, char **argv, * Processing functions * ******************************************************************************/ CloogOptions *cloog_options_malloc(CloogState *state); +void cloog_options_copy_from_osl_scop(struct osl_scop *, CloogOptions *); #if defined(__cplusplus) diff --git a/include/cloog/union_domain.h b/include/cloog/union_domain.h index 7fc9eef..5c6ff86 100644 --- a/include/cloog/union_domain.h +++ b/include/cloog/union_domain.h @@ -5,6 +5,8 @@ extern "C" { #endif +struct osl_scop; + /** * CloogNamedDomainList structure: * this structure reprensents a node of a linked list of CloogDomain structures. @@ -40,6 +42,8 @@ CloogUnionDomain *cloog_union_domain_add_domain(CloogUnionDomain *ud, CloogUnionDomain *cloog_union_domain_set_name(CloogUnionDomain *ud, enum cloog_dim_type type, int index, const char *name); void cloog_union_domain_free(CloogUnionDomain *ud); +CloogUnionDomain *cloog_union_domain_from_osl_scop(CloogState *, + struct osl_scop *); #if defined(__cplusplus) } diff --git a/osl b/osl new file mode 160000 index 0000000..3c21683 --- /dev/null +++ b/osl @@ -0,0 +1 @@ +Subproject commit 3c216835c7ab97ec72f474d8cffa6a4cb4da28c9 diff --git a/source/input.c b/source/input.c index 0315d02..39c611c 100644 --- a/source/input.c +++ b/source/input.c @@ -3,6 +3,10 @@ #include #include "../include/cloog/cloog.h" +#ifdef OSL_SUPPORT +#include +#endif + #define ALLOC(type) (type*)malloc(sizeof(type)) static char *next_line(FILE *input, char *line, unsigned len) @@ -19,6 +23,33 @@ static char *next_line(FILE *input, char *line, unsigned len) return p; } +#ifdef OSL_SUPPORT +/** + * This function translates an OpenScop scop to a CLooG input. + * \param[in,out] state CLooG state. + * \param[in] scop Scop to translate. + * \return A CloogInput corresponding to the scop input. + */ +CloogInput *cloog_input_from_osl_scop(CloogState *state, osl_scop_p scop) { + CloogInput *input = NULL; + CloogDomain *context = NULL; + CloogUnionDomain *ud = NULL; + + if (scop) { + /* Extract the context. */ + context = cloog_domain_from_osl_relation(state, scop->context); + + /* Extract the union of domains. */ + ud = cloog_union_domain_from_osl_scop(state, scop); + + /* Build and return the input. */ + input = cloog_input_alloc(context, ud); + } + + return input; +} +#endif + /** * Read input from a .cloog file, putting most of the information * in the returned CloogInput. The chosen language is put in @@ -32,6 +63,17 @@ CloogInput *cloog_input_read(FILE *file, CloogOptions *options) CloogUnionDomain *ud; int nb_par; +#ifdef OSL_SUPPORT + if (options->openscop) { + osl_scop_p scop = osl_scop_read(file); + CloogInput * input = cloog_input_from_osl_scop(options->state, + scop); + cloog_options_copy_from_osl_scop(scop, options); + osl_scop_free(scop); + return input; + } +#endif + /* First of all, we read the language to use. */ if (!next_line(file, line, sizeof(line))) cloog_die("Input error.\n"); diff --git a/source/isl/domain.c b/source/isl/domain.c index 67f0458..d508bb2 100644 --- a/source/isl/domain.c +++ b/source/isl/domain.c @@ -9,6 +9,10 @@ #include #include +#ifdef OSL_SUPPORT +#include +#endif + CloogDomain *cloog_domain_from_isl_set(struct isl_set *set) { set = isl_set_detect_equalities(set); @@ -595,6 +599,65 @@ CloogScattering *cloog_scattering_from_cloog_matrix(CloogState *state, ******************************************************************************/ +#ifdef OSL_SUPPORT +/** + * Converts an openscop relation to a CLooG domain. + * \param[in,out] state CLooG state. + * \param[in] relation OpenScop relation to convert. + * \return A new CloogDomain corresponding to the input OpenScop relation. + */ +CloogDomain *cloog_domain_from_osl_relation(CloogState *state, + osl_relation_p relation) { + char *str; + struct isl_ctx *ctx = state->backend->ctx; + isl_set *set; + CloogDomain *domain = NULL; + + if (relation != NULL) { + if (relation->precision != OSL_PRECISION_MP) + cloog_die("Non-GMP precision is not supported yet.\n"); + + str = osl_relation_spprint_polylib(relation, NULL); + set = isl_set_read_from_str(ctx, str); + free(str); + + domain = cloog_domain_from_isl_set(set); + } + + return domain; +} + + +/** + * Converts an openscop scattering relation to a CLooG scattering. + * \param[in,out] state CLooG state. + * \param[in] relation OpenScop relation to convert. + * \return A new CloogScattering corresponding to the input OpenScop relation. + */ +CloogScattering *cloog_scattering_from_osl_relation(CloogState *state, + osl_relation_p relation) { + char *str; + struct isl_ctx *ctx = state->backend->ctx; + isl_map *map; + CloogScattering *scattering = NULL; + + if (relation != NULL) { + if (relation->precision != OSL_PRECISION_MP) + cloog_die("Non-GMP precision is not supported yet.\n"); + + if (relation->type != OSL_TYPE_SCATTERING) + cloog_die("Cannot convert a non-scattering relation to a scattering.\n"); + + str = osl_relation_spprint_polylib(relation, NULL); + map = isl_map_read_from_str(ctx, str); + free(str); + + scattering = cloog_scattering_from_isl_map(map); + } + + return scattering; +} +#endif /** * cloog_domain_isempty function: diff --git a/source/options.c b/source/options.c index 0a22f62..7b42cda 100644 --- a/source/options.c +++ b/source/options.c @@ -41,6 +41,10 @@ # include # include "../include/cloog/cloog.h" +#ifdef OSL_SUPPORT +#include +#endif + /****************************************************************************** * Error reporting functions * @@ -125,6 +129,9 @@ void cloog_options_print(FILE * foo, CloogOptions * options) fprintf(foo,"block = %3d.\n",options->block) ; fprintf(foo,"compilable = %3d.\n",options->compilable) ; fprintf(foo,"callable = %3d.\n",options->callable) ; + fprintf(foo,"MISC OPTIONS\n") ; + fprintf(foo,"name = %3s.\n", options->name); + fprintf(foo,"openscop = %3d.\n", options->openscop); fprintf(foo,"UNDOCUMENTED OPTIONS FOR THE AUTHOR ONLY\n") ; fprintf(foo,"leaks = %3d.\n",options->leaks) ; fprintf(foo,"backtrack = %3d.\n",options->backtrack); @@ -201,6 +208,9 @@ void cloog_options_help() " -o Name of the output file; 'stdout' is a special\n" " value: when used, output is standard output\n" " (default setting: stdout).\n" +#ifdef OSL_SUPPORT + " -openscop Input file has OpenScop format.\n" +#endif " -v, --version Display the version information (and more).\n" " -q, --quiet Don't print any informational messages.\n" " -h, --help Display this information.\n\n") ; @@ -310,8 +320,10 @@ CloogOptions *cloog_options_malloc(CloogState *state) options->compilable = 0 ; /* No compilable code. */ options->callable = 0 ; /* No callable code. */ options->quiet = 0; /* Do print informational messages. */ - options->language = CLOOG_LANGUAGE_C; /* The default output language is C. */ options->save_domains = 0; /* Don't save domains. */ + /* MISC OPTIONS */ + options->language = CLOOG_LANGUAGE_C; /* The default output language is C. */ + options->openscop = 0 ; /* The input file has not the OpenScop format.*/ /* UNDOCUMENTED OPTIONS FOR THE AUTHOR ONLY */ options->leaks = 0 ; /* I don't want to print allocation statistics.*/ options->backtrack = 0; /* Perform backtrack in Quillere's algorithm.*/ @@ -365,6 +377,14 @@ void cloog_options_read(CloogState *state, int argc, char **argv, if (strcmp(argv[i],"-otl") == 0) cloog_options_set(&(*options)->otl,argc,argv,&i) ; else + if (strcmp(argv[i],"-openscop") == 0) { +#ifdef OSL_SUPPORT + (*options)->openscop = 1 ; +#else + cloog_die("CLooG has not been compiled with OpenScop support.\n"); +#endif + } + else if (strcmp(argv[i],"-esp") == 0) cloog_options_set(&(*options)->esp,argc,argv,&i) ; else @@ -463,3 +483,26 @@ void cloog_options_read(CloogState *state, int argc, char **argv, } } +#ifdef OSL_SUPPORT +/** + * This function extracts CLooG option values from an OpenScop scop and + * updates an existing CloogOption structure with those values. If the + * options were already set, they are updated without warning. + * \param[in] scop Input Scop. + * \param[in,out] options CLooG options to be updated. + */ +void cloog_options_copy_from_osl_scop(osl_scop_p scop, + CloogOptions *options) { + if (!options) + cloog_die("Options must be provided.\n"); + + if (scop) { + /* Extract the language. */ + if (!strcmp(scop->language, "FORTRAN")) + options->language = CLOOG_LANGUAGE_FORTRAN; + else + options->language = CLOOG_LANGUAGE_C; + } +} +#endif + diff --git a/source/union_domain.c b/source/union_domain.c index 32b0087..ab9f2da 100644 --- a/source/union_domain.c +++ b/source/union_domain.c @@ -3,6 +3,11 @@ #include #include "../include/cloog/cloog.h" +#ifdef OSL_SUPPORT +#include +#include +#endif + #define ALLOC(type) (type*)malloc(sizeof(type)) #define ALLOCN(type,n) (type*)malloc((n)*sizeof(type)) @@ -296,3 +301,53 @@ CloogUnionDomain *cloog_union_domain_read(FILE *file, int nb_par, return ud; } + + +#ifdef OSL_SUPPORT +/** + * Extracts a CloogUnionDomain from an openscop scop (the CloogUnionDomain + * corresponds more or less to the openscop statement). + * \param[in,out] state CLooG state. + * \param[in] scop OpenScop scop to convert. + * \return A new CloogUnionDomain corresponding the input OpenScop scop. + */ +CloogUnionDomain *cloog_union_domain_from_osl_scop(CloogState *state, + osl_scop_p scop) { + int i, nb_parameters; + CloogDomain *domain = NULL; + CloogScattering *scattering = NULL; + CloogUnionDomain *ud = NULL; + osl_scop_p normalized; + osl_statement_p statement; + + /* Set the union of domains. */ + nb_parameters = (scop->context == NULL) ? 0 : scop->context->nb_parameters; + ud = cloog_union_domain_alloc(nb_parameters); + + /* - Set the parameter names. */ + if (osl_generic_has_URI(scop->parameters, OSL_URI_STRINGS)) { + for (i = 0; i < osl_strings_size(scop->parameters->data); i++) { + ud = cloog_union_domain_set_name(ud, CLOOG_PARAM, i, + ((osl_strings_p)(scop->parameters->data))->string[i]); + } + } + + /* - Set each statement (domain/scattering). + * Since CLooG requires all number of scattering dimensions to be + * equal, we normalize them first. + */ + normalized = osl_scop_clone(scop); + osl_scop_normalize_scattering(normalized); + statement = normalized->statement; + while(statement != NULL) { + domain = cloog_domain_from_osl_relation(state, statement->domain); + scattering = cloog_scattering_from_osl_relation(state, + statement->scattering); + ud = cloog_union_domain_add_domain(ud, NULL, domain, scattering, NULL); + statement = statement->next; + } + osl_scop_free(normalized); + + return ud; +} +#endif diff --git a/test/Makefile.am b/test/Makefile.am index 68b073d..247bef7 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -207,6 +207,11 @@ CLOOGTEST_STRIDED = \ reservoir/stride2 \ $(CLOOG_ISL_TEST_STRIDED) +CLOOGTEST_OPENSCOP = \ + ./openscop/matmult \ + ./openscop/empty \ + ./openscop/union + SPECIAL_TESTS = \ isl/unroll \ isl/jacobi-shared \ @@ -367,7 +372,38 @@ test_run: generate_test$(EXEEXT) else \ echo "CLooG works correctly :-) !" ; \ fi -test: + +#if NO_OSL +test_openscop: +#else +test_openscop: + @echo " /*-----------------------------------------------*" + @echo " * Testing CLooG's OpenScop Input *" + @echo " *-----------------------------------------------*/" + @failedtest=0 ; \ + echo "--- Testing OpenScop files..." ; \ + for x in $(CLOOGTEST_OPENSCOP) ; do \ + echo "Verify file $$x" ; \ + $(top_builddir)/cloog$(EXEEXT) $(srcdir)/$$x.scop \ + -openscop > ttemp ; \ + diff -u -w --ignore-matching-lines='CLooG' ttemp $(srcdir)/$$x.c ; \ + result=$$?; \ + if [ "$$result" -ne "0" ] ; then \ + echo "!!! Error: $$x is not the same" ; \ + failedtest=`expr $$failedtest + 1` ; \ + else \ + echo "$$x passed" ; \ + fi ; \ + done ; \ + rm ttemp ; \ + if [ $$failedtest != 0 ] ; then \ + echo "$$failedtest tests failed" ; \ + else \ + echo "CLooG's OpenScop input works correctly :-) !" ; \ + fi +#endif + +test: test_openscop @echo " /*-----------------------------------------------*" @echo " * Testing CLooG *" @echo " *-----------------------------------------------*/" diff --git a/test/openscop/empty.c b/test/openscop/empty.c new file mode 100644 index 0000000..8892d5f --- /dev/null +++ b/test/openscop/empty.c @@ -0,0 +1 @@ +/* Generated from ./test/openscop/empty.scop by CLooG 0.14.0-416-g013422c gmp bits in 0.01s. */ diff --git a/test/openscop/empty.scop b/test/openscop/empty.scop new file mode 100644 index 0000000..a7aba60 --- /dev/null +++ b/test/openscop/empty.scop @@ -0,0 +1,35 @@ + + +# =============================================== Global +# Language +C + +# Context +CONTEXT +0 2 0 0 0 0 + +# Parameter names are not provided +0 + +# One statement +1 + +# =============================================== Statement 1 +# Number of relations describing the statement +0 + +# ---------------------------------------------- 1.1 Domain +# NULL Domain + +# ---------------------------------------------- 1.2 Scattering +# NULL Scattering + +# ---------------------------------------------- 1.3 Access +# NULL Access + +# ---------------------------------------------- 1.4 Body +# Statement body is not provided +0 + + + diff --git a/test/openscop/matmult.c b/test/openscop/matmult.c new file mode 100644 index 0000000..14aff42 --- /dev/null +++ b/test/openscop/matmult.c @@ -0,0 +1,9 @@ +/* Generated from ./test/openscop/matmult.scop by CLooG 0.14.0-416-g013422c gmp bits in 0.51s. */ +for (c2=0;c2<=N-1;c2++) { + for (c4=0;c4<=N-1;c4++) { + S1(c2,c4); + for (c6=0;c6<=N-1;c6++) { + S2(c2,c4,c6); + } + } +} diff --git a/test/openscop/matmult.scop b/test/openscop/matmult.scop new file mode 100644 index 0000000..a9c09b7 --- /dev/null +++ b/test/openscop/matmult.scop @@ -0,0 +1,130 @@ +# [File generated by the OpenScop Library 0.7.0] + + + +# =============================================== Global +# Language +C + +# Context +CONTEXT +1 3 0 0 0 1 +# e/i| N | 1 + 1 1 -1 ## N-1 >= 0 + +# Parameters are provided +1 +N + +# Number of statements +2 + +# =============================================== Statement 1 +# Number of relations describing the statement: +3 + +# ---------------------------------------------- 1.1 Domain +DOMAIN +4 5 2 0 0 1 +# e/i| i j | N | 1 + 1 1 0 0 0 ## i >= 0 + 1 -1 0 1 -1 ## -i+N-1 >= 0 + 1 0 1 0 0 ## j >= 0 + 1 0 -1 1 -1 ## -j+N-1 >= 0 + +# ---------------------------------------------- 1.2 Scattering +SCATTERING +5 10 5 2 0 1 +# e/i| c1 c2 c3 c4 c5 | i j | N | 1 + 0 -1 0 0 0 0 0 0 0 0 ## c1 == 0 + 0 0 -1 0 0 0 1 0 0 0 ## c2 == i + 0 0 0 -1 0 0 0 0 0 0 ## c3 == 0 + 0 0 0 0 -1 0 0 1 0 0 ## c4 == j + 0 0 0 0 0 -1 0 0 0 0 ## c5 == 0 + +# ---------------------------------------------- 1.3 Access +WRITE +3 8 3 2 0 1 +# e/i| A1 [1] [2]| i j | N | 1 + 0 -1 0 0 0 0 0 1 ## A1 + 0 0 -1 0 1 0 0 0 ## [1] == i + 0 0 0 -1 0 1 0 0 ## [2] == j + +# ---------------------------------------------- 1.4 Body +# Statement body is provided +1 +# Original iterators +i j +# Body expression +C[i][j] = 0.0; + + +# =============================================== Statement 2 +# Number of relations describing the statement: +6 + +# ---------------------------------------------- 2.1 Domain +DOMAIN +6 6 3 0 0 1 +# e/i| i j k | N | 1 + 1 1 0 0 0 0 ## i >= 0 + 1 -1 0 0 1 -1 ## -i+N-1 >= 0 + 1 0 1 0 0 0 ## j >= 0 + 1 0 -1 0 1 -1 ## -j+N-1 >= 0 + 1 0 0 1 0 0 ## k >= 0 + 1 0 0 -1 1 -1 ## -k+N-1 >= 0 + +# ---------------------------------------------- 2.2 Scattering +SCATTERING +7 13 7 3 0 1 +# e/i| c1 c2 c3 c4 c5 c6 c7 | i j k | N | 1 + 0 -1 0 0 0 0 0 0 0 0 0 0 0 ## c1 == 0 + 0 0 -1 0 0 0 0 0 1 0 0 0 0 ## c2 == i + 0 0 0 -1 0 0 0 0 0 0 0 0 0 ## c3 == 0 + 0 0 0 0 -1 0 0 0 0 1 0 0 0 ## c4 == j + 0 0 0 0 0 -1 0 0 0 0 0 0 1 ## c5 == 1 + 0 0 0 0 0 0 -1 0 0 0 1 0 0 ## c6 == k + 0 0 0 0 0 0 0 -1 0 0 0 0 0 ## c7 == 0 + +# ---------------------------------------------- 2.3 Access +WRITE +3 9 3 3 0 1 +# e/i| A1 [1] [2]| i j k | N | 1 + 0 -1 0 0 0 0 0 0 1 ## A1 + 0 0 -1 0 1 0 0 0 0 ## [1] == i + 0 0 0 -1 0 1 0 0 0 ## [2] == j + +READ +3 9 3 3 0 1 +# e/i| A1 [1] [2]| i j k | N | 1 + 0 -1 0 0 0 0 0 0 1 ## A1 + 0 0 -1 0 1 0 0 0 0 ## [1] == i + 0 0 0 -1 0 1 0 0 0 ## [2] == j + +READ +3 9 3 3 0 1 +# e/i| A2 [1] [2]| i j k | N | 1 + 0 -1 0 0 0 0 0 0 2 ## A2 + 0 0 -1 0 1 0 0 0 0 ## [1] == i + 0 0 0 -1 0 0 1 0 0 ## [2] == k + +READ +3 9 3 3 0 1 +# e/i| A3 [1] [2]| i j k | N | 1 + 0 -1 0 0 0 0 0 0 3 ## A3 + 0 0 -1 0 0 0 1 0 0 ## [1] == k + 0 0 0 -1 0 1 0 0 0 ## [2] == j + +# ---------------------------------------------- 2.4 Body +# Statement body is provided +1 +# Original iterators +i j k +# Body expression +C[i][j] = C[i][j] + A[i][k] * B[k][j]; + + +# =============================================== Extensions + + + diff --git a/test/openscop/union.c b/test/openscop/union.c new file mode 100644 index 0000000..253086a --- /dev/null +++ b/test/openscop/union.c @@ -0,0 +1,11 @@ +/* Generated from ./test/openscop/union.scop by CLooG 0.14.0-416-g013422c gmp bits in 0.49s. */ +if (N >= 1) { + for (c2=0;c2<=N-1;c2++) { + for (c4=0;c4<=min(10,N-1);c4++) { + S1(c2,c4); + } + for (c4=20;c4<=N-1;c4++) { + S1(c2,c4); + } + } +} diff --git a/test/openscop/union.scop b/test/openscop/union.scop new file mode 100644 index 0000000..45b2543 --- /dev/null +++ b/test/openscop/union.scop @@ -0,0 +1,100 @@ +# [File generated by the OpenScop Library 0.7.0] + + + +# =============================================== Global +# Language +C + +# Context +CONTEXT +1 3 0 0 0 1 +# e/i| N | 1 + 1 1 3 ## N+3 >= 0 + +# Parameters are provided +1 +N + +# Number of statements +1 + +# =============================================== Statement 1 +# Number of relations describing the statement: +6 + +# ---------------------------------------------- 1.1 Domain +DOMAIN +# Union with 2 parts +2 +# Union part No.1 +5 5 2 0 0 1 +# e/i| i j | N | 1 + 1 1 0 0 0 ## i >= 0 + 1 -1 0 1 -1 ## -i+N-1 >= 0 + 1 0 1 0 0 ## j >= 0 + 1 0 -1 1 -1 ## -j+N-1 >= 0 + 1 0 1 0 -20 ## j-20 >= 0 +# Union part No.2 +5 5 2 0 0 1 +# e/i| i j | N | 1 + 1 1 0 0 0 ## i >= 0 + 1 -1 0 1 -1 ## -i+N-1 >= 0 + 1 0 1 0 0 ## j >= 0 + 1 0 -1 1 -1 ## -j+N-1 >= 0 + 1 0 -1 0 10 ## -j+10 >= 0 + +# ---------------------------------------------- 1.2 Scattering +SCATTERING +5 10 5 2 0 1 +# e/i| c1 c2 c3 c4 c5 | i j | N | 1 + 0 -1 0 0 0 0 0 0 0 0 ## c1 == 0 + 0 0 -1 0 0 0 1 0 0 0 ## c2 == i + 0 0 0 -1 0 0 0 0 0 0 ## c3 == 0 + 0 0 0 0 -1 0 0 1 0 0 ## c4 == j + 0 0 0 0 0 -1 0 0 0 0 ## c5 == 0 + +# ---------------------------------------------- 1.3 Access +READ +2 7 2 2 0 1 +# e/i| A1 [1]| i j | N | 1 + 0 -1 0 0 0 0 1 ## A1 + 0 0 -1 1 1 0 0 ## [1] == i+j + +READ +2 7 2 2 0 1 +# e/i| A2 [1]| i j | N | 1 + 0 -1 0 0 0 0 2 ## A2 + 0 0 -1 1 0 0 0 ## [1] == i + +READ +2 7 2 2 0 1 +# e/i| A3 [1]| i j | N | 1 + 0 -1 0 0 0 0 3 ## A3 + 0 0 -1 0 1 0 0 ## [1] == j + +WRITE +2 7 2 2 0 1 +# e/i| A1 [1]| i j | N | 1 + 0 -1 0 0 0 0 1 ## A1 + 0 0 -1 1 1 0 0 ## [1] == i+j + +# ---------------------------------------------- 1.4 Body +# Statement body is provided +1 +# Original iterators +i j +# Body expression +C[i+j]+=A[i]*B[j]; + + +# =============================================== Extensions + +hello, world + +HELLO WORLD I SAID + + + + + -- 2.11.4.GIT