public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Thomas Koenig <tkoenig@netcologne.de>
To: Ulrich Weigand <uweigand@de.ibm.com>, Nicolas Koenig <nk@koenigni.com>
Cc: gfortran <fortran@gcc.gnu.org>,
	gcc-patches@gcc.gnu.org, dje.gcc@gmail.com
Subject: Re: Build fail on gthr-simple.h targets (Re: AsyncI/O patch committed)
Date: Thu, 26 Jul 2018 20:54:00 -0000	[thread overview]
Message-ID: <f1403d7e-65b9-e8a7-c253-f974951ed826@netcologne.de> (raw)
In-Reply-To: <20180726133142.DE075D801C7@oc3748833570.ibm.com>

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

Hi Ulrich,

> The problem is that io/asynch.h unconditionally uses a couple of
> features that are not provided by gthr-simplex, in particular
>    __gthread_cond_t
> and
>    __gthread_equal / __gthread_self
> 
> According to the documentation in gthr.h, the former is only available
> if __GTHREAD_HAS_COND is defined, and the latter are only available if
> __GTHREADS_CXX0X is defined.  Neither is true for gthr-simple.h.

Thanks for the analysis, and the pointer to the macros.

Because the functionality depends on these features, it is best to
remove them if it is not present. So, here is a patch which does
just that.

This was reg-tested on Linux, which showed that the functionality is
still there. I tried bootstrapping on AIX on gcc119, but this failed
due to an unrelated issue (problem with compiling the inline
libraries).

Would it be possible to check if this restores bootstrap in the next
10 hours or so? If so, I would like to commit this. Otherwise, Nicolas
and I will not be able to fix this for a week or so, and it would be
best to revert the async I/O patch :-(

Regards

	Thomas

2018-07-25  Thomas Koenig  <tkoenig@gcc.gnu.org>

         * io/async.h: Test for feature macros for __gthread_cond_t and
         __gthread_equal.  Define ASYNC_IO if both are present.
         (SIGNAL): Define as no-op if ASYNC_IO is not defined.
         (WAIT_SIGNAL_MUTEX): Likewise.
         (REVOLE_SIGNAL): Likewise.
         (transfer_args): Define as useless struct if ASYNC_IO is not
         defined.
         (adv_cond): Likewise.
         (async_unit): Likewise.
         * io/async.c (init_async_unit): If ASYNC_IO is not defined,
         define alternate function which does nothing.
         (enqueue_transfer): Likewise.
         (enqueue_done_id): Likewise.
         (enqueue_done): Likewise.
         (enqueue_close): Likewise.
         (enqueue_data_transfer_init): Likewise.
         (collect_async_errors): Likewise. 
 
 

         (async_wait_id): Likewise. 
 
 

         (async_wait): Likewise. 
 
 

         (async_close): Likewise.

[-- Attachment #2: p-rep-1.diff --]
[-- Type: text/x-patch, Size: 3551 bytes --]

Index: io/async.h
===================================================================
--- io/async.h	(revision 262978)
+++ io/async.h	(working copy)
@@ -25,6 +25,16 @@
 #ifndef ASYNC_H
 #define ASYNC_H
 
+/* Async I/O will not work on targets which do not support
+   __gthread_cond_t and __gthread_equal / __gthread_self.  Check
+   this.  */
+
+#if defined(__GTHREAD_HAS_COND) && defined(__GTHREADS_CXX0X)
+#define ASYNC_IO 1
+#else
+#undef ASYNC_IO
+#endif
+
 /* Defining DEBUG_ASYNC will enable somewhat verbose debugging
    output for async I/O.  */
 
@@ -217,6 +227,8 @@
 
 #define INTERN_UNLOCK(mutex) T_ERROR (__gthread_mutex_unlock, mutex);
 
+#if ASYNC_IO
+
 #define SIGNAL(advcond) do{						\
     INTERN_LOCK (&(advcond)->lock);					\
     (advcond)->pending = 1;						\
@@ -257,6 +269,15 @@
     INTERN_UNLOCK (&(advcond)->lock);		\
   } while (0)
 
+#else
+
+#define SIGNAL(advcond) do{} while(0)
+#define WAIT_SIGNAL_MUTEX(advcond, condition, mutex) do{} while(0)
+#define REVOKE_SIGNAL(advcond) do{} while(0)
+
+#endif
+
+#if ASYNC_IO
 DEBUG_LINE (extern __thread const char *aio_prefix);
 
 DEBUG_LINE (typedef struct aio_lock_debug{
@@ -274,6 +295,7 @@ DEBUG_LINE (extern __gthread_mutex_t debug_queue_l
    error reporting.  */
 
 extern __thread gfc_unit *thread_unit;
+#endif
 
 enum aio_do {
   AIO_INVALID = 0,
@@ -285,6 +307,8 @@ enum aio_do {
   AIO_CLOSE
 };
 
+#if ASYNC_IO
+
 typedef union transfer_args
 {
   struct
@@ -342,6 +366,23 @@ typedef struct async_unit
 
 } async_unit;
 
+#else
+typedef union transfer_args
+{
+  int x;
+};
+
+struct adv_cond
+{
+  int x;
+};
+
+typedef struct async_unit
+{
+  int x;
+};
+#endif
+
 void init_async_unit (gfc_unit *);
 internal_proto (init_async_unit);
 
Index: io/async.c
===================================================================
--- io/async.c	(revision 262978)
+++ io/async.c	(working copy)
@@ -36,6 +36,7 @@
 #include <sys/types.h>
 
 #include "async.h"
+#if ASYNC_IO
 
 DEBUG_LINE (__thread const char *aio_prefix = MPREFIX);
 
@@ -481,3 +482,88 @@ async_close (async_unit *au)
   T_ERROR (__gthread_join, au->thread, NULL);
   free_async_unit (au);
 }
+
+#else
+
+/* Do-nothing function, which will not be called.  */
+
+void
+init_async_unit (gfc_unit *u)
+{
+  u->au = NULL;
+  return;
+}
+
+/* Do-nothing function, which will not be called.  */
+
+void
+enqueue_transfer (async_unit *au, transfer_args *arg, enum aio_do type)
+{
+  return;
+}
+
+/* Do-nothing function, which will not be called.  */
+
+int
+enqueue_done_id (async_unit *au, enum aio_do type)
+{
+  return 0;
+}
+
+/* Do-nothing function, which will not be called.  */
+
+void
+enqueue_done (async_unit *au, enum aio_do type)
+{
+  return;
+}
+
+/* Do-nothing function, which will not be called.  */
+
+void
+enqueue_close (async_unit *au)
+{
+  return;
+}
+
+/* Do-nothing function, which will not be called.  */
+
+void
+enqueue_data_transfer_init (async_unit *au, st_parameter_dt *dt, int read_flag)
+{
+  return;
+}
+
+/* Do-nothing function, which will not be called.  */
+
+bool
+collect_async_errors (st_parameter_common *cmp, async_unit *au)
+{
+  return false;
+}
+
+/* Do-nothing function, which will not be called.  */
+
+bool
+async_wait_id (st_parameter_common *cmp, async_unit *au, int i)
+{
+  return false;
+}
+
+/* Do-nothing function, which will not be called.  */
+
+bool
+async_wait (st_parameter_common *cmp, async_unit *au)
+{
+  return false;
+}
+
+/* Do-nothing function, which will not be called.  */
+
+void
+async_close (async_unit *au)
+{
+  return;
+}
+
+#endif

  parent reply	other threads:[~2018-07-26 20:54 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4dd07fa7-65e3-a4ea-b9cd-36eb4c75e875@koenigni.com>
2018-07-26 13:31 ` Ulrich Weigand
2018-07-26 13:40   ` Build fail on gthr-single.h " Ulrich Weigand
2018-07-26 20:54   ` Thomas Koenig [this message]
2018-07-27  7:31     ` Build fail on gthr-simple.h " Thomas Koenig
2018-07-27 12:26       ` David Edelsohn
     [not found]         ` <5B6021C0.5060507@arm.com>
2018-08-02 11:35           ` Async I/O patch with compilation fix Nicolas Koenig
2018-08-02 15:43             ` Christophe Lyon
2018-08-02 17:08               ` Nicolas Koenig
2018-08-03  8:46                 ` Christophe Lyon
2018-08-03 22:43                   ` Thomas König
2018-08-06 11:33                     ` Christophe Lyon
2018-08-17 15:41                   ` Thomas Koenig
2018-08-18 22:44                     ` Christophe Lyon
2018-08-19 13:40                       ` Thomas Koenig
     [not found]                         ` <CAKdteObsx+RK2t-OteU_w6L_Pv7FGLpAcLrHaPY4NDAamV-z7g@mail.gmail.com>
2018-08-21 19:43                           ` Thomas Koenig
2018-08-22 18:49                             ` David Edelsohn
2018-08-22 21:31                               ` Thomas Koenig
2018-08-23 12:25                                 ` David Edelsohn
2018-08-23 17:42                                   ` Thomas Koenig
2018-08-23 12:53                                 ` David Edelsohn
2018-07-26 15:18 Build fail on gthr-simple.h targets (Re: AsyncI/O patch committed) David Edelsohn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f1403d7e-65b9-e8a7-c253-f974951ed826@netcologne.de \
    --to=tkoenig@netcologne.de \
    --cc=dje.gcc@gmail.com \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=nk@koenigni.com \
    --cc=uweigand@de.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).