[Mesa-dev] meson: swr: compiler argument detection not working
Dylan Baker
dylan at pnwbakers.com
Mon Sep 24 18:44:07 UTC 2018
Quoting Chuck Atkins (2018-09-24 10:34:22)
> Hi Dylan (and others?)
>
> SWR has some checks to try to determine which compiler option is needed to
> enable a given instruction set. The way this is implemented in Meson seems to
> be incorrect currently. For example, the attempt to detect the correct
> compiler option to enable the AVX512 KNL instruction support:
>
> swr_knl_args = cpp.first_supported_argument(
> '-target-cpu=mic-knl', '-march=knl', '-xMIC-AVX512',
> prefix : '''
> #if !defined(__AVX512F__) || !defined(__AVX512ER__)
> # error
> #endif ''',
> )
>
> I see a slew of warnings when I enable swr for "prefix" being an unsupported
> option to first_supported_argument. Looking in the implementation, it seems
> that no keyword arguments are actually considered at all. This ends up working
> as-is for gcc since it errors out for arguments that are not supported. Other
> compilers (intel icc, for instance) just display a warning for unsupported
> arguments and ignore them. Which ends up with the first option always
> returning as the valid one, even though it's not.
This is a meson bug, I'll look into that.
> So is there a way to pass code to compile to determine which argument is valid
> or correct or do I need to create a custom function for this?
>
> - Chuck
I was just looking at this Friday. I don't think there's a builtin, I think that
we'll have to do something like:
swr_skx_args = []
foreach a : ['-target-cpu=mic-knl', '-march=knl', '-xMIC-AVX512'],
if ssw_skx_args == []
if cpp.compiles('''
#if !defined(__AVX512F__) || !defined(__AVX512ER__)
# error
#endif ''',
args : a,
name : 'SKX with flag @0@'.format(a))
_found = true
sw_skx_args = a
endif
endif
endforeach
Dylan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: signature
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180924/7667ea62/attachment.sig>
More information about the mesa-dev
mailing list