Message ID | cdd34d5d-7b96-e056-0a11-a48477bddf66@suse.cz |
---|---|
State | New |
Headers | show |
Series | [v2] Add error message for target_clones and AVX512 ISAs (PR target/89929). | expand |
On Thu, Apr 18, 2019 at 4:07 AM Martin Liška <mliska@suse.cz> wrote: > > Hi. > > I'm sending updated version of that patch. The patch rejects usage of AVX512 ISAs (except AVX512F) > for target attribute for C++ multiversioning and for target_clone attribute. > > Patch can bootstrap on x86_64-linux-gnu and survives regression tests. > > Ready to be installed? > Thanks, > Martin Your patch doesn't handle cmov nor gfni properly, which aren't AVX512. I prefer this patch.
On 4/18/19 7:44 PM, H.J. Lu wrote: > On Thu, Apr 18, 2019 at 4:07 AM Martin Liška <mliska@suse.cz> wrote: >> >> Hi. >> >> I'm sending updated version of that patch. The patch rejects usage of AVX512 ISAs (except AVX512F) >> for target attribute for C++ multiversioning and for target_clone attribute. >> >> Patch can bootstrap on x86_64-linux-gnu and survives regression tests. >> >> Ready to be installed? >> Thanks, >> Martin > > Your patch doesn't handle cmov nor gfni properly, which aren't AVX512. > I prefer this patch. > I like the patch. Thanks for working on that. Martin
On 4/23/19 10:29 AM, Martin Liška wrote: > On 4/18/19 7:44 PM, H.J. Lu wrote: >> On Thu, Apr 18, 2019 at 4:07 AM Martin Liška <mliska@suse.cz> wrote: >>> >>> Hi. >>> >>> I'm sending updated version of that patch. The patch rejects usage of AVX512 ISAs (except AVX512F) >>> for target attribute for C++ multiversioning and for target_clone attribute. >>> >>> Patch can bootstrap on x86_64-linux-gnu and survives regression tests. >>> >>> Ready to be installed? >>> Thanks, >>> Martin >> >> Your patch doesn't handle cmov nor gfni properly, which aren't AVX512. >> I prefer this patch. >> > > I like the patch. Thanks for working on that. > > Martin > > Btw. can we get that patch into GCC 9.1? Adding port maintainers to CC. Martin
On Thu, Apr 25, 2019 at 9:51 AM Martin Liška <mliska@suse.cz> wrote: > On 4/23/19 10:29 AM, Martin Liška wrote: > > On 4/18/19 7:44 PM, H.J. Lu wrote: > >> On Thu, Apr 18, 2019 at 4:07 AM Martin Liška <mliska@suse.cz> wrote: > >>> > >>> Hi. > >>> > >>> I'm sending updated version of that patch. The patch rejects usage of > AVX512 ISAs (except AVX512F) > >>> for target attribute for C++ multiversioning and for target_clone > attribute. > >>> > >>> Patch can bootstrap on x86_64-linux-gnu and survives regression tests. > >>> > >>> Ready to be installed? > >>> Thanks, > >>> Martin > >> > >> Your patch doesn't handle cmov nor gfni properly, which aren't AVX512. > >> I prefer this patch. > >> > > > > I like the patch. Thanks for working on that. > > > > Martin > > > > > > Btw. can we get that patch into GCC 9.1? > > Adding port maintainers to CC. > HJ knows ISA interdependencies, and the benefit of the patch outweights the (small) risk, so from the maintaner PoV, OK for the mainline unless RM vetoes the decision soon. HJ, please double check the patch for eventual inconsistencies or possible regressions before committing. Thanks, Uros.
On Thu, Apr 25, 2019 at 1:03 AM Uros Bizjak <ubizjak@gmail.com> wrote: > > > > On Thu, Apr 25, 2019 at 9:51 AM Martin Liška <mliska@suse.cz> wrote: >> >> On 4/23/19 10:29 AM, Martin Liška wrote: >> > On 4/18/19 7:44 PM, H.J. Lu wrote: >> >> On Thu, Apr 18, 2019 at 4:07 AM Martin Liška <mliska@suse.cz> wrote: >> >>> >> >>> Hi. >> >>> >> >>> I'm sending updated version of that patch. The patch rejects usage of AVX512 ISAs (except AVX512F) >> >>> for target attribute for C++ multiversioning and for target_clone attribute. >> >>> >> >>> Patch can bootstrap on x86_64-linux-gnu and survives regression tests. >> >>> >> >>> Ready to be installed? >> >>> Thanks, >> >>> Martin >> >> >> >> Your patch doesn't handle cmov nor gfni properly, which aren't AVX512. >> >> I prefer this patch. >> >> >> > >> > I like the patch. Thanks for working on that. >> > >> > Martin >> > >> > >> >> Btw. can we get that patch into GCC 9.1? >> >> Adding port maintainers to CC. > > > HJ knows ISA interdependencies, and the benefit of the patch outweights the (small) risk, so from the maintaner PoV, OK for the mainline unless RM vetoes the decision soon. HJ, please double check the patch for eventual inconsistencies or possible regressions before committing. > > Thanks, > Uros. Tested on x86-64. I am checking in this updated patch with: diff --git a/gcc/testsuite/g++.target/i386/pr57362.C b/gcc/testsuite/g++.target/ i386/pr57362.C index 5e612130357..ced5e518cfe 100644 --- a/gcc/testsuite/g++.target/i386/pr57362.C +++ b/gcc/testsuite/g++.target/i386/pr57362.C @@ -199,4 +199,4 @@ int foo(void) { return 1; } /* { dg-prune-output "attribute.* is unknown" } */ /* { dg-prune-output "missing 'target' attribute*" } */ /* { dg-prune-output "redefinition of 'int foo" } */ -/* { dg-prune-output "no dispatcher found for" } */ +/* { dg-prune-output "ISA '.*' is not supported in 'target' attribute" } */
From 6a7119cbdb908a2a7bd8017c64e084b5f20b3052 Mon Sep 17 00:00:00 2001 From: marxin <mliska@suse.cz> Date: Wed, 17 Apr 2019 14:01:21 +0200 Subject: [PATCH] Add error message for target_clones and AVX512 ISAs (PR target/89929). gcc/ChangeLog: 2019-04-18 Martin Liska <mliska@suse.cz> PR target/89929 * config/i386/i386.c (get_builtin_code_for_version): Provide new error for AVX512 ISAs. gcc/testsuite/ChangeLog: 2019-04-18 Martin Liska <mliska@suse.cz> PR target/89929 * g++.target/i386/mv28.C: New test. * gcc.target/i386/mvc14.c: New test. --- gcc/config/i386/i386.c | 27 +++++++++++++++++++++++++++ gcc/testsuite/g++.target/i386/mv28.C | 26 ++++++++++++++++++++++++++ gcc/testsuite/gcc.target/i386/mvc14.c | 16 ++++++++++++++++ 3 files changed, 69 insertions(+) create mode 100644 gcc/testsuite/g++.target/i386/mv28.C create mode 100644 gcc/testsuite/gcc.target/i386/mvc14.c diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 498a35d8aea..ed9a9c2e3f7 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -31920,6 +31920,24 @@ get_builtin_code_for_version (tree decl, tree *predicate_list) {"avx512f", P_AVX512F} }; + static const char * avx512_warning_isas[] = { + "avx5124fmaps", + "avx5124vnniw", + "avx512vpopcntdq", + "avx512vbmi2", + "avx512vnni", + "avx512bitalg", + "avx512vbmi", + "avx512ifma", + "avx512vl", + "avx512bw", + "avx512dq", + "avx512er", + "avx512pf", + "avx512cd", + "gfni", + "vpclmulqdq", + }; static unsigned int NUM_FEATURES = sizeof (feature_list) / sizeof (struct _feature_list); @@ -32140,6 +32158,15 @@ get_builtin_code_for_version (tree decl, tree *predicate_list) } if (predicate_list && i == NUM_FEATURES) { + for (unsigned i = 0; i < ARRAY_SIZE (avx512_warning_isas); i++) + if (strcmp (token, avx512_warning_isas[i]) == 0) + { + error_at (DECL_SOURCE_LOCATION (decl), + "AVX512 ISA %qs is not supported in " + "%<target%> attribute, use %<arch=%> syntax", token); + return 0; + } + error_at (DECL_SOURCE_LOCATION (decl), "no dispatcher found for %s", token); return 0; diff --git a/gcc/testsuite/g++.target/i386/mv28.C b/gcc/testsuite/g++.target/i386/mv28.C new file mode 100644 index 00000000000..a33efd9cf21 --- /dev/null +++ b/gcc/testsuite/g++.target/i386/mv28.C @@ -0,0 +1,26 @@ +/* { dg-do compile} */ +/* { dg-require-ifunc "" } */ + +void __attribute__ ((target("avx512vl"))) foo () {} /* { dg-error "AVX512 ISA '\[^\n\r\]*' is not supported in 'target' attribute, use 'arch=' syntax" } */ +void __attribute__ ((target("avx512bw"))) foo () {} /* { dg-error "AVX512 ISA '\[^\n\r\]*' is not supported in 'target' attribute, use 'arch=' syntax" } */ +void __attribute__ ((target("avx512dq"))) foo () {} /* { dg-error "AVX512 ISA '\[^\n\r\]*' is not supported in 'target' attribute, use 'arch=' syntax" } */ +void __attribute__ ((target("avx512cd"))) foo () {} /* { dg-error "AVX512 ISA '\[^\n\r\]*' is not supported in 'target' attribute, use 'arch=' syntax" } */ +void __attribute__ ((target("avx512er"))) foo () {} /* { dg-error "AVX512 ISA '\[^\n\r\]*' is not supported in 'target' attribute, use 'arch=' syntax" } */ +void __attribute__ ((target("avx512pf"))) foo () {} /* { dg-error "AVX512 ISA '\[^\n\r\]*' is not supported in 'target' attribute, use 'arch=' syntax" } */ +void __attribute__ ((target("avx512vbmi"))) foo () {} /* { dg-error "AVX512 ISA '\[^\n\r\]*' is not supported in 'target' attribute, use 'arch=' syntax" } */ +void __attribute__ ((target("avx512ifma"))) foo () {} /* { dg-error "AVX512 ISA '\[^\n\r\]*' is not supported in 'target' attribute, use 'arch=' syntax" } */ +void __attribute__ ((target("avx5124vnniw"))) foo () {} /* { dg-error "AVX512 ISA '\[^\n\r\]*' is not supported in 'target' attribute, use 'arch=' syntax" } */ +void __attribute__ ((target("avx5124fmaps"))) foo () {} /* { dg-error "AVX512 ISA '\[^\n\r\]*' is not supported in 'target' attribute, use 'arch=' syntax" } */ +void __attribute__ ((target("avx512vpopcntdq"))) foo () {} /* { dg-error "AVX512 ISA '\[^\n\r\]*' is not supported in 'target' attribute, use 'arch=' syntax" } */ +void __attribute__ ((target("avx512vbmi2"))) foo () {} /* { dg-error "AVX512 ISA '\[^\n\r\]*' is not supported in 'target' attribute, use 'arch=' syntax" } */ +void __attribute__ ((target("gfni"))) foo () {} /* { dg-error "AVX512 ISA '\[^\n\r\]*' is not supported in 'target' attribute, use 'arch=' syntax" } */ +void __attribute__ ((target("vpclmulqdq"))) foo () {} /* { dg-error "AVX512 ISA '\[^\n\r\]*' is not supported in 'target' attribute, use 'arch=' syntax" } */ +void __attribute__ ((target("avx512vnni"))) foo () {} /* { dg-error "AVX512 ISA '\[^\n\r\]*' is not supported in 'target' attribute, use 'arch=' syntax" } */ +void __attribute__ ((target("avx512bitalg"))) foo () {} /* { dg-error "AVX512 ISA '\[^\n\r\]*' is not supported in 'target' attribute, use 'arch=' syntax" } */ +void __attribute__ ((target("default"))) foo () {} + +int main() +{ + foo (); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mvc14.c b/gcc/testsuite/gcc.target/i386/mvc14.c new file mode 100644 index 00000000000..fc357e65eca --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mvc14.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-require-ifunc "" } */ + +__attribute__((target_clones("avx512vl", "avx512bw", "avx512dq", + "avx512cd", "avx512er", "avx512pf", "avx512vbmi", + "avx512ifma", "avx5124vnniw", "avx5124fmaps", + "avx512vpopcntdq", "avx512vbmi2", "gfni", + "vpclmulqdq", "avx512vnni", "avx512bitalg", + "default"))) +int foo (); /* { dg-error "AVX512 ISA '\[^\n\r\]*' is not supported in 'target' attribute, use 'arch=' syntax" } */ + +int +bar () +{ + return foo(); +} -- 2.21.0