Evaluate 'random ()' to '0' in 'pass_omp_oacc_neuter_broadcast'

Julian Brown,
<http://mid.mail-archive.com/20210920134603.16459021@squid.athome>:

| [...] the randomness shouldn't be necessary for the
| correctness of the patch (i.e. it could just be "base = bounds_lo", or
| indeed folded into the line after).
|
| The "ar.invalid ()" case happens when we fail to allocate a block of
| memory in LDS space for broadcasting a particular set of variables,
| and trigger a fall-back path in the broadcasting code that adds extra
| barriers around the broadcast in question. I imagine I was thinking
| that adding randomness could mean we can "get lucky" sometimes and
| avoid needing those barriers in some cases, but in fact I don't think
| that was implemented, so the randomness is useless. (Or it could just
| have been leftover debug code... oops).

	gcc/
	PR other/102408
	* omp-oacc-neuter-broadcast.cc (oacc_do_neutering): Evaluate
	'random ()' to '0'.
This commit is contained in:
Thomas Schwinge 2021-09-21 08:54:49 +02:00
parent 4e7a92c0ff
commit e87789f197
1 changed files with 2 additions and 3 deletions

View File

@ -1782,9 +1782,8 @@ oacc_do_neutering (unsigned HOST_WIDE_INT bounds_lo,
if (ar.invalid ())
{
unsigned HOST_WIDE_INT base;
base = bounds_lo + random () % 512;
base = (base + align - 1) & ~(align - 1);
unsigned HOST_WIDE_INT base
= (bounds_lo + align - 1) & ~(align - 1);
if (base + size > bounds_hi)
error_at (UNKNOWN_LOCATION, "shared-memory region overflow");
std::pair<unsigned HOST_WIDE_INT, bool> base_inrng