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 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Re: GNAT can't vectorize Real_Matrix multiplication from Ada.Numerics.Real_Arrays. What a surprise! Date: Sun, 18 Feb 2018 14:31:15 +0100 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: <83493d20-7001-405b-8658-8a3f5d6c90fa@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sun, 18 Feb 2018 13:31:16 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="4b329d704f93c250b49b362779412e4e"; logging-data="332"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+EG+B5Ulvs7wjLUfnkuvJxH5xr/PRcv+0=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 In-Reply-To: <83493d20-7001-405b-8658-8a3f5d6c90fa@googlegroups.com> Content-Language: en-US Cancel-Lock: sha1:JQqJuF/oPj9sec/cAHyHKRR6t5U= Xref: reader02.eternal-september.org comp.lang.ada:50501 Date: 2018-02-18T14:31:15+01:00 List-Id: 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. The real optimization in your example seems to be that the compiler optimizes away the 10E6 loop around the in-line code, but not around the call to "*". Removing both loops gives similar times for both multiplications. The call to "*" will never be as fast because it copies its result into your variable. Replacing Ada.Numerics.Real_Arrays with an instantiation of Ada.Numerics.Generic_Real_Arrays gives an additional factor of 2 reduction. -- 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