public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* For which gcc release is going to be foreseen the support for the Coroutines TS extension?
@ 2018-06-04 17:32 Marco Ippolito
  2018-06-04 17:36 ` Jonathan Wakely
  0 siblings, 1 reply; 10+ messages in thread
From: Marco Ippolito @ 2018-06-04 17:32 UTC (permalink / raw)
  To: gcc

Hi all,

clang and VS2017 already support the Coroutines TS extensions.
For which gcc release is going to be foreseen the support for the
Coroutines TS extension?

Looking forward to your kind feedback about this extremely important aspect
of gcc.

Marco

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

* Re: For which gcc release is going to be foreseen the support for the Coroutines TS extension?
  2018-06-04 17:32 For which gcc release is going to be foreseen the support for the Coroutines TS extension? Marco Ippolito
@ 2018-06-04 17:36 ` Jonathan Wakely
  2018-06-06  7:14   ` Florian Weimer
  0 siblings, 1 reply; 10+ messages in thread
From: Jonathan Wakely @ 2018-06-04 17:36 UTC (permalink / raw)
  To: Marco Ippolito; +Cc: gcc

On 4 June 2018 at 18:32, Marco Ippolito wrote:
> Hi all,
>
> clang and VS2017 already support the Coroutines TS extensions.
> For which gcc release is going to be foreseen the support for the
> Coroutines TS extension?

This has been discussed recently, search the mailing list.

It will be supported after somebody implements it.

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

* Re: For which gcc release is going to be foreseen the support for the Coroutines TS extension?
  2018-06-04 17:36 ` Jonathan Wakely
@ 2018-06-06  7:14   ` Florian Weimer
  2019-07-26  8:54     ` Sebastian Huber
  0 siblings, 1 reply; 10+ messages in thread
From: Florian Weimer @ 2018-06-06  7:14 UTC (permalink / raw)
  To: Jonathan Wakely, Marco Ippolito; +Cc: gcc

On 06/04/2018 07:36 PM, Jonathan Wakely wrote:
> On 4 June 2018 at 18:32, Marco Ippolito wrote:
>> Hi all,
>>
>> clang and VS2017 already support the Coroutines TS extensions.
>> For which gcc release is going to be foreseen the support for the
>> Coroutines TS extension?
> 
> This has been discussed recently, search the mailing list.
> 
> It will be supported after somebody implements it.

If it is in fact implementable on top of the GNU ABI.  Some variants of 
coroutines are not.

Florian

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

* Re: For which gcc release is going to be foreseen the support for the Coroutines TS extension?
  2018-06-06  7:14   ` Florian Weimer
@ 2019-07-26  8:54     ` Sebastian Huber
  2019-07-26  9:19       ` Florian Weimer
  0 siblings, 1 reply; 10+ messages in thread
From: Sebastian Huber @ 2019-07-26  8:54 UTC (permalink / raw)
  To: GCC

Hello,

On 06/06/2018 08:33, Florian Weimer wrote:
> On 06/04/2018 07:36 PM, Jonathan Wakely wrote:
>> On 4 June 2018 at 18:32, Marco Ippolito wrote:
>>> Hi all,
>>>
>>> clang and VS2017 already support the Coroutines TS extensions.
>>> For which gcc release is going to be foreseen the support for the
>>> Coroutines TS extension?
>>
>> This has been discussed recently, search the mailing list.
>>
>> It will be supported after somebody implements it.
> 
> If it is in fact implementable on top of the GNU ABI.  Some variants of 
> coroutines are not.


it seems C++20 will contain coroutines. Are there already some plans to 
support them in GCC? I ask this so that I can plan my work to support it 
for RTEMS. For example, are there plans to build them on top of ucontext?

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber@embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.

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

* Re: For which gcc release is going to be foreseen the support for the Coroutines TS extension?
  2019-07-26  8:54     ` Sebastian Huber
@ 2019-07-26  9:19       ` Florian Weimer
  2019-07-26 10:03         ` Iain Sandoe
  0 siblings, 1 reply; 10+ messages in thread
From: Florian Weimer @ 2019-07-26  9:19 UTC (permalink / raw)
  To: Sebastian Huber; +Cc: GCC

* Sebastian Huber:

> Hello,
>
> On 06/06/2018 08:33, Florian Weimer wrote:
>> On 06/04/2018 07:36 PM, Jonathan Wakely wrote:
>>> On 4 June 2018 at 18:32, Marco Ippolito wrote:
>>>> Hi all,
>>>>
>>>> clang and VS2017 already support the Coroutines TS extensions.
>>>> For which gcc release is going to be foreseen the support for the
>>>> Coroutines TS extension?
>>>
>>> This has been discussed recently, search the mailing list.
>>>
>>> It will be supported after somebody implements it.
>>
>> If it is in fact implementable on top of the GNU ABI.  Some variants
>> of coroutines are not.
>
> it seems C++20 will contain coroutines. Are there already some plans
> to support them in GCC?

There is <http://gcc.gnu.org/wiki/cxx-coroutines>.  Iain Sandoe is
working on it.

> I ask this so that I can plan my work to
> support it for RTEMS. For example, are there plans to build them on
> top of ucontext?

C++ coroutines are stackless.  I don't think any new low-level run-time
support will be needed.

Thanks,
Florian

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

* Re: For which gcc release is going to be foreseen the support for the Coroutines TS extension?
  2019-07-26  9:19       ` Florian Weimer
@ 2019-07-26 10:03         ` Iain Sandoe
  2019-08-20 15:19           ` Nathan Sidwell
  0 siblings, 1 reply; 10+ messages in thread
From: Iain Sandoe @ 2019-07-26 10:03 UTC (permalink / raw)
  To: Sebastian Huber; +Cc: GCC

Hello Sebastian,

> On 26 Jul 2019, at 10:19, Florian Weimer <fweimer@redhat.com> wrote:
> 
> * Sebastian Huber:

>> On 06/06/2018 08:33, Florian Weimer wrote:
>>> On 06/04/2018 07:36 PM, Jonathan Wakely wrote:
>>>> On 4 June 2018 at 18:32, Marco Ippolito wrote:
>>>>> Hi all,
>>>>> 
>>>>> clang and VS2017 already support the Coroutines TS extensions.
>>>>> For which gcc release is going to be foreseen the support for the
>>>>> Coroutines TS extension?
>>>> 
>>>> This has been discussed recently, search the mailing list.
>>>> 
>>>> It will be supported after somebody implements it.
>>> 
>>> If it is in fact implementable on top of the GNU ABI.  Some variants
>>> of coroutines are not.
>> 
>> it seems C++20 will contain coroutines. Are there already some plans
>> to support them in GCC?
> 
> There is <http://gcc.gnu.org/wiki/cxx-coroutines>.  Iain Sandoe is
> working on it.

The hope is to have enough of the implementation complete to post before
the end of stage1, and for potential inclusion in GCC10 (if there’s enough
review/amendment time).  Still plenty to do before then tho!

It’s also intended to present the background and status at the Cauldron.

>> I ask this so that I can plan my work to
>> support it for RTEMS. For example, are there plans to build them on
>> top of ucontext?
> 
> C++ coroutines are stackless.  I don't think any new low-level run-time
> support will be needed.

correct, C++20 coroutines and threading mechanisms are orthogonal 
facilities; one can use (IS C++20) coroutines on top of a threaded system
or in a single-threaded environment.

Two places I see them as being a go-to facility in embedded systems are:
 * co-operative multi-tasking UIs on single-threaded platforms.
 * async I/O completion by continuations, rather than callbacks.

Of course, there are likely to be many of the shared cases with non-embedded
- there can be quite surprising implementations where coros can be used to 
hide memory access latency, for example.

cheers
Iain


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

* Re: For which gcc release is going to be foreseen the support for the Coroutines TS extension?
  2019-07-26 10:03         ` Iain Sandoe
@ 2019-08-20 15:19           ` Nathan Sidwell
  2019-08-20 15:54             ` Richard Biener
  0 siblings, 1 reply; 10+ messages in thread
From: Nathan Sidwell @ 2019-08-20 15:19 UTC (permalink / raw)
  To: Iain Sandoe, Sebastian Huber; +Cc: GCC

On 7/26/19 6:03 AM, Iain Sandoe wrote:
> Hello Sebastian,
> 
>> On 26 Jul 2019, at 10:19, Florian Weimer <fweimer@redhat.com> wrote:

>> C++ coroutines are stackless.  I don't think any new low-level run-time
>> support will be needed.
> 
> correct, C++20 coroutines and threading mechanisms are orthogonal
> facilities; one can use (IS C++20) coroutines on top of a threaded system
> or in a single-threaded environment.
> 
> Two places I see them as being a go-to facility in embedded systems are:
>   * co-operative multi-tasking UIs on single-threaded platforms.
>   * async I/O completion by continuations, rather than callbacks.

There are cases where the overhead of threads is too expensive.  For 
instance hiding (cache-missing) load latencies by doing other work while 
waiting -- a context switch at that point is far too expensive.

nathan

-- 
Nathan Sidwell

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

* Re: For which gcc release is going to be foreseen the support for the Coroutines TS extension?
  2019-08-20 15:19           ` Nathan Sidwell
@ 2019-08-20 15:54             ` Richard Biener
  2019-08-20 16:15               ` Florian Weimer
  0 siblings, 1 reply; 10+ messages in thread
From: Richard Biener @ 2019-08-20 15:54 UTC (permalink / raw)
  To: gcc, Nathan Sidwell, Iain Sandoe, Sebastian Huber; +Cc: GCC

On August 20, 2019 5:19:33 PM GMT+02:00, Nathan Sidwell <nathan@acm.org> wrote:
>On 7/26/19 6:03 AM, Iain Sandoe wrote:
>> Hello Sebastian,
>> 
>>> On 26 Jul 2019, at 10:19, Florian Weimer <fweimer@redhat.com> wrote:
>
>>> C++ coroutines are stackless.  I don't think any new low-level
>run-time
>>> support will be needed.
>> 
>> correct, C++20 coroutines and threading mechanisms are orthogonal
>> facilities; one can use (IS C++20) coroutines on top of a threaded
>system
>> or in a single-threaded environment.
>> 
>> Two places I see them as being a go-to facility in embedded systems
>are:
>>   * co-operative multi-tasking UIs on single-threaded platforms.
>>   * async I/O completion by continuations, rather than callbacks.
>
>There are cases where the overhead of threads is too expensive.  For 
>instance hiding (cache-missing) load latencies by doing other work
>while 
>waiting -- a context switch at that point is far too expensive.

But are coroutines so much lower latency (and a context switch does not involve cache misses on its own?). For doing useful work in this context CPU designers invented SMT... 

Richard. 

>nathan

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

* Re: For which gcc release is going to be foreseen the support for the Coroutines TS extension?
  2019-08-20 15:54             ` Richard Biener
@ 2019-08-20 16:15               ` Florian Weimer
  2019-08-21 12:29                 ` Iain Sandoe
  0 siblings, 1 reply; 10+ messages in thread
From: Florian Weimer @ 2019-08-20 16:15 UTC (permalink / raw)
  To: Richard Biener; +Cc: gcc, Nathan Sidwell, Iain Sandoe, Sebastian Huber

* Richard Biener:

> On August 20, 2019 5:19:33 PM GMT+02:00, Nathan Sidwell <nathan@acm.org> wrote:
>>On 7/26/19 6:03 AM, Iain Sandoe wrote:
>>> Hello Sebastian,
>>> 
>>>> On 26 Jul 2019, at 10:19, Florian Weimer <fweimer@redhat.com> wrote:
>>
>>>> C++ coroutines are stackless.  I don't think any new low-level
>>run-time
>>>> support will be needed.
>>> 
>>> correct, C++20 coroutines and threading mechanisms are orthogonal
>>> facilities; one can use (IS C++20) coroutines on top of a threaded
>>system
>>> or in a single-threaded environment.
>>> 
>>> Two places I see them as being a go-to facility in embedded systems
>>are:
>>>   * co-operative multi-tasking UIs on single-threaded platforms.
>>>   * async I/O completion by continuations, rather than callbacks.
>>
>>There are cases where the overhead of threads is too expensive.  For 
>>instance hiding (cache-missing) load latencies by doing other work
>>while 
>>waiting -- a context switch at that point is far too expensive.
>
> But are coroutines so much lower latency (and a context switch does
> not involve cache misses on its own?). For doing useful work in this
> context CPU designers invented SMT...

I think the idea is that you don't have to worry about synchronizing
multiple threads to reap the benefits from hardware parallelism.  For
hiding memory access latency, that could be important because the
synchronization overhead could easily eat up any potential benefits.

Thanks,
Florian

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

* Re: For which gcc release is going to be foreseen the support for the Coroutines TS extension?
  2019-08-20 16:15               ` Florian Weimer
@ 2019-08-21 12:29                 ` Iain Sandoe
  0 siblings, 0 replies; 10+ messages in thread
From: Iain Sandoe @ 2019-08-21 12:29 UTC (permalink / raw)
  To: Florian Weimer
  Cc: GCC, Nathan Sidwell, Sebastian Huber, Florian Weimer, Richard Biener


> On 20 Aug 2019, at 17:15, Florian Weimer <fweimer@redhat.com> wrote:
> 
> * Richard Biener:
> 
>> On August 20, 2019 5:19:33 PM GMT+02:00, Nathan Sidwell <nathan@acm.org> wrote:
>>> On 7/26/19 6:03 AM, Iain Sandoe wrote:
>>>> Hello Sebastian,
>>>> 
>>>>> On 26 Jul 2019, at 10:19, Florian Weimer <fweimer@redhat.com> wrote:
>>> 
>>>>> C++ coroutines are stackless.  I don't think any new low-level
>>> run-time
>>>>> support will be needed.
>>>> 
>>>> correct, C++20 coroutines and threading mechanisms are orthogonal
>>>> facilities; one can use (IS C++20) coroutines on top of a threaded
>>> system
>>>> or in a single-threaded environment.
>>>> 
>>>> Two places I see them as being a go-to facility in embedded systems
>>> are:
>>>>  * co-operative multi-tasking UIs on single-threaded platforms.
>>>>  * async I/O completion by continuations, rather than callbacks.
>>> 
>>> There are cases where the overhead of threads is too expensive.  For 
>>> instance hiding (cache-missing) load latencies by doing other work
>>> while 
>>> waiting -- a context switch at that point is far too expensive.
>> 
>> But are coroutines so much lower latency (and a context switch does
>> not involve cache misses on its own?). For doing useful work in this
>> context CPU designers invented SMT...
> 
> I think the idea is that you don't have to worry about synchronizing
> multiple threads to reap the benefits from hardware parallelism.  For
> hiding memory access latency, that could be important because the
> synchronization overhead could easily eat up any potential benefits.

It seems to me that this is another “tool” in the “toolbox”, and as such
will find use in more cases than the performance example given above.

Some uses might have more to do with code clarity than performance,
per se.

* e.g. any code that’s written in terms of a state machine, or as a large
body of callbacks, might prove to be a candidate for clearer representation
as coroutines.

* There’s a potentialy large reduction in held state for cases where the
processing is organised as a series of transformations (as the original 
motivating example was a compiler where it was inconvenient to produce
and consume that state between passes).

* There’s clearly an industry quest for a lighter weight representation than
threads and this is being driven (amongst others) by some of the largest
users of massively parallel systems - so SMT is not meeting all their needs.
Representatives from this group are saying that coroutines are part of the
solution that they want (and backing that up by sponsoring the language
development work and several compiler implementations).  I don’t have
visibility of their specific internal use-cases, of course, unfortunately.

* Avoiding recasting problems into a form suitable for overt multi-threading

* I expect (and already have one such person reporting bugs against my
branch) that the embedded (no threads) space will find this a clearer way
to implement some functionality (co-operative multitasking user interfaces
springs to mind as noted in a previous post).

I suppose that in the end we will not know how this tool is going to be used
until it gets wider exposure (although there are some production uses of
the LLVM implementation, it’s likely that people won’t commit heavily until
it’s in the standard).

0.02GBP only ..

Iain


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

end of thread, other threads:[~2019-08-21 12:29 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-04 17:32 For which gcc release is going to be foreseen the support for the Coroutines TS extension? Marco Ippolito
2018-06-04 17:36 ` Jonathan Wakely
2018-06-06  7:14   ` Florian Weimer
2019-07-26  8:54     ` Sebastian Huber
2019-07-26  9:19       ` Florian Weimer
2019-07-26 10:03         ` Iain Sandoe
2019-08-20 15:19           ` Nathan Sidwell
2019-08-20 15:54             ` Richard Biener
2019-08-20 16:15               ` Florian Weimer
2019-08-21 12:29                 ` Iain Sandoe

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).