Bug 191650 - devel/gcc-arm-embedded fails to build against devel/isl
Summary: devel/gcc-arm-embedded fails to build against devel/isl
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Lev A. Serebryakov
URL:
Keywords:
Depends on:
Blocks: 191598
  Show dependency treegraph
 
Reported: 2014-07-06 08:36 UTC by Jan Beich
Modified: 2014-07-09 12:31 UTC (History)
2 users (show)

See Also:


Attachments
fix (14.67 KB, patch)
2014-07-06 08:36 UTC, Jan Beich
no flags Details | Diff
fix, v2 (15.85 KB, patch)
2014-07-08 05:59 UTC, Jan Beich
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Beich freebsd_committer freebsd_triage 2014-07-06 08:36:20 UTC
Created attachment 144447 [details]
fix

devel/gcc-arm-embedded is a special snowflake with graphite enabled unlike any other lang/gcc* port. At the moment upstream isn't ready for isl 0.13 yet but there's a pending fix from gcc-patches@.

/work/gcc-arm-none-eabi-4_8-2014q2-20140609/src/gcc/gcc/graphite-clast-to-gimple.c:854:3: error:
      unknown type name 'isl_int'
  isl_int v;
  ^
/work/gcc-arm-none-eabi-4_8-2014q2-20140609/src/gcc/gcc/graphite-clast-to-gimple.c:852:57: warning:
      unused parameter 'low' [-Wunused-parameter]
compute_bounds_for_param (scop_p scop, int param, mpz_t low, mpz_t up)
                                                        ^
/work/gcc-arm-none-eabi-4_8-2014q2-20140609/src/gcc/gcc/graphite-clast-to-gimple.c:852:68: warning:
      unused parameter 'up' [-Wunused-parameter]
compute_bounds_for_param (scop_p scop, int param, mpz_t low, mpz_t up)
                                                                   ^
/work/gcc-arm-none-eabi-4_8-2014q2-20140609/src/gcc/gcc/graphite-clast-to-gimple.c:884:3: error:
      unknown type name 'isl_int'
  isl_int isl_value;
  ^
/work/gcc-arm-none-eabi-4_8-2014q2-20140609/src/gcc/gcc/graphite-clast-to-gimple.c:885:8: error:
      ISO C++ forbids forward references to 'enum' types
  enum isl_lp_result lp_result;
       ^
/work/gcc-arm-none-eabi-4_8-2014q2-20140609/src/gcc/gcc/graphite-clast-to-gimple.c:885:22: error:
      variable has incomplete type 'enum isl_lp_result'
  enum isl_lp_result lp_result;
                     ^
/work/gcc-arm-none-eabi-4_8-2014q2-20140609/src/gcc/gcc/graphite-clast-to-gimple.c:885:8: note:
      forward declaration of 'isl_lp_result'
  enum isl_lp_result lp_result;
       ^
/work/gcc-arm-none-eabi-4_8-2014q2-20140609/src/gcc/gcc/graphite-clast-to-gimple.c:897:24: error:
      use of undeclared identifier 'isl_lp_ok'
  assert (lp_result == isl_lp_ok);
                       ^
/usr/include/assert.h:54:21: note: expanded from macro 'assert'
#define assert(e)       ((e) ? (void)0 : __assert(__func__, __FILE__, \
                          ^
/work/gcc-arm-none-eabi-4_8-2014q2-20140609/src/gcc/gcc/graphite-clast-to-gimple.c:901:24: error:
      use of undeclared identifier 'isl_lp_ok'
  assert (lp_result == isl_lp_ok);
                       ^
/usr/include/assert.h:54:21: note: expanded from macro 'assert'
#define assert(e)       ((e) ? (void)0 : __assert(__func__, __FILE__, \
                          ^
/work/gcc-arm-none-eabi-4_8-2014q2-20140609/src/gcc/gcc/graphite-clast-to-gimple.c:879:56: warning:
      unused parameter 'low' [-Wunused-parameter]
compute_bounds_for_loop (struct clast_for *loop, mpz_t low, mpz_t up)
                                                       ^
/work/gcc-arm-none-eabi-4_8-2014q2-20140609/src/gcc/gcc/graphite-clast-to-gimple.c:879:67: warning:
      unused parameter 'up' [-Wunused-parameter]
compute_bounds_for_loop (struct clast_for *loop, mpz_t low, mpz_t up)
                                                                  ^
4 warnings and 6 errors generated.
Comment 1 Jan Beich freebsd_committer freebsd_triage 2014-07-06 10:08:38 UTC
Comment on attachment 144447 [details]
fix

Oops, the patch needs more work.

In file included from /work/gcc-arm-none-eabi-4_8-2014q2-20140609/src/gcc/gcc/graphite-clast-to-gimple.c:35:
In file included from /usr/local/include/isl/val_gmp.h:4:
In file included from /usr/local/include/gmp.h:25:
In file included from /usr/include/c++/v1/iosfwd:89:
/usr/include/c++/v1/__config:482:1: error: templates must have C++ linkage
template <bool> struct __static_assert_test;
^~~~~~~~~~~~~~~
/usr/include/c++/v1/__config:483:20: error: explicit specialization of non-template struct '__static_assert_test'
template <> struct __static_assert_test<true> {};
                   ^                   ~~~~~~
/usr/include/c++/v1/__config:484:1: error: templates must have C++ linkage
template <unsigned> struct __static_assert_check {};
^~~~~~~~~~~~~~~~~~~
In file included from /work/gcc-arm-none-eabi-4_8-2014q2-20140609/src/gcc/gcc/graphite-clast-to-gimple.c:35:
In file included from /usr/local/include/isl/val_gmp.h:4:
/usr/local/include/gmp.h:2178:33: warning: 'operator<<' has C-linkage specified, but returns user-defined type 'std::ostream &' (aka 'basic_ostream<char> &') which is incompatible with C [-Wreturn-type-c-linkage]
__GMP_DECLSPEC_XX std::ostream& operator<< (std::ostream &, mpz_srcptr);
                                ^
/usr/local/include/gmp.h:2179:33: error: conflicting types for 'operator<<'
__GMP_DECLSPEC_XX std::ostream& operator<< (std::ostream &, mpq_srcptr);
                                ^
/usr/local/include/gmp.h:2178:33: note: previous declaration is here
__GMP_DECLSPEC_XX std::ostream& operator<< (std::ostream &, mpz_srcptr);
                                ^
/usr/local/include/gmp.h:2180:33: error: conflicting types for 'operator<<'
__GMP_DECLSPEC_XX std::ostream& operator<< (std::ostream &, mpf_srcptr);
                                ^
/usr/local/include/gmp.h:2178:33: note: previous declaration is here
__GMP_DECLSPEC_XX std::ostream& operator<< (std::ostream &, mpz_srcptr);
                                ^
/usr/local/include/gmp.h:2181:33: warning: 'operator>>' has C-linkage specified, but returns user-defined type 'std::istream &' (aka 'basic_istream<char> &') which is incompatible with C [-Wreturn-type-c-linkage]
__GMP_DECLSPEC_XX std::istream& operator>> (std::istream &, mpz_ptr);
                                ^
/usr/local/include/gmp.h:2182:33: error: conflicting types for 'operator>>'
__GMP_DECLSPEC_XX std::istream& operator>> (std::istream &, mpq_ptr);
                                ^
/usr/local/include/gmp.h:2181:33: note: previous declaration is here
__GMP_DECLSPEC_XX std::istream& operator>> (std::istream &, mpz_ptr);
                                ^
/usr/local/include/gmp.h:2183:33: error: conflicting types for 'operator>>'
__GMP_DECLSPEC_XX std::istream& operator>> (std::istream &, mpf_ptr);
                                ^
/usr/local/include/gmp.h:2181:33: note: previous declaration is here
__GMP_DECLSPEC_XX std::istream& operator>> (std::istream &, mpz_ptr);
                                ^
2 warnings and 7 errors generated.
gmake[4]: *** [graphite-clast-to-gimple.o] Error 1
Comment 2 Lev A. Serebryakov freebsd_committer freebsd_triage 2014-07-06 16:42:46 UTC
Problem is, I don't want to add ANY patches to this port. It should be bit-to-bit compatible with official builds from ARM (for Ubuntu, Windows and Mac OS X), it is main goal of this port.
Maybe, I should switch it to provided isl/cloog and don't use "system" ones, if we will have isl-0.13 in ports.
Comment 3 Lev A. Serebryakov freebsd_committer freebsd_triage 2014-07-06 16:46:49 UTC
Bu, OK, this patch looks innocent enough. I'll try to integrate it.
Comment 4 Lev A. Serebryakov freebsd_committer freebsd_triage 2014-07-06 18:44:35 UTC
Nope. This patch is not complete. Even after solving problem with C/C++ linkage it still gives me:

/usr/home/lev/FreeBSD/ports/devel/gcc-arm-embedded/work/gcc-arm-none-eabi-4_8-2014q2-20140609/src/gcc/gcc/graphite-optimize-isl.c:370:12: error: use of undeclared identifier 'isl_band_member_is_zero_distance'
              if (isl_band_member_is_zero_distance(Band, i))
                  ^
1 error generated.

So, gcc could not use isl 0.13. Only way to go is to downgrade isl to 0.12.
Comment 5 Lev A. Serebryakov freebsd_committer freebsd_triage 2014-07-06 18:47:06 UTC
isl 0.13 release notes says, that

The function isl_band_member_is_zero_distance has been removed. Essentially the same functionality is available through isl_band_member_is_coincident, except that is requires setting up coincidence constraints. The option schedule_outer_zero_distance has accordingly been replaced by the option 

And it doesn't look like trivial change to me! I don't know, how to "setting up coincidence constraints" :(
Comment 6 Jan Beich freebsd_committer freebsd_triage 2014-07-08 04:48:02 UTC
Why not use Polly example?

https://llvm.org/viewvc/llvm-project/polly/trunk/lib/ScheduleOptimizer.cpp?r1=200155&r2=200154&pathrev=200155

after applying

--- graphite-optimize-isl.c~
+++ graphite-optimize-isl.c
@@ -367,7 +367,7 @@ getScheduleForBandList(isl_band_list *Ba
 	{
 	  for (i = ScheduleDimensions - 1 ;  i >= 0 ; i--)
 	    {
-	      if (isl_band_member_is_zero_distance(Band, i))
+	      if (isl_band_member_is_coincident(Band, i))
 		{
 		  isl_map *TileMap;
 		  isl_union_map *TileUMap;
@@ -438,6 +438,7 @@ optimize_isl (scop_p scop)
 {
 
   isl_schedule *schedule;
+  isl_schedule_constraints *schedule_constraints;
   isl_union_set *domain;
   isl_union_map *validity, *proximity, *dependences;
   isl_union_map *schedule_map;
@@ -452,11 +453,19 @@ optimize_isl (scop_p scop)
 
   proximity = isl_union_map_copy (validity);
 
+  schedule_constraints = isl_schedule_constraints_on_domain(domain);
+  schedule_constraints =
+      isl_schedule_constraints_set_proximity(schedule_constraints, proximity);
+  schedule_constraints = isl_schedule_constraints_set_validity(
+      schedule_constraints, isl_union_map_copy(validity));
+  schedule_constraints =
+      isl_schedule_constraints_set_coincidence(schedule_constraints, validity);
+
   isl_options_set_schedule_max_constant_term(scop->ctx, CONSTANT_BOUND);
   isl_options_set_schedule_maximize_band_depth(scop->ctx, 1);
   isl_options_set_schedule_fuse(scop->ctx, ISL_SCHEDULE_FUSE_MIN);
   isl_options_set_on_error(scop->ctx, ISL_ON_ERROR_CONTINUE);
-  schedule = isl_union_set_compute_schedule (domain, validity, proximity);
+  schedule = isl_schedule_constraints_compute_schedule(schedule_constraints);
   isl_options_set_on_error(scop->ctx, ISL_ON_ERROR_ABORT);
 
   if (!schedule)
Comment 7 Jan Beich freebsd_committer freebsd_triage 2014-07-08 05:59:22 UTC
Created attachment 144507 [details]
fix, v2

Better to set schedule_constraints within schedule context options to inherit ISL_ON_ERROR_CONTINUE as done in the example. Anyway, here's a full patch again.
Comment 8 Lev A. Serebryakov freebsd_committer freebsd_triage 2014-07-09 12:31:46 UTC
Patch committed, everything works now.