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

            Bug ID: 109062
           Summary: [13 regression] Default value of GOMP_SPINCOUNT
                    changes since r13-2545
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libgomp
          Assignee: unassigned at gcc dot gnu.org
          Reporter: wwwhhhyyy333 at gmail dot com
                CC: jakub at gcc dot gnu.org
  Target Milestone: ---

Recently we found several big regressions on Phoronix OpenMP benchmark on
GCC13. The regressions is caused by r13-2545-g9f2fca56593a2b

The issue is, the default value of GOMP_SPINCOUNT is now 0, instead of 300000
before this patch, which caused all Openmp program behaves like
OMP_WAIT_POLICY=passive.

As the comments in libgomp/env.c says:

 /* Using a rough estimation of 100000 spins per msec,
    use 5 min blocking for OMP_WAIT_POLICY=active,
    3 msec blocking when OMP_WAIT_POLICY is not specificed
    and 0 when OMP_WAIT_POLICY=passive.
    Depending on the CPU speed, this can be e.g. 5 times longer
    or 5 times shorter.  */

The current code for wait_policy is

if (none != NULL && gomp_get_icv_flag (none->flags, GOMP_ICV_WAIT_POLICY))
  wait_policy = none->icvs.wait_policy;
else if (all != NULL && gomp_get_icv_flag (all->flags, GOMP_ICV_WAIT_POLICY))
  wait_policy = all->icvs.wait_policy;

If OMP_WAIT_POLICY not specified, non of the branch will be entered since
gomp_get_icv_flag will return 0 by default, then wait_policy remains its value
as uninitialized. While prior to this patch wait_policy will be set to -1 (not
specified) by parse_wait_policy ().

Reply via email to