On Sun, Dec 25, 2022 at 4:58 PM Steve Kargl via Gcc-patches
<gcc-patc...@gcc.gnu.org> wrote:
>
> On Wed, Dec 21, 2022 at 07:27:11PM -0500, Lipeng Zhu via Fortran wrote:
> > This patch try to introduce the rwlock and split the read/write to
> > unit_root tree and unit_cache with rwlock instead of the mutex to
> > increase CPU efficiency. In the get_gfc_unit function, the percentage
> > to step into the insert_unit function is around 30%, in most instances,
> > we can get the unit in the phase of reading the unit_cache or unit_root
> > tree. So split the read/write phase by rwlock would be an approach to
> > make it more parallel.
> >
> > BTW, the IPC metrics can increase from 0.25 to 2.2 in the Intel
> > SRP server with 220 cores. The benchmark we used is
> > https://github.com/rwesson/NEAT
> >
>
> The patch fails bootstrap on x86_64-*-freebsd.
>
> gmake[6]: Entering directory 
> '/home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3/src/c++17'
> /bin/sh ../../libtool --tag CXX --tag disable-shared   --mode=compile 
> /home/kargl/gcc/obj/./gcc/xgcc -shared-libgcc -B/home/kargl/gcc/obj/./gcc 
> -nostdinc++ -L/home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3/src 
> -L/home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3/src/.libs 
> -L/home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3/libsupc++/.libs 
> -B/home/kargl/work/x86_64-unknown-freebsd14.0/bin/ 
> -B/home/kargl/work/x86_64-unknown-freebsd14.0/lib/ -isystem 
> /home/kargl/work/x86_64-unknown-freebsd14.0/include -isystem 
> /home/kargl/work/x86_64-unknown-freebsd14.0/sys-include   -fno-checking 
> -I/home/kargl/gcc/gcc/libstdc++-v3/../libgcc 
> -I/home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3/include/x86_64-unknown-freebsd14.0
>  -I/home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3/include 
> -I/home/kargl/gcc/gcc/libstdc++-v3/libsupc++   -std=gnu++17 -nostdinc++ 
> -prefer-pic -D_GLIBCXX_SHARED -fno-implicit-templates  -Wall -Wextra 
> -Wwrite-strings -Wcast-qual -Wabi=2  -fdiagnostics-show-location=once   
> -ffunction-sections -fdata-sections  -frandom-seed=floating_from_chars.lo  
> -fimplicit-templates -g -O2  -c -o floating_from_chars.lo 
> ../../../../../gcc/libstdc++-v3/src/c++17/floating_from_chars.cc
> libtool: compile:  /home/kargl/gcc/obj/./gcc/xgcc -shared-libgcc 
> -B/home/kargl/gcc/obj/./gcc -nostdinc++ 
> -L/home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3/src 
> -L/home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3/src/.libs 
> -L/home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3/libsupc++/.libs 
> -B/home/kargl/work/x86_64-unknown-freebsd14.0/bin/ 
> -B/home/kargl/work/x86_64-unknown-freebsd14.0/lib/ -isystem 
> /home/kargl/work/x86_64-unknown-freebsd14.0/include -isystem 
> /home/kargl/work/x86_64-unknown-freebsd14.0/sys-include -fno-checking 
> -I/home/kargl/gcc/gcc/libstdc++-v3/../libgcc 
> -I/home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3/include/x86_64-unknown-freebsd14.0
>  -I/home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3/include 
> -I/home/kargl/gcc/gcc/libstdc++-v3/libsupc++ -std=gnu++17 -nostdinc++ 
> -D_GLIBCXX_SHARED -fno-implicit-templates -Wall -Wextra -Wwrite-strings 
> -Wcast-qual -Wabi=2 -fdiagnostics-show-location=once -ffunction-sections 
> -fdata-sections -frandom-seed=floating_from_chars.lo -fimplicit-templates -g 
> -O2 -c ../../../../../gcc/libstdc++-v3/src/c++17/floating_from_chars.cc  
> -fPIC -DPIC -D_GLIBCXX_SHARED -o floating_from_chars.o
> In file included from 
> /home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3/include/memory_resource:40,
>                  from 
> ../../../../../gcc/libstdc++-v3/src/c++17/floating_from_chars.cc:37:
> /home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3/include/shared_mutex:
>  In function 'int std::__glibcxx_rwlock_rdlock(pthread_rwlock**)':
> /home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3/include/shared_mutex:80:3:
>  error: call of overloaded '__gthrw_pthread_rwlock_rdlock(pthread_rwlock**&)' 
> is ambiguous
>    80 |   _GLIBCXX_GTHRW(rwlock_rdlock)
>       |   ^
> In file included from 
> /home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3/include/x86_64-unknown-freebsd14.0/bits/gthr.h:148,
>                  from 
> /home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3/include/bits/std_mutex.h:41,
>                  from 
> /home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3/include/shared_mutex:41:
> /home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3/include/shared_mutex:80:3:
>  note: candidate: 'int std::__gthrw_pthread_rwlock_rdlock(pthread_rwlock**)'
>    80 |   _GLIBCXX_GTHRW(rwlock_rdlock)
>       |   ^~~~~~~~~~~~~~
> /home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3/include/x86_64-unknown-freebsd14.0/bits/gthr-default.h:140:1:
>  note: candidate: 'int __gthrw_pthread_rwlock_rdlock(pthread_rwlock**)'
>   140 | __gthrw(pthread_rwlock_rdlock)
>       | ^~~~~~~
> /home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3/include/shared_mutex:
>  In function 'int std::__glibcxx_rwlock_tryrdlock(pthread_rwlock**)':
> /home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3/include/shared_mutex:81:3:
>  error: call of overloaded 
> '__gthrw_pthread_rwlock_tryrdlock(pthread_rwlock**&)' is ambiguous
>    81 |   _GLIBCXX_GTHRW(rwlock_tryrdlock)
>       |   ^
> /home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3/include/shared_mutex:81:3:
>  note: candidate: 'int 
> std::__gthrw_pthread_rwlock_tryrdlock(pthread_rwlock**)'
>    81 |   _GLIBCXX_GTHRW(rwlock_tryrdlock)
>       |   ^~~~~~~~~~~~~~
> /home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3/include/x86_64-unknown-freebsd14.0/bits/gthr-default.h:141:1:
>  note: candidate: 'int __gthrw_pthread_rwlock_tryrdlock(pthread_rwlock**)'
>   141 | __gthrw(pthread_rwlock_tryrdlock)
>       | ^~~~~~~
> /home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3/include/shared_mutex:
>  In function 'int std::__glibcxx_rwlock_wrlock(pthread_rwlock**)':
> /home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3/include/shared_mutex:82:3:
>  error: call of overloaded '__gthrw_pthread_rwlock_wrlock(pthread_rwlock**&)' 
> is ambiguous
>    82 |   _GLIBCXX_GTHRW(rwlock_wrlock)
>       |   ^
> /home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3/include/shared_mutex:82:3:
>  note: candidate: 'int std::__gthrw_pthread_rwlock_wrlock(pthread_rwlock**)'
>    82 |   _GLIBCXX_GTHRW(rwlock_wrlock)
>       |   ^~~~~~~~~~~~~~
> /home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3/include/x86_64-unknown-freebsd14.0/bits/gthr-default.h:142:1:
>  note: candidate: 'int __gthrw_pthread_rwlock_wrlock(pthread_rwlock**)'
>   142 | __gthrw(pthread_rwlock_wrlock)
>       | ^~~~~~~
> /home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3/include/shared_mutex:
>  In function 'int std::__glibcxx_rwlock_trywrlock(pthread_rwlock**)':
> /home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3/include/shared_mutex:83:3:
>  error: call of overloaded 
> '__gthrw_pthread_rwlock_trywrlock(pthread_rwlock**&)' is ambiguous
>    83 |   _GLIBCXX_GTHRW(rwlock_trywrlock)
>       |   ^
> /home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3/include/shared_mutex:83:3:
>  note: candidate: 'int 
> std::__gthrw_pthread_rwlock_trywrlock(pthread_rwlock**)'
>    83 |   _GLIBCXX_GTHRW(rwlock_trywrlock)
>       |   ^~~~~~~~~~~~~~
> /home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3/include/x86_64-unknown-freebsd14.0/bits/gthr-default.h:143:1:
>  note: candidate: 'int __gthrw_pthread_rwlock_trywrlock(pthread_rwlock**)'
>   143 | __gthrw(pthread_rwlock_trywrlock)
>       | ^~~~~~~
> /home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3/include/shared_mutex:
>  In function 'int std::__glibcxx_rwlock_unlock(pthread_rwlock**)':
> /home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3/include/shared_mutex:84:3:
>  error: call of overloaded '__gthrw_pthread_rwlock_unlock(pthread_rwlock**&)' 
> is ambiguous
>    84 |   _GLIBCXX_GTHRW(rwlock_unlock)
>       |   ^
> /home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3/include/shared_mutex:84:3:
>  note: candidate: 'int std::__gthrw_pthread_rwlock_unlock(pthread_rwlock**)'
>    84 |   _GLIBCXX_GTHRW(rwlock_unlock)
>       |   ^~~~~~~~~~~~~~
> /home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3/include/x86_64-unknown-freebsd14.0/bits/gthr-default.h:144:1:
>  note: candidate: 'int __gthrw_pthread_rwlock_unlock(pthread_rwlock**)'
>   144 | __gthrw(pthread_rwlock_unlock)
>       | ^~~~~~~
> gmake[6]: *** [Makefile:585: floating_from_chars.lo] Error 1
> gmake[6]: Leaving directory 
> '/home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3/src/c++17'
> gmake[5]: *** [Makefile:784: all-recursive] Error 1
> gmake[5]: Leaving directory 
> '/home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3/src'
> gmake[4]: *** [Makefile:576: all-recursive] Error 1
> gmake[4]: Leaving directory 
> '/home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3'
> gmake[3]: *** [Makefile:501: all] Error 2
> gmake[3]: Leaving directory 
> '/home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3'
> gmake[2]: *** [Makefile:18284: all-stage1-target-libstdc++-v3] Error 2
> gmake[2]: Leaving directory '/home/kargl/gcc/obj'
> gmake[1]: *** [Makefile:26171: stage1-bubble] Error 2
> gmake[1]: Leaving directory '/home/kargl/gcc/obj'
> gmake: *** [Makefile:26524: bootstrap] Error 2
>
> --
> steve

libstdc++ implements shared mutex with pthread_rwlock, which can conflict
with the pthread_rwlock usage in libgcc.  Lipeng, please limit the
pthread_rwlock
usage in libgcc only when __cplusplus isn't defined.


-- 
H.J.

Reply via email to