From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 123221 invoked by alias); 22 May 2019 09:27:29 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 123212 invoked by uid 89); 22 May 2019 09:27:29 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.1 spammy=H*i:sk:CAFiYyc X-HELO: srv-07.MPA-Garching.MPG.DE Received: from srv-07.MPA-Garching.MPG.DE (HELO srv-07.MPA-Garching.MPG.DE) (130.183.82.26) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 22 May 2019 09:27:28 +0000 Received: from [130.183.88.42] ([130.183.88.42]) (authenticated bits=0) by srv-07.MPA-Garching.MPG.DE (8.15.2/8.15.2) with ESMTPSA id x4M9RPpC012119 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 22 May 2019 11:27:25 +0200 Subject: Re: Determining maximum vector length supported by the CPU? To: Richard Biener Cc: GCC Development , m.kretz@gsi.de References: From: Martin Reinecke Openpgp: preference=signencrypt Message-ID: <719f4268-b2a8-e950-8005-7af26e8a1ef3@mpa-garching.mpg.de> Date: Wed, 22 May 2019 09:27:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-SW-Source: 2019-05/txt/msg00176.txt.bz2 On 5/22/19 11:17 AM, Richard Biener wrote: >> Almost ... except that I'd need a platform-agnostic definition. The >> point is that the code does not care about the underlying hardware at >> all, only for the vector length supported by it. > > And then you run into AVX + SSE vs. AVX2 + SSE cases where the (optimal) length > depends on the component type... You mean different vector lengths for float, double, int etc? I would be fine to have different macros for those, if necessary. > I wonder if we'd want to have a 'auto' length instead ;) I know it's weird, but for my code (which is definitely not a synthetic test case) that would work perfectly :) If you'd like to have a look: https://gitlab.mpcdf.mpg.de/mtr/pocketfft/tree/cpp (the only platform-dependent part is on lines 82-95 of the header file). Still, I would need a way to determine how long the vectors actually are. But it would probably be enough to measure this at runtime then. Cheers, Martin