public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [GSoC] Elimination of CLooG library installation dependency
@ 2014-08-06 15:22 Roman Gareev
  2014-08-06 15:48 ` Tobias Grosser
  2014-08-15 11:13 ` Roman Gareev
  0 siblings, 2 replies; 30+ messages in thread
From: Roman Gareev @ 2014-08-06 15:22 UTC (permalink / raw)
  To: Tobias Grosser; +Cc: Mircea Namolaru, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 928 bytes --]

Hi Tobias,

I've attached the patch, which should eliminate CLooG library
installation dependency from GCC. The CLooG AST generator is still the
main code generator, but the isl ast generator will be chosen in case
of nonavailability of CLooG library.

However, I've found out a problem. Almost all the functions of the ISL
cannot be used without installed CLooG. (I get errors which contain
“undefined reference to...”). Maybe I missed something. What do you
think about this?

I also have a few questions about gcc. Could you please answer them?

Should Makefile.in be regenerated or manually changed? (I haven't
found out how to regenerate it.)

I've used printf to print “The CLooG code generator cannot be used
+(CLooG is not available). The ISL code generator was chosen.\n”.
Should another function be used for this purpose?


-- 
                                    Cheers, Roman Gareev.

[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 10602 bytes --]

Index: Makefile.in
===================================================================
--- Makefile.in	(revision 213622)
+++ Makefile.in	(working copy)
@@ -219,6 +219,7 @@
 	HOST_LIBS="$(STAGE1_LIBS)"; export HOST_LIBS; \
 	GMPLIBS="$(HOST_GMPLIBS)"; export GMPLIBS; \
 	GMPINC="$(HOST_GMPINC)"; export GMPINC; \
+	ISLLIBS="$(HOST_ISLLIBS)"; export ISLLIBS; \
 	ISLINC="$(HOST_ISLINC)"; export ISLINC; \
 	CLOOGLIBS="$(HOST_CLOOGLIBS)"; export CLOOGLIBS; \
 	CLOOGINC="$(HOST_CLOOGINC)"; export CLOOGINC; \
@@ -310,6 +311,7 @@
 HOST_GMPINC = @gmpinc@
 
 # Where to find ISL
+HOST_ISLLIBS = @isllibs@
 HOST_ISLINC = @islinc@
 
 # Where to find CLOOG
Index: Makefile.tpl
===================================================================
--- Makefile.tpl	(revision 213622)
+++ Makefile.tpl	(working copy)
@@ -222,6 +222,7 @@
 	HOST_LIBS="$(STAGE1_LIBS)"; export HOST_LIBS; \
 	GMPLIBS="$(HOST_GMPLIBS)"; export GMPLIBS; \
 	GMPINC="$(HOST_GMPINC)"; export GMPINC; \
+	ISLLIBS="$(HOST_ISLLIBS)"; export ISLLIBS; \
 	ISLINC="$(HOST_ISLINC)"; export ISLINC; \
 	CLOOGLIBS="$(HOST_CLOOGLIBS)"; export CLOOGLIBS; \
 	CLOOGINC="$(HOST_CLOOGINC)"; export CLOOGINC; \
@@ -313,6 +314,7 @@
 HOST_GMPINC = @gmpinc@
 
 # Where to find ISL
+HOST_ISLLIBS = @isllibs@
 HOST_ISLINC = @islinc@
 
 # Where to find CLOOG
Index: gcc/config.in
===================================================================
--- gcc/config.in	(revision 213622)
+++ gcc/config.in	(working copy)
@@ -1705,6 +1705,10 @@
 #undef HAVE_cloog
 #endif
 
+/* Define if isl is in use. */
+#ifndef USED_FOR_TARGET
+#undef HAVE_isl
+#endif
 
 /* Define if F_SETLKW supported by fcntl. */
 #ifndef USED_FOR_TARGET
Index: gcc/configure
===================================================================
--- gcc/configure	(revision 213622)
+++ gcc/configure	(working copy)
@@ -27888,9 +27888,14 @@
 
 
 
+if test "x${ISLLIBS}" != "x" ; then
 
+$as_echo "#define HAVE_isl 1" >>confdefs.h
 
+fi
 
+
+
 if test "x${CLOOGLIBS}" != "x" ; then
 
 $as_echo "#define HAVE_cloog 1" >>confdefs.h
Index: gcc/configure.ac
===================================================================
--- gcc/configure.ac	(revision 213622)
+++ gcc/configure.ac	(working copy)
@@ -5514,6 +5514,9 @@
 
 AC_ARG_VAR(ISLLIBS,[How to link ISL])
 AC_ARG_VAR(ISLINC,[How to find ISL include files])
+if test "x${ISLLIBS}" != "x" ; then 
+   AC_DEFINE(HAVE_isl, 1, [Define if isl is in use.])
+fi
 
 AC_ARG_VAR(CLOOGLIBS,[How to link CLOOG])
 AC_ARG_VAR(CLOOGINC,[How to find CLOOG include files])
Index: gcc/graphite-blocking.c
===================================================================
--- gcc/graphite-blocking.c	(revision 213622)
+++ gcc/graphite-blocking.c	(working copy)
@@ -23,14 +23,16 @@
 
 #include "config.h"
 
-#ifdef HAVE_cloog
+#ifdef HAVE_isl
 #include <isl/set.h>
 #include <isl/map.h>
 #include <isl/union_map.h>
 #include <isl/constraint.h>
+#ifdef HAVE_cloog
 #include <cloog/cloog.h>
 #include <cloog/isl/domain.h>
 #endif
+#endif
 
 #include "system.h"
 #include "coretypes.h"
@@ -49,7 +51,7 @@
 #include "tree-data-ref.h"
 #include "sese.h"
 
-#ifdef HAVE_cloog
+#ifdef HAVE_isl
 #include "graphite-poly.h"
 
 
Index: gcc/graphite-dependences.c
===================================================================
--- gcc/graphite-dependences.c	(revision 213622)
+++ gcc/graphite-dependences.c	(working copy)
@@ -21,15 +21,17 @@
 
 #include "config.h"
 
-#ifdef HAVE_cloog
+#ifdef HAVE_isl
 #include <isl/set.h>
 #include <isl/map.h>
 #include <isl/union_map.h>
 #include <isl/flow.h>
 #include <isl/constraint.h>
+#ifdef HAVE_cloog
 #include <cloog/cloog.h>
 #include <cloog/isl/domain.h>
 #endif
+#endif
 
 #include "system.h"
 #include "coretypes.h"
@@ -49,7 +51,7 @@
 #include "tree-scalar-evolution.h"
 #include "sese.h"
 
-#ifdef HAVE_cloog
+#ifdef HAVE_isl
 #include "graphite-poly.h"
 #include "graphite-htab.h"
 
Index: gcc/graphite-interchange.c
===================================================================
--- gcc/graphite-interchange.c	(revision 213622)
+++ gcc/graphite-interchange.c	(working copy)
@@ -23,15 +23,17 @@
 
 #include "config.h"
 
-#ifdef HAVE_cloog
+#ifdef HAVE_isl
 #include <isl/aff.h>
 #include <isl/set.h>
 #include <isl/map.h>
 #include <isl/union_map.h>
 #include <isl/ilp.h>
+#ifdef HAVE_cloog
 #include <cloog/cloog.h>
 #include <cloog/isl/domain.h>
 #endif
+#endif
 
 #include "system.h"
 #include "coretypes.h"
@@ -51,7 +53,7 @@
 #include "tree-scalar-evolution.h"
 #include "sese.h"
 
-#ifdef HAVE_cloog
+#ifdef HAVE_isl
 #include "graphite-poly.h"
 
 /* XXX isl rewrite following comment */
Index: gcc/graphite-isl-ast-to-gimple.c
===================================================================
--- gcc/graphite-isl-ast-to-gimple.c	(revision 213623)
+++ gcc/graphite-isl-ast-to-gimple.c	(working copy)
@@ -20,7 +20,7 @@
 
 #include "config.h"
 
-#ifdef HAVE_cloog
+#ifdef HAVE_isl
 #include <isl/set.h>
 #include <isl/map.h>
 #include <isl/union_map.h>
@@ -55,7 +55,7 @@
 #include "tree-into-ssa.h"
 #include <map>
 
-#ifdef HAVE_cloog
+#ifdef HAVE_isl
 #include "graphite-poly.h"
 #include "graphite-isl-ast-to-gimple.h"
 
Index: gcc/graphite-optimize-isl.c
===================================================================
--- gcc/graphite-optimize-isl.c	(revision 213622)
+++ gcc/graphite-optimize-isl.c	(working copy)
@@ -20,7 +20,7 @@
 
 #include "config.h"
 
-#ifdef HAVE_cloog
+#ifdef HAVE_isl
 #include <isl/set.h>
 #include <isl/map.h>
 #include <isl/union_map.h>
@@ -48,7 +48,7 @@
 #include "tree-scalar-evolution.h"
 #include "sese.h"
 
-#ifdef HAVE_cloog
+#ifdef HAVE_isl
 #include "graphite-poly.h"
 
 static isl_union_set *
Index: gcc/graphite-poly.c
===================================================================
--- gcc/graphite-poly.c	(revision 213622)
+++ gcc/graphite-poly.c	(working copy)
@@ -21,16 +21,18 @@
 
 #include "config.h"
 
-#ifdef HAVE_cloog
+#ifdef HAVE_isl
 #include <isl/set.h>
 #include <isl/map.h>
 #include <isl/union_map.h>
 #include <isl/constraint.h>
 #include <isl/ilp.h>
 #include <isl/aff.h>
+#ifdef HAVE_cloog
 #include <cloog/cloog.h>
 #include <cloog/isl/domain.h>
 #endif
+#endif
 
 #include "system.h"
 #include "coretypes.h"
@@ -52,7 +54,7 @@
 #include "tree-scalar-evolution.h"
 #include "sese.h"
 
-#ifdef HAVE_cloog
+#ifdef HAVE_isl
 #include "graphite-poly.h"
 
 #define OPENSCOP_MAX_STRING 256
Index: gcc/graphite-scop-detection.c
===================================================================
--- gcc/graphite-scop-detection.c	(revision 213622)
+++ gcc/graphite-scop-detection.c	(working copy)
@@ -21,13 +21,15 @@
 
 #include "config.h"
 
-#ifdef HAVE_cloog
+#ifdef HAVE_isl
 #include <isl/set.h>
 #include <isl/map.h>
 #include <isl/union_map.h>
+#ifdef HAVE_cloog
 #include <cloog/cloog.h>
 #include <cloog/isl/domain.h>
 #endif
+#endif
 
 #include "system.h"
 #include "coretypes.h"
@@ -55,7 +57,7 @@
 #include "sese.h"
 #include "tree-ssa-propagate.h"
 
-#ifdef HAVE_cloog
+#ifdef HAVE_isl
 #include "graphite-poly.h"
 #include "graphite-scop-detection.h"
 
Index: gcc/graphite-sese-to-poly.c
===================================================================
--- gcc/graphite-sese-to-poly.c	(revision 213622)
+++ gcc/graphite-sese-to-poly.c	(working copy)
@@ -20,16 +20,18 @@
 
 #include "config.h"
 
-#ifdef HAVE_cloog
+#ifdef HAVE_isl
 #include <isl/set.h>
 #include <isl/map.h>
 #include <isl/union_map.h>
 #include <isl/constraint.h>
 #include <isl/aff.h>
+#ifdef HAVE_cloog
 #include <cloog/cloog.h>
 #include <cloog/cloog.h>
 #include <cloog/isl/domain.h>
 #endif
+#endif
 
 #include "system.h"
 #include "coretypes.h"
@@ -62,7 +64,7 @@
 #include "sese.h"
 #include "tree-ssa-propagate.h"
 
-#ifdef HAVE_cloog
+#ifdef HAVE_isl
 #include "expr.h"
 #include "graphite-poly.h"
 #include "graphite-sese-to-poly.h"
Index: gcc/graphite.c
===================================================================
--- gcc/graphite.c	(revision 213622)
+++ gcc/graphite.c	(working copy)
@@ -34,15 +34,17 @@
 
 #include "config.h"
 
-#ifdef HAVE_cloog
+#ifdef HAVE_isl
 #include <isl/set.h>
 #include <isl/map.h>
 #include <isl/options.h>
 #include <isl/union_map.h>
+#ifdef HAVE_cloog
 #include <cloog/cloog.h>
 #include <cloog/isl/domain.h>
 #include <cloog/isl/cloog.h>
 #endif
+#endif
 
 #include "system.h"
 #include "coretypes.h"
@@ -68,16 +70,19 @@
 #include "tree-pass.h"
 #include "tree-cfgcleanup.h"
 
-#ifdef HAVE_cloog
+#ifdef HAVE_isl
 
 #include "graphite-poly.h"
 #include "graphite-scop-detection.h"
-#include "graphite-clast-to-gimple.h"
 #include "graphite-isl-ast-to-gimple.h"
 #include "graphite-sese-to-poly.h"
 #include "graphite-htab.h"
 
+#ifdef HAVE_cloog
+#include "graphite-clast-to-gimple.h"
+
 CloogState *cloog_state;
+#endif
 
 /* Print global statistics to FILE.  */
 
@@ -228,7 +233,9 @@
   recompute_all_dominators ();
   initialize_original_copy_tables ();
 
+#ifdef HAVE_cloog
   cloog_state = cloog_isl_state_malloc (ctx);
+#endif
 
   if (dump_file && dump_flags)
     dump_function_to_file (current_function_decl, dump_file, dump_flags);
@@ -251,7 +258,9 @@
       tree_estimate_probability ();
     }
 
+#ifdef HAVE_cloog
   cloog_state_free (cloog_state);
+#endif
   free_original_copy_tables ();
 
   if (dump_file && dump_flags)
@@ -292,12 +301,23 @@
     }
 
   bb_pbb_htab_type bb_pbb_mapping (10);
+
+#ifndef HAVE_cloog
+  if(flag_graphite_code_gen == FGRAPHITE_CODE_GEN_CLOOG)
+    {
+      flag_graphite_code_gen = FGRAPHITE_CODE_GEN_ISL;
+      printf ("The CLooG code generator cannot be used \
+(CLooG is not available). The ISL code generator was chosen.\n");
+    }
+#endif
+
   FOR_EACH_VEC_ELT (scops, i, scop)
     if (dbg_cnt (graphite_scop))
       {
 	scop->ctx = ctx;
 	build_poly_scop (scop);
 
+#ifdef HAVE_cloog
 	if (POLY_SCOP_P (scop)
 	    && apply_poly_transforms (scop)
 	    && (((flag_graphite_code_gen == FGRAPHITE_CODE_GEN_ISL)
@@ -305,6 +325,13 @@
 	    || ((flag_graphite_code_gen == FGRAPHITE_CODE_GEN_CLOOG)
 	    && graphite_regenerate_ast_cloog (scop, &bb_pbb_mapping))))
 	  need_cfg_cleanup_p = true;
+#else
+	if (POLY_SCOP_P (scop)
+	    && apply_poly_transforms (scop)
+	    && graphite_regenerate_ast_isl (scop))
+	  need_cfg_cleanup_p = true;
+#endif
+
       }
 
   free_scops (scops);
@@ -313,12 +340,12 @@
   isl_ctx_free (ctx);
 }
 
-#else /* If Cloog is not available: #ifndef HAVE_cloog.  */
+#else /* If ISL is not available: #ifndef HAVE_isl.  */
 
 static void
 graphite_transform_loops (void)
 {
-  sorry ("Graphite loop optimizations cannot be used");
+  sorry ("Graphite loop optimizations cannot be used (ISL is not available).");
 }
 
 #endif

^ permalink raw reply	[flat|nested] 30+ messages in thread
* Re: [GSoC] Elimination of CLooG library installation dependency
@ 2014-08-23 16:48 Dominique d'Humières
  2014-08-24  7:00 ` Roman Gareev
  0 siblings, 1 reply; 30+ messages in thread
From: Dominique d'Humières @ 2014-08-23 16:48 UTC (permalink / raw)
  To: gareevroman
  Cc: tobias, richard.guenther, mircea.namolaru,
	Dominique d'Humieres, gcc-patches


I see two regressions after r214069 on x86_64-apple-darwin13 for both -m32 and -m64:


(1) FAIL: gcc.dg/graphite/vect-pr43423.c scan-tree-dump-times vect "vectorized 2 loops" 1

before I saw

[Book15] f90/bug% grep vectorized vect-pr43423.c.114t.vect 
/opt/gcc/p_work/gcc/testsuite/gcc.dg/graphite/vect-pr43423.c:14:17: note: === vect_mark_stmts_to_be_vectorized ===
/opt/gcc/p_work/gcc/testsuite/gcc.dg/graphite/vect-pr43423.c:14:17: note: loop vectorized
/opt/gcc/p_work/gcc/testsuite/gcc.dg/graphite/vect-pr43423.c:12:17: note: === vect_mark_stmts_to_be_vectorized ===
/opt/gcc/p_work/gcc/testsuite/gcc.dg/graphite/vect-pr43423.c:12:17: note: loop vectorized
/opt/gcc/p_work/gcc/testsuite/gcc.dg/graphite/vect-pr43423.c:6:6: note: vectorized 2 loops in function.

after I see

[Book15] f90/bug% grep vectorized vect-pr43423.c.115t.vect                                                                                          /opt/gcc/p_work/gcc/testsuite/gcc.dg/graphite/vect-pr43423.c:14:17: note: not vectorized: not suitable for gather load _55 = a[_56];
/opt/gcc/p_work/gcc/testsuite/gcc.dg/graphite/vect-pr43423.c:12:17: note: not vectorized: not suitable for gather load _36 = a[_37];
/opt/gcc/p_work/gcc/testsuite/gcc.dg/graphite/vect-pr43423.c:6:6: note: vectorized 0 loops in function.

(2) FAIL: gfortran.dg/graphite/pr42393.f90   -O  (internal compiler error)
    FAIL: gfortran.dg/graphite/pr42393.f90   -O  (test for excess errors)

The backtrace is

* thread #1: tid = 0x13bd91f, 0x00007fff8621aca0 libsystem_malloc.dylib`tiny_malloc_from_free_list + 12, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=2, address=0x7fff5bc00ff8)
    frame #0: 0x00007fff8621aca0 libsystem_malloc.dylib`tiny_malloc_from_free_list + 12
libsystem_malloc.dylib`tiny_malloc_from_free_list + 12:
-> 0x7fff8621aca0:  pushq  %rbx
   0x7fff8621aca1:  pushq  %rax
   0x7fff8621aca2:  movl   %edx, %r12d
   0x7fff8621aca5:  movq   %rsi, %r14
(lldb) bt
* thread #1: tid = 0x13bd91f, 0x00007fff8621aca0 libsystem_malloc.dylib`tiny_malloc_from_free_list + 12, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=2, address=0x7fff5bc00ff8)
  * frame #0: 0x00007fff8621aca0 libsystem_malloc.dylib`tiny_malloc_from_free_list + 12
    frame #1: 0x00007fff8621b3c3 libsystem_malloc.dylib`szone_malloc_should_clear + 320
    frame #2: 0x00007fff8621d868 libsystem_malloc.dylib`malloc_zone_malloc + 71
    frame #3: 0x00007fff8621e27c libsystem_malloc.dylib`malloc + 42
    frame #4: 0x0000000141dbdc79 libgmp.10.dylib`__gmp_default_allocate + 9
    frame #5: 0x0000000141dd0148 libgmp.10.dylib`__gmpz_init + 24
    frame #6: 0x0000000141c180ef libisl.10.dylib`isl_basic_map_normalize_constraints + 47
    frame #7: 0x0000000141c18f04 libisl.10.dylib`isl_basic_map_simplify + 68
    frame #8: 0x0000000141c2509b libisl.10.dylib`isl_basic_set_preimage + 619
    frame #9: 0x0000000141c4e146 libisl.10.dylib`isl_basic_set_sample_with_cone + 150
    frame #10: 0x0000000141c4ea88 libisl.10.dylib`basic_set_sample + 744
    frame #11: 0x0000000141c4e849 libisl.10.dylib`basic_set_sample + 169
    frame #12: 0x0000000141c09978 libisl.10.dylib`isl_basic_map_is_empty + 136
    frame #13: 0x0000000141bb2870 libisl.10.dylib`domain_follows_at_depth + 112
    frame #14: 0x0000000141c7cdba libisl.10.dylib`isl_tarjan_components + 154

getting to the ICE take ~19s compared to less than a second before r214069.

Dominique

^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2014-08-24  7:00 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-06 15:22 [GSoC] Elimination of CLooG library installation dependency Roman Gareev
2014-08-06 15:48 ` Tobias Grosser
2014-08-07 13:18   ` Roman Gareev
2014-08-07 13:35     ` Tobias Grosser
2014-08-08 13:11       ` Roman Gareev
2014-08-08 13:16         ` Tobias Grosser
2014-08-09  7:42           ` Roman Gareev
2014-08-09  7:52             ` Tobias Grosser
2014-08-09 10:05               ` Roman Gareev
2014-08-11  6:26                 ` Tobias Grosser
2014-08-11  7:11                   ` Roman Gareev
2014-08-11  7:27                     ` Tobias Grosser
2014-08-11 14:20                       ` Roman Gareev
2014-08-13  8:07                         ` Roman Gareev
2014-08-13  8:56                           ` Tobias Grosser
2014-08-13 11:48                             ` Roman Gareev
2014-08-13  9:55                           ` Richard Biener
2014-08-13 11:49                             ` Roman Gareev
2014-08-15 11:13 ` Roman Gareev
2014-08-15 11:45   ` Richard Biener
2014-08-16  5:28     ` Roman Gareev
2014-08-16 10:40       ` Tobias Grosser
2014-08-18 13:00   ` Richard Biener
2014-08-18 15:22     ` Roman Gareev
2014-08-20  3:28       ` Bin.Cheng
2014-08-20  5:24         ` Roman Gareev
2014-08-20  5:47           ` Bin.Cheng
2014-08-21  5:15             ` Bin.Cheng
2014-08-23 16:48 Dominique d'Humières
2014-08-24  7:00 ` Roman Gareev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).