Re: memcpy test: results from adding sse and avx tests

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 6 March 2018 at 17:02, Jens Axboe <axboe@xxxxxxxxx> wrote:
> On 3/6/18 9:45 AM, Jens Axboe wrote:
>> On 3/6/18 9:43 AM, Sitsofe Wheeler wrote:
>>> On 6 March 2018 at 16:22, Jens Axboe <axboe@xxxxxxxxx> wrote:
>>>>
>>>> +##########################################
>>>> +# sse probe
>>>> +sse="no"
>>>> +cat > $TMPC << EOF
>>>> +#include <xmmintrin.h>
>>>> +#include <immintrin.h>
>>>> +int main(int argc, char **argv)
>>>> +{
>>>> +  __m128 val;
>>>> +  float const *src = NULL;
>>>> +  float *dst = NULL;
>>>> +  val = _mm_load_ps(src);
>>>> +  _mm_store_ps(dst, val);
>>>> +  return 0;
>>>> +}
>>>> +EOF
>>>> +if compile_prog "-msse" "" "sse"; then
>>>> +  sse="yes"
>>>> +fi
>>>> +print_config "SSE (compiler)" "$sse"
>>>
>>> According to https://stackoverflow.com/questions/28939652/how-to-detect-sse-sse2-avx-avx2-avx-512-avx-128-fma-kcvi-availability-at-compile/28939692#28939692
>>> in gcc and clang you can just check for the appropriate define (e.g.
>>> __SSE2__ ) if you're only interested in what's available at compile
>>> time...
>>
>> I never really trust that, since there are always cases where that
>> isn't true. A configure test with the meat of the code and types
>> is always going to be 100% reliable.

That does have the ring of truth about it...

> BTW, another (and probably more problematic) issue is that the
> compiler may well have support for sse/avx/avx512, while the
> machine it's run on does not. If we enable the instruction set
> based on that, we could be seeing illegal instructions outside
> just the memcpy test. And that would be a concern, since it would
> prevent fio from running at all.
>
> I think we have to make it something like the below because of that.

If someone forces SSE on then by all means we should add it to the
CFLAGS but if they haven't and we can compile a program which uses
headers/instructions that are only available when SSE is enabled then
can't we deduce that the user is happy for those instructions to be in
their code?

[...]
> +##########################################
> +# sse probe
> +sse="no"
> +cat > $TMPC << EOF
> +#include <xmmintrin.h>
> +#include <immintrin.h>
> +int main(int argc, char **argv)
> +{
> +  __m128 val;
> +  float const *src = NULL;
> +  float *dst = NULL;
> +  val = _mm_load_ps(src);
> +  _mm_store_ps(dst, val);
> +  return 0;
> +}

We could try and use __builtin_ia32_addps (from
https://gcc.gnu.org/onlinedocs/gcc/x86-Built-in-Functions.html#x86-Built-in-Functions
).

> +EOF
> +if test "$enable_sse" = "yes" && compile_prog "-msse" "" "sse"; then
> +  sse="yes"
> +fi
> +print_config "SSE (compiler)" "$sse"

Here we wouldn't explicitly add -msse because we would have already
added it to the global CFLAGS if forced or depended on the user's
particular compiler flags if not.

-- 
Sitsofe | http://sucs.org/~sits/
--
To unsubscribe from this list: send the line "unsubscribe fio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel]     [Linux SCSI]     [Linux IDE]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux