From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu [128.95.76.21]) by sourceware.org (Postfix) with ESMTPS id C86163858D33; Mon, 26 Dec 2022 00:57:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C86163858D33 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=troutmask.apl.washington.edu Authentication-Results: sourceware.org; spf=none smtp.mailfrom=troutmask.apl.washington.edu Received: from troutmask.apl.washington.edu (localhost [127.0.0.1]) by troutmask.apl.washington.edu (8.16.1/8.16.1) with ESMTPS id 2BQ0vI8k038434 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sun, 25 Dec 2022 16:57:18 -0800 (PST) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.16.1/8.16.1/Submit) id 2BQ0vITn038433; Sun, 25 Dec 2022 16:57:18 -0800 (PST) (envelope-from sgk) Date: Sun, 25 Dec 2022 16:57:18 -0800 From: Steve Kargl To: Lipeng Zhu via Fortran Cc: gcc-patches@gcc.gnu.org, hongjiu.lu@intel.com, tianyou.li@intel.com, pan.deng@intel.com, lipeng.zhu@intel.com Subject: Re: [PATCH] libgfortran: Replace mutex with rwlock Message-ID: Reply-To: sgk@troutmask.apl.washington.edu References: <20221222002711.116962-1-lipeng.zhu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <20221222002711.116962-1-lipeng.zhu@intel.com> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,KAM_DMARC_STATUS,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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. >=20 > 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 >=20 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=3Dcompile /ho= me/kargl/gcc/obj/./gcc/xgcc -shared-libgcc -B/home/kargl/gcc/obj/./gcc -nos= tdinc++ -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/h= ome/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-freebsd1= 4.0/include -isystem /home/kargl/work/x86_64-unknown-freebsd14.0/sys-includ= e -fno-checking -I/home/kargl/gcc/gcc/libstdc++-v3/../libgcc -I/home/karg= l/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3/include/x86_64-unknown-fr= eebsd14.0 -I/home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstdc++-v3/inc= lude -I/home/kargl/gcc/gcc/libstdc++-v3/libsupc++ -std=3Dgnu++17 -nostdin= c++ -prefer-pic -D_GLIBCXX_SHARED -fno-implicit-templates -Wall -Wextra -W= write-strings -Wcast-qual -Wabi=3D2 -fdiagnostics-show-location=3Donce -= ffunction-sections -fdata-sections -frandom-seed=3Dfloating_from_chars.lo = -fimplicit-templates -g -O2 -c -o floating_from_chars.lo ../../../../../g= cc/libstdc++-v3/src/c++17/floating_from_chars.cc libtool: compile: /home/kargl/gcc/obj/./gcc/xgcc -shared-libgcc -B/home/ka= rgl/gcc/obj/./gcc -nostdinc++ -L/home/kargl/gcc/obj/x86_64-unknown-freebsd1= 4.0/libstdc++-v3/src -L/home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libst= dc++-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/x= 86_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/inclu= de/x86_64-unknown-freebsd14.0 -I/home/kargl/gcc/obj/x86_64-unknown-freebsd1= 4.0/libstdc++-v3/include -I/home/kargl/gcc/gcc/libstdc++-v3/libsupc++ -std= =3Dgnu++17 -nostdinc++ -D_GLIBCXX_SHARED -fno-implicit-templates -Wall -Wex= tra -Wwrite-strings -Wcast-qual -Wabi=3D2 -fdiagnostics-show-location=3Donc= e -ffunction-sections -fdata-sections -frandom-seed=3Dfloating_from_chars.l= o -fimplicit-templates -g -O2 -c ../../../../../gcc/libstdc++-v3/src/c++17/= floating_from_chars.cc -fPIC -DPIC -D_GLIBCXX_SHARED -o floating_from_char= s.o In file included from /home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstd= c++-v3/include/memory_resource:40, from ../../../../../gcc/libstdc++-v3/src/c++17/floating_fr= om_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(pthrea= d_rwlock**&)' is ambiguous 80 | _GLIBCXX_GTHRW(rwlock_rdlock) | ^ In file included from /home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstd= c++-v3/include/x86_64-unknown-freebsd14.0/bits/gthr.h:148, from /home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstd= c++-v3/include/bits/std_mutex.h:41, from /home/kargl/gcc/obj/x86_64-unknown-freebsd14.0/libstd= c++-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(pthrea= d_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 __gthr= w_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(pth= read_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(pth= read_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 __gthr= w_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(pthrea= d_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(pthrea= d_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 __gthr= w_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(pth= read_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(pth= read_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 __gthr= w_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(pthrea= d_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(pthrea= d_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 __gthr= w_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