From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from cc-smtpout3.netcologne.de (cc-smtpout3.netcologne.de [IPv6:2001:4dd0:100:1062:25:2:0:3]) by sourceware.org (Postfix) with ESMTPS id E1CB63857801; Sat, 26 Dec 2020 10:41:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org E1CB63857801 Received: from cc-smtpin2.netcologne.de (cc-smtpin2.netcologne.de [89.1.8.202]) by cc-smtpout3.netcologne.de (Postfix) with ESMTP id 8EB2B1288A; Sat, 26 Dec 2020 11:41:37 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by cc-smtpin2.netcologne.de (Postfix) with ESMTP id 8B49111E4B; Sat, 26 Dec 2020 11:41:37 +0100 (CET) Received: from [2001:4dd7:c9b8:0:b87a:57e9:5345:9efe] (helo=cc-smtpin2.netcologne.de) by localhost with ESMTP (eXpurgate 4.11.6) (envelope-from ) id 5fe71361-024d-7f0000012729-7f000001d396-1 for ; Sat, 26 Dec 2020 11:41:37 +0100 Received: from linux-p51k.fritz.box (2001-4dd7-c9b8-0-b87a-57e9-5345-9efe.ipv6dyn.netcologne.de [IPv6:2001:4dd7:c9b8:0:b87a:57e9:5345:9efe]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by cc-smtpin2.netcologne.de (Postfix) with ESMTPSA; Sat, 26 Dec 2020 11:41:32 +0100 (CET) Subject: Re: [OG10] Fortran: delinearize multi-dimensional array accesses To: Sandra Loosemore , "gcc-patches@gcc.gnu.org" , "fortran@gcc.gnu.org" , Tobias Burnus References: From: Thomas Koenig Message-ID: <5d972896-d5ef-df64-a663-a3a339b99e70@netcologne.de> Date: Sat, 26 Dec 2020 11:41:32 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: de-DE Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Dec 2020 10:41:42 -0000 Hi Sandra, > The attached patch implements delinearization of array accesses in the > Fortran front end, something that has been discussed for a long time. Definitely - among others, this is the subject of PR 14741, which is by now quite historic. > I've been asked to try to get this patch committed on the OG10 branch > since it is blocking some further optimization work with Graphite for > OpenACC kernels regions.  I have a mainline version of this patch as > well that I can send to anyone interested in trying it out, but TBH, I > don't think this is ready for mainline yet. That would be indeed interesting. Could you post that to the list as well? The current status is that > there are still two gfortran tests that are regressing > (gfortran.dg/graphite/id-9.f and > gfortran.dg/vect/fast-math-mgrid-resid.f), and while it's been confirmed > that this helps with Graphite optimizations as intended, we haven't yet > run any benchmarks to confirm that it doesn't make other things slower. It is probably too late; this could go in for the next stage 1. > (It might, for instance, be appropriate to only delinearize when > Graphite optimizations are also enabled.) Makes sense. Does the patch actually make loop interchange for matrix multiplication work (done with C for loops or Fortran DO loops), or is there additional work required? Regarding scalarized loops: We still to not collapse loops for subroutine foo(a) real, dimension(:,:), contiguous :: a a = 5. end subroutine foo so an extension to scalarized loops would be quite valuable. It would be interesting to see if subroutine foo(a,n,m) real, dimension(n,m) :: a do j=1,m do i=1,n a(i,j) = 5. end do end do end subroutine foo is collapsed to a single loop with the patch and Graphite. Best regards Thomas