public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/33578] __gnu_parallel::yield means what?
       [not found] <bug-33578-4@http.gcc.gnu.org/bugzilla/>
@ 2023-05-16 19:41 ` pinskia at gcc dot gnu.org
  2023-05-16 20:24 ` redi at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-16 19:41 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=33578

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |NEW
           Assignee|bkoz at gcc dot gnu.org            |unassigned at gcc dot gnu.org

--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Unassigning since Benjamin since not been active in GCC development for over 8
years now.

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

* [Bug libstdc++/33578] __gnu_parallel::yield means what?
       [not found] <bug-33578-4@http.gcc.gnu.org/bugzilla/>
  2023-05-16 19:41 ` [Bug libstdc++/33578] __gnu_parallel::yield means what? pinskia at gcc dot gnu.org
@ 2023-05-16 20:24 ` redi at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2023-05-16 20:24 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=33578

--- Comment #10 from Jonathan Wakely <redi at gcc dot gnu.org> ---
For std::this_thread::yield() we do:

    inline void
    yield() noexcept
    {
#if defined _GLIBCXX_HAS_GTHREADS && defined _GLIBCXX_USE_SCHED_YIELD
      __gthread_yield();
#endif
    }

And gthr-win32.h has:

__GTHREAD_WIN32_INLINE int
__gthread_yield (void)
{
  Sleep (0);
  return 0;
}

For atomics we also support using the x86 pause instruction

    inline void
    __thread_yield() noexcept
    {
#if defined _GLIBCXX_HAS_GTHREADS && defined _GLIBCXX_USE_SCHED_YIELD
     __gthread_yield();
#endif
    }

    inline void
    __thread_relax() noexcept
    {
#if defined __i386__ || defined __x86_64__
      __builtin_ia32_pause();
#else
      __thread_yield();
#endif
    }



For Parallel Mode maybe we should just use __gthread_yield() everywhere?
gthr-win32.h already takes care of hiding the Win32 API. Since Parallel Mode is
likely to get removed at some point (now that we have the parallel STL algos
from C++17) I don't see any point in revisiting its implementation w.r.t using
of yield at all (comment 1).

tl;dr let's not reinvent the wheel when we already have portable code for
yielding, and don't want to redesign the parallel mode.

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

* [Bug libstdc++/33578] __gnu_parallel::yield means what?
  2007-09-28  0:41 [Bug libstdc++/33578] New: libstdc++ parallel mode broken on mingw32 dannysmith at users dot sourceforge dot net
@ 2007-10-16 17:24 ` bkoz at gcc dot gnu dot org
  0 siblings, 0 replies; 3+ messages in thread
From: bkoz at gcc dot gnu dot org @ 2007-10-16 17:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from bkoz at gcc dot gnu dot org  2007-10-16 17:24 -------

Changing this summary now that the mingw32 issue is fixed. Now, opening this
out to the implementation issues... 


-- 

bkoz at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   GCC host triplet|i686-pc-mingw32             |all
 GCC target triplet|i686-pc-mingw32             |all
            Summary|__gnu_parallel::yield broken|__gnu_parallel::yield means
                   |on mingw32                  |what?


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33578


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

end of thread, other threads:[~2023-05-16 20:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-33578-4@http.gcc.gnu.org/bugzilla/>
2023-05-16 19:41 ` [Bug libstdc++/33578] __gnu_parallel::yield means what? pinskia at gcc dot gnu.org
2023-05-16 20:24 ` redi at gcc dot gnu.org
2007-09-28  0:41 [Bug libstdc++/33578] New: libstdc++ parallel mode broken on mingw32 dannysmith at users dot sourceforge dot net
2007-10-16 17:24 ` [Bug libstdc++/33578] __gnu_parallel::yield means what? bkoz at gcc dot gnu dot org

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