From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1643) id 5D5113858C3A; Tue, 21 Sep 2021 10:39:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5D5113858C3A MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Thomas Schwinge To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-3726] Evaluate 'random ()' to '0' in 'pass_omp_oacc_neuter_broadcast' X-Act-Checkin: gcc X-Git-Author: Thomas Schwinge X-Git-Refname: refs/heads/master X-Git-Oldrev: 4e7a92c0ff3871d955ca8fb133f869b216d7224d X-Git-Newrev: e87789f197e47259c94349821d3446f7d959e08f Message-Id: <20210921103957.5D5113858C3A@sourceware.org> Date: Tue, 21 Sep 2021 10:39:57 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 10:39:57 -0000 https://gcc.gnu.org/g:e87789f197e47259c94349821d3446f7d959e08f commit r12-3726-ge87789f197e47259c94349821d3446f7d959e08f Author: Thomas Schwinge Date: Tue Sep 21 08:54:49 2021 +0200 Evaluate 'random ()' to '0' in 'pass_omp_oacc_neuter_broadcast' Julian Brown, : | [...] 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'. Diff: --- gcc/omp-oacc-neuter-broadcast.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gcc/omp-oacc-neuter-broadcast.cc b/gcc/omp-oacc-neuter-broadcast.cc index aa5990ed7a1..e43338f3abf 100644 --- a/gcc/omp-oacc-neuter-broadcast.cc +++ b/gcc/omp-oacc-neuter-broadcast.cc @@ -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 base_inrng