From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.107.12.94 with SMTP id w91mr13998200ioi.85.1518982692147; Sun, 18 Feb 2018 11:38:12 -0800 (PST) X-Received: by 10.157.94.15 with SMTP id d15mr629284oti.4.1518982692026; Sun, 18 Feb 2018 11:38:12 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!border1.nntp.ams1.giganews.com!nntp.giganews.com!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.am4!peer.am4.highwinds-media.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!o66no1200409ita.0!news-out.google.com!t6ni1412itg.0!nntp.google.com!w142no1201809ita.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sun, 18 Feb 2018 11:38:11 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=87.116.179.50; posting-account=z-xFXQkAAABpEOAnT3LViyFXc8dmoW_p NNTP-Posting-Host: 87.116.179.50 References: <83493d20-7001-405b-8658-8a3f5d6c90fa@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: GNAT can't vectorize Real_Matrix multiplication from Ada.Numerics.Real_Arrays. What a surprise! From: Bojan Bozovic Injection-Date: Sun, 18 Feb 2018 19:38:12 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Received-Bytes: 2972 X-Received-Body-CRC: 497060652 Xref: reader02.eternal-september.org comp.lang.ada:50503 Date: 2018-02-18T11:38:11-08:00 List-Id: On Sunday, February 18, 2018 at 2:31:18 PM UTC+1, Jeffrey R. Carter wrote: > On 02/18/2018 01:05 PM, Bojan Bozovic wrote: > > Thanks very much for clarification! It's always good to learn something= new, I suppose. >=20 > The real optimization in your example seems to be that the compiler optim= izes=20 > away the 10E6 loop around the in-line code, but not around the call to "*= ".=20 > Removing both loops gives similar times for both multiplications. The cal= l to=20 > "*" will never be as fast because it copies its result into your variable= .=20 > Replacing Ada.Numerics.Real_Arrays with an instantiation of=20 > Ada.Numerics.Generic_Real_Arrays gives an additional factor of 2 reductio= n. >=20 > --=20 > Jeff Carter > Just as Khan was hindered by two-dimensional thinking in a > three-dimensional situation, so many developers are hindered > by sequential thinking in concurrent situations. > 118 And indeed, now everything is in its place, as I don't see matrix multiplic= ation several times slower than doing things 'by hand'. I have used aggress= ive optimization because in this day its custom a program to manipulate ove= r gigabytes or even terabytes of data, while being at most megabytes in siz= e - so compiling for various processors of the same family and using launch= er program which will query processor capability and run optimally optimize= d program is nothing new - one might say most computation now is done on GP= U but then also exact capabilities of GPU must be known. Thanks for making = my Ada learning experience an enjoyment!