That sounds about right.  The code I had in mind would perhaps look like:


#if defined(__AVX512BW__) && defined(__AVX512VL__)
    #if defined(__EVEX256__) && !defined(__EVEX512__)
        // compiled code is AVX10.1/256 and AVX512 compatible
    #else
        // compiled code is only AVX512 compatible
    #endif

    // some code which only uses 256b instructions
    __m256i...
#endif


The '__EVEX256__' define would avoid needing to check compiler versions.
Hopefully you can align it with whatever Clang does: https://discourse.llvm.org/t/rfc-design-for-avx10-feature-support/72661/18

Thanks!

On 28/09/2023 12:26 pm, Hu, Lin1 wrote:
Hi,

Thanks for you reply.

I'd like to verify that our understanding of your requirements is correct, and 
that __EVEX256__ can be considered a default macro to determine whether the 
compiler supports the __EVEX***__ series of switches.

For example:

I have a segment of code like:
#if defined(__EVEX512__):
__mm512.*__;
#else
__mm256.*__;
#endif

But __EVEX512__ is undefined that doesn't mean I only need 256bit, maybe I use 
gcc-13, so I can still use 512bit.

So the code should be:
#if defined(__EVEX512__):
__mm512.*__;
#elif defined(__EVEX256__):
__mm256.*__;
#else
__mm512.*__;
#endif

If we understand correctly, we'll consider the request. But since we're about 
to have a vacation, follow-up replies may be a bit slower.

BRs,
Lin

-----Original Message-----
From: ZiNgA BuRgA <zingabu...@hotmail.com>
Sent: Thursday, September 28, 2023 8:32 AM
To: Hu, Lin1 <lin1...@intel.com>; gcc-patches@gcc.gnu.org
Subject: Re: [PATCH 00/18] Support -mevex512 for AVX512

Thanks for the new patch!

I see that there's a new __EVEX512__ define.  Will there be some __EVEX256__ 
(or maybe some max EVEX width) define, so that code can detect whether the 
compiler supports AVX10.1/256 without resorting to version checks?



Reply via email to