Interoperability with C++ coroutines

Hi,

Is the latest runtime and compiler for OpenMP interoperable with C++ coroutine TS? For example, what if I have a coroutine along with work-sharing directives?

I remember there was a discussion in OpenMP Interoperability language subcommittee and I’d like to ask about the current status for Interoperability with C++ coroutine TS.

Thanks,
Yongkee

The OpenMP specification does define interoperability with any other threading model. Implementations may provide interoperability of some variants, which is derived from the use of OS threads (e.g. POSIX threads) as the foundation for OpenMP and other models.

If your use of coroutines is completely distinct from OpenMP, it is possible that things will not break, but I can imagine many thinks could go wrong if you try to use them together.

One possible way to reason about interoperability is to treat coroutines as structure goto and see what the OpenMP specification says about goto/longjmp, but this is at best a necessary but insufficient to understand the interaction of coroutines and OpenMP.

Jeff

That is an actually good mental model to treat coroutines as control manipulation such as goto/longjmp. Could you please refer to where OpenMP specification says about them?

I wrote a few simple code with coroutines in a canonical loop form and ended up with a segmentation fault somewhere in outlined code. So I was wondering if there is any plan to incorporate them.

Thanks,
Yongkee

Please look at https://www.openmp.org/wp-content/uploads/OpenMP-API-Specification-5.0.pdf and search for “longjmp”.

I do not know if/when coroutines will ever be considered by the OpenMP specification. That will be up to the OpenMP standards group rather than the LLVM OpenMP implementers, although there is nontrivial overlap between the two groups.

As for your segfault, it’s impossible to diagnose this without code.

Jeff