Re: [PATCH] libstdc++: Introduce scale factor in 30_threads/future/members/poll.cc [PR98678]

2024-06-10 Thread Jonathan Wakely
On Mon, 10 Jun 2024 at 12:54, Rainer Orth  wrote:
>
> 30_threads/future/members/poll.cc consistently FAILs on Solaris/x86
> (both 32 and 64-bit):
>
> FAIL: 30_threads/future/members/poll.cc  -std=gnu++17 execution test

I see this one failing under x86_64-linux under high load. So I think
we might simply want a better test.


>
> /vol/gcc/src/hg/master/local/libstdc++-v3/testsuite/30_threads/future/members/poll.cc:95:
>  int main(): Assertion 'wait_until_sys_min < (ready * 100)' failed.
> wait_for(0s): 11892ns for 200 calls, avg 59.46ns per call
> wait_until(system_clock minimum): 1304458ns for 200 calls, avg 6522.29ns per 
> call
> wait_until(steady_clock minimum): 1403221ns for 200 calls, avg 7016.1ns per 
> call
> wait_until(system_clock epoch): 3343806ns for 200 calls, avg 16719ns per call
> wait_until(steady_clock epoch: 2959581ns for 200 calls, avg 14797.9ns per call
> wait_for when ready: 10969ns for 200 calls, avg 54.845ns per call
>
> As reported in the PR, across a considerable range of CPUs the test
> doesn't complete in the expected time.  Therefore, this patch introduces
> a Solaris/x86 specific scale factor to allow for that.
>
> There's no such issue on Solaris/SPARC, though.
>
> Tested on i386-pc-solaris2.11 and sparc-sun-solaris2.11.
>
> Ok for trunk?
>
> Rainer
>
> --
> -
> Rainer Orth, Center for Biotechnology, Bielefeld University
>
>
> 2024-06-04  Rainer Orth  
>
> libstdc++-v3:
> PR libstdc++/98678
> * testsuite/30_threads/future/members/poll.cc (main): Introduce
> scale factor.
>



[PATCH] libstdc++: Introduce scale factor in 30_threads/future/members/poll.cc [PR98678]

2024-06-10 Thread Rainer Orth
30_threads/future/members/poll.cc consistently FAILs on Solaris/x86
(both 32 and 64-bit):

FAIL: 30_threads/future/members/poll.cc  -std=gnu++17 execution test

/vol/gcc/src/hg/master/local/libstdc++-v3/testsuite/30_threads/future/members/poll.cc:95:
 int main(): Assertion 'wait_until_sys_min < (ready * 100)' failed.
wait_for(0s): 11892ns for 200 calls, avg 59.46ns per call
wait_until(system_clock minimum): 1304458ns for 200 calls, avg 6522.29ns per 
call
wait_until(steady_clock minimum): 1403221ns for 200 calls, avg 7016.1ns per call
wait_until(system_clock epoch): 3343806ns for 200 calls, avg 16719ns per call
wait_until(steady_clock epoch: 2959581ns for 200 calls, avg 14797.9ns per call
wait_for when ready: 10969ns for 200 calls, avg 54.845ns per call

As reported in the PR, across a considerable range of CPUs the test
doesn't complete in the expected time.  Therefore, this patch introduces
a Solaris/x86 specific scale factor to allow for that.

There's no such issue on Solaris/SPARC, though.

Tested on i386-pc-solaris2.11 and sparc-sun-solaris2.11.

Ok for trunk?

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


2024-06-04  Rainer Orth  

libstdc++-v3:
PR libstdc++/98678
* testsuite/30_threads/future/members/poll.cc (main): Introduce
scale factor.

# HG changeset patch
# Parent  8f086e53ab093c8919708b1689a86f2bc407
libstdc++: Introduce scale factor in 30_threads/future/members/poll.cc [PR98678]

diff --git a/libstdc++-v3/testsuite/30_threads/future/members/poll.cc b/libstdc++-v3/testsuite/30_threads/future/members/poll.cc
--- a/libstdc++-v3/testsuite/30_threads/future/members/poll.cc
+++ b/libstdc++-v3/testsuite/30_threads/future/members/poll.cc
@@ -129,14 +129,21 @@ int main()
   VERIFY( wait_for_0 < (ready * 30) );
 
   // Polling before ready using wait_until(min) should not be terribly slow.
-  VERIFY( wait_until_sys_min < (ready * 100) );
-  VERIFY( wait_until_steady_min < (ready * 100) );
+  // These tests consistently time out on a couple of targets, so provide
+  // scale factor.
+#if defined(__sun) && defined(__svr4__) && (defined(__i386__) || defined(__x86_64__))
+  double scale = 2.5;
+#else
+  double scale = 1.0;
+#endif
+  VERIFY( wait_until_sys_min < (ready * 100 * scale) );
+  VERIFY( wait_until_steady_min < (ready * 100 * scale) );
 
   // The following two tests fail with GCC 11, see
   // https://gcc.gnu.org/pipermail/libstdc++/2020-November/051422.html
 #if 0
   // Polling before ready using wait_until(epoch) should not be terribly slow.
-  VERIFY( wait_until_sys_epoch < (ready * 100) );
-  VERIFY( wait_until_steady_epoch < (ready * 100) );
+  VERIFY( wait_until_sys_epoch < (ready * 100 * scale) );
+  VERIFY( wait_until_steady_epoch < (ready * 100 * scale) );
 #endif
 }