From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 122645 invoked by alias); 4 Dec 2018 13:55:10 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 120678 invoked by uid 89); 4 Dec 2018 13:55:08 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,KAM_SHORT,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 04 Dec 2018 13:55:06 +0000 Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id EF1B1AC66; Tue, 4 Dec 2018 13:55:03 +0000 (UTC) Date: Tue, 04 Dec 2018 13:55:00 -0000 From: Richard Biener To: Jakub Jelinek cc: Julian Brown , Cesar Philippidis , "gcc-patches@gcc.gnu.org" , Chung-Lin Tang Subject: Re: [patch,openacc] Propagate independent clause for OpenACC kernels pass In-Reply-To: <20181204134526.GR12380@tucnak> Message-ID: References: <20181203234039.12f8b8fa@squid.athome> <20181204134526.GR12380@tucnak> User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-SW-Source: 2018-12/txt/msg00185.txt.bz2 On Tue, 4 Dec 2018, Jakub Jelinek wrote: > On Mon, Dec 03, 2018 at 11:40:39PM +0000, Julian Brown wrote: > > Jakub asked in the following email at the time of the patch submission > > for the gomp4 branch what the difference was between the new > > marked_independent flag and safelen == INT_MAX: > > > > https://gcc.gnu.org/ml/gcc-patches/2015-07/msg01100.html > > > > If I understand the followup correctly, > > > > https://gcc.gnu.org/ml/gcc-patches/2015-07/msg01117.html > > > > a setting of safelen > 1 means that up to that number of loop > > iterations can run together in lockstep (as if each insn in the loop > > was blindly rewritten to a safelen-width SIMD equivalent) -- but > > anything that happens in iteration N + 1 cannot happen before something > > that happens in iteration N. Chung-Lin pointed out that OpenACC's > > semantics are even less strict (allowing iterations to proceed fully > > independently in an arbitrary order), so the marked_independent flag > > does carry non-redundant information -- even with safelen set to > > INT_MAX. > > OpenMP 5 (not implemented in GCC 9 though) has order(concurrent) clause > for this (no cross-iteration dependencies at all, iterations can be run in > any order, in parallel etc.). > > I believe it matches the can_be_parallel flag we now have, but I remember > there were some issues with that flag for use in DO CONCURRENT. > > Or do we want to have some other flag for really independent iterations? > What passes could use that? Would the vectorizer appreciate the stronger > assertion in some cases? The vectorizer doesn't really care. It would be autopar that should. The issue with using can_be_parallel for DO CONCURRENT was that the middle-end introduces non-trivial sharing between iterations, introducing dependences that then make the loop no longer can_be_parallel. I believe similar things could happen with ->safelen (consider loop reversal and existing forward dependences). I guess we're simply lucky in that area ;) Richard.