[Bug lto/90500] ICE error in copy_forbiden
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90500 Andrew Pinski changed: What|Removed |Added CC||ujszhangc at gmail dot com --- Comment #23 from Andrew Pinski --- *** Bug 114008 has been marked as a duplicate of this bug. ***
[Bug lto/90500] ICE error in copy_forbiden
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90500 Martin Liška changed: What|Removed |Added CC||yyc1992 at gmail dot com --- Comment #22 from Martin Liška --- *** Bug 94656 has been marked as a duplicate of this bug. ***
[Bug lto/90500] ICE error in copy_forbiden
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90500 Martin Liška changed: What|Removed |Added Status|REOPENED|RESOLVED Resolution|--- |FIXED --- Comment #21 from Martin Liška --- Fixed again.
[Bug lto/90500] ICE error in copy_forbiden
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90500 --- Comment #20 from Martin Liška --- Author: marxin Date: Wed May 22 07:45:17 2019 New Revision: 271504 URL: https://gcc.gnu.org/viewcvs?rev=271504=gcc=rev Log: Strip target_clones in copy attribute (PR lto/90500). 2019-05-22 Martin Liska PR lto/90500 * c-attribs.c (handle_copy_attribute): Do not copy target_clones attribute. 2019-05-22 Martin Liska PR lto/90500 * gcc.target/i386/pr90500-1.c: Make the test-case valid now. 2019-05-22 Martin Liska PR lto/90500 * doc/extend.texi: Document the change. Modified: trunk/gcc/ChangeLog trunk/gcc/c-family/ChangeLog trunk/gcc/c-family/c-attribs.c trunk/gcc/doc/extend.texi trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/gcc.target/i386/pr90500-1.c
[Bug lto/90500] ICE error in copy_forbiden
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90500 Martin Liška changed: What|Removed |Added Status|RESOLVED|REOPENED Resolution|FIXED |--- --- Comment #19 from Martin Liška --- Reopenning
[Bug lto/90500] ICE error in copy_forbiden
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90500 --- Comment #18 from Martin Liška --- On 5/20/19 11:58 PM, joseph at codesourcery dot com wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90500 > > --- Comment #17 from joseph at codesourcery dot com dot com> --- > The copy attribute is intended to copy attributes that are properties of > the function itself (e.g. "pure"), but not those that are properties of a > particular symbol for the function (e.g. "visibility"). If target_clones > does not make sense to copy, probably it should be excluded by the copy > attribute. > Works for me, I'm going to prepare a patch that will address that. Thank you, Martin
[Bug lto/90500] ICE error in copy_forbiden
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90500 --- Comment #17 from joseph at codesourcery dot com --- The copy attribute is intended to copy attributes that are properties of the function itself (e.g. "pure"), but not those that are properties of a particular symbol for the function (e.g. "visibility"). If target_clones does not make sense to copy, probably it should be excluded by the copy attribute.
[Bug lto/90500] ICE error in copy_forbiden
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90500 --- Comment #16 from Martin Liška --- > I am not quite familiar with libm, will this change the its bevhavior or > other side effect? No. You have to tweak the macro definition, sorry.
[Bug lto/90500] ICE error in copy_forbiden
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90500 --- Comment #15 from Guobing Chen --- (In reply to Martin Liška from comment #14) > (In reply to Guobing Chen from comment #13) > > (In reply to Martin Liška from comment #12) > > > > The background is that, we want to try optimize libm with avx2/avx512, > > > > and > > > > found that not all the libm math functions will have benefit when we > > > > generally use 'arch=haswell' or 'arch=skylake-avx512' to compile libm. > > > > So we > > > > picked those 'good' libm math functions to add FMV attribute like > > > > target_clone("default", "arch=haswell", "arch=skylake-avx512") to get > > > > performance benefit. The alias is used in libm code by default. I have > > > > no > > > > idea why these two are conflicting that not allowed by GCC9. > > > > > > That makes sense. Based on the test-case you provided, you just want: > > > > > > __attribute__((target_clones("default", "arch=haswell", > > > "arch=skylake-avx512"))) > > > double > > > __tanh (double x) > > > { > > > double t, z; > > > int32_t jx, ix, lx; > > > > > > > > > do { ieee_double_shape_type ew_u; ew_u.value = (x); (jx) = > > > ew_u.parts.msw; > > > (lx) = ew_u.parts.lsw; } while (0); > > > ix = jx & 0x7fff; > > > ... > > > } > > > > > > extern __typeof (__tanh) tanh __attribute__ ((weak, alias ("__tanh"))); // > > > __attribute__ ((__copy__ (__tanh))); > > > > > > You don't want to use __copy__ attribute because it's responsible for > > > copying of target_clone attribute to the alias. > > > And it does not make sense to create clones of an alias. > > > > The copy is from alias used by libm by default (Below I paste the src code), > > I cannot remove this copy seems. How can I then to use FMV for this > > function? > > > > Then you'll have to make one libm_alias_double_no_copy that will do the same > except setting the copy attribute. I am not quite familiar with libm, will this change the its bevhavior or other side effect?
[Bug lto/90500] ICE error in copy_forbiden
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90500 --- Comment #14 from Martin Liška --- (In reply to Guobing Chen from comment #13) > (In reply to Martin Liška from comment #12) > > > The background is that, we want to try optimize libm with avx2/avx512, and > > > found that not all the libm math functions will have benefit when we > > > generally use 'arch=haswell' or 'arch=skylake-avx512' to compile libm. So > > > we > > > picked those 'good' libm math functions to add FMV attribute like > > > target_clone("default", "arch=haswell", "arch=skylake-avx512") to get > > > performance benefit. The alias is used in libm code by default. I have no > > > idea why these two are conflicting that not allowed by GCC9. > > > > That makes sense. Based on the test-case you provided, you just want: > > > > __attribute__((target_clones("default", "arch=haswell", > > "arch=skylake-avx512"))) > > double > > __tanh (double x) > > { > > double t, z; > > int32_t jx, ix, lx; > > > > > > do { ieee_double_shape_type ew_u; ew_u.value = (x); (jx) = ew_u.parts.msw; > > (lx) = ew_u.parts.lsw; } while (0); > > ix = jx & 0x7fff; > > ... > > } > > > > extern __typeof (__tanh) tanh __attribute__ ((weak, alias ("__tanh"))); // > > __attribute__ ((__copy__ (__tanh))); > > > > You don't want to use __copy__ attribute because it's responsible for > > copying of target_clone attribute to the alias. > > And it does not make sense to create clones of an alias. > > The copy is from alias used by libm by default (Below I paste the src code), > I cannot remove this copy seems. How can I then to use FMV for this function? > Then you'll have to make one libm_alias_double_no_copy that will do the same except setting the copy attribute.
[Bug lto/90500] ICE error in copy_forbiden
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90500 --- Comment #13 from Guobing --- (In reply to Martin Liška from comment #12) > > The background is that, we want to try optimize libm with avx2/avx512, and > > found that not all the libm math functions will have benefit when we > > generally use 'arch=haswell' or 'arch=skylake-avx512' to compile libm. So we > > picked those 'good' libm math functions to add FMV attribute like > > target_clone("default", "arch=haswell", "arch=skylake-avx512") to get > > performance benefit. The alias is used in libm code by default. I have no > > idea why these two are conflicting that not allowed by GCC9. > > That makes sense. Based on the test-case you provided, you just want: > > __attribute__((target_clones("default", "arch=haswell", > "arch=skylake-avx512"))) > double > __tanh (double x) > { > double t, z; > int32_t jx, ix, lx; > > > do { ieee_double_shape_type ew_u; ew_u.value = (x); (jx) = ew_u.parts.msw; > (lx) = ew_u.parts.lsw; } while (0); > ix = jx & 0x7fff; > ... > } > > extern __typeof (__tanh) tanh __attribute__ ((weak, alias ("__tanh"))); // > __attribute__ ((__copy__ (__tanh))); > > You don't want to use __copy__ attribute because it's responsible for > copying of target_clone attribute to the alias. > And it does not make sense to create clones of an alias. The copy is from alias used by libm by default (Below I paste the src code), I cannot remove this copy seems. How can I then to use FMV for this function? __attribute__((target_clones("default", "arch=haswell", "arch=broadwell" ,"arch=skylake", "arch=skylake-avx512"))) double __tanh (double x) { double t, z; int32_t jx, ix, lx; /* High word of |x|. */ EXTRACT_WORDS (jx, lx, x); ix = jx & 0x7fff; /* x is INF or NaN */ if (ix >= 0x7ff0) { if (jx >= 0) return one / x + one; /* tanh(+-inf)=+-1 */ else return one / x - one; /* tanh(NaN) = NaN */ } /* |x| < 22 */ if (ix < 0x4036) /* |x|<22 */ { if ((ix | lx) == 0) return x; /* x == +-0 */ if (ix < 0x3c80) /* |x|<2**-55 */ { math_check_force_underflow (x); return x * (one + x); /* tanh(small) = small */ } if (ix >= 0x3ff0) /* |x|>=1 */ { t = __expm1 (two * fabs (x)); z = one - two / (t + two); } else { t = __expm1 (-two * fabs (x)); z = -t / (t + two); } /* |x| > 22, return +-1 */ } else { z = one - tiny; /* raised inexact flag */ } return (jx >= 0) ? z : -z; } libm_alias_double (__tanh, tanh)
[Bug lto/90500] ICE error in copy_forbiden
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90500 --- Comment #12 from Martin Liška --- > The background is that, we want to try optimize libm with avx2/avx512, and > found that not all the libm math functions will have benefit when we > generally use 'arch=haswell' or 'arch=skylake-avx512' to compile libm. So we > picked those 'good' libm math functions to add FMV attribute like > target_clone("default", "arch=haswell", "arch=skylake-avx512") to get > performance benefit. The alias is used in libm code by default. I have no > idea why these two are conflicting that not allowed by GCC9. That makes sense. Based on the test-case you provided, you just want: __attribute__((target_clones("default", "arch=haswell", "arch=skylake-avx512"))) double __tanh (double x) { double t, z; int32_t jx, ix, lx; do { ieee_double_shape_type ew_u; ew_u.value = (x); (jx) = ew_u.parts.msw; (lx) = ew_u.parts.lsw; } while (0); ix = jx & 0x7fff; ... } extern __typeof (__tanh) tanh __attribute__ ((weak, alias ("__tanh"))); // __attribute__ ((__copy__ (__tanh))); You don't want to use __copy__ attribute because it's responsible for copying of target_clone attribute to the alias. And it does not make sense to create clones of an alias.
[Bug lto/90500] ICE error in copy_forbiden
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90500 --- Comment #11 from Guobing --- (In reply to Martin Liška from comment #10) > (In reply to Guobing from comment #8) > > Hi, I am the original reporter of this bug. This problem seems not happen on > > GCC8 while do on GCC9. We try to use FMV (target_clone) for some of the > > GlibC libm functions which leads us to this issue. From the Patch below, > > seems this fix the GCC9 crash issue but still not allow target_clone to be > > used together with alias. But this is allowed in GCC8 as we can compile and > > run well under GCC8. So could you help to make the behavior the same as GCC8 > > or tell us a way to walkaround it? > > Well, maybe that was allowed in GCC8, but it was not intentional. Please > describe me your use case and we can come up to a solution that will use > target_clone (or target attribute)? The background is that, we want to try optimize libm with avx2/avx512, and found that not all the libm math functions will have benefit when we generally use 'arch=haswell' or 'arch=skylake-avx512' to compile libm. So we picked those 'good' libm math functions to add FMV attribute like target_clone("default", "arch=haswell", "arch=skylake-avx512") to get performance benefit. The alias is used in libm code by default. I have no idea why these two are conflicting that not allowed by GCC9.
[Bug lto/90500] ICE error in copy_forbiden
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90500 --- Comment #10 from Martin Liška --- (In reply to Guobing from comment #8) > Hi, I am the original reporter of this bug. This problem seems not happen on > GCC8 while do on GCC9. We try to use FMV (target_clone) for some of the > GlibC libm functions which leads us to this issue. From the Patch below, > seems this fix the GCC9 crash issue but still not allow target_clone to be > used together with alias. But this is allowed in GCC8 as we can compile and > run well under GCC8. So could you help to make the behavior the same as GCC8 > or tell us a way to walkaround it? Well, maybe that was allowed in GCC8, but it was not intentional. Please describe me your use case and we can come up to a solution that will use target_clone (or target attribute)?
[Bug lto/90500] ICE error in copy_forbiden
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90500 Guobing changed: What|Removed |Added CC||neochen.life at aliyun dot com --- Comment #9 from Guobing --- After applied this patch, I get below errors during compiling with GCC9, while I expect it should be pass as the same as GCC8. ../sysdeps/ieee754/dbl-64/s_tanh.c:97:247: error: clones for ‘target_clones’ attribute cannot be created ../sysdeps/ieee754/dbl-64/s_tanh.c:97:247: note: ‘target_clones’ cannot be combined with ‘alias’ attribute ../sysdeps/ieee754/dbl-64/s_tanh.c:97:135: error: clones for ‘target_clones’ attribute cannot be created ../sysdeps/ieee754/dbl-64/s_tanh.c:97:135: note: ‘target_clones’ cannot be combined with ‘alias’ attribute ../sysdeps/ieee754/dbl-64/s_tanh.c:97:26: error: clones for ‘target_clones’ attribute cannot be created ../sysdeps/ieee754/dbl-64/s_tanh.c:97:26: note: ‘target_clones’ cannot be combined with ‘alias’ attribute
[Bug lto/90500] ICE error in copy_forbiden
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90500 Guobing changed: What|Removed |Added CC||guobing.chen at intel dot com --- Comment #8 from Guobing --- Hi, I am the original reporter of this bug. This problem seems not happen on GCC8 while do on GCC9. We try to use FMV (target_clone) for some of the GlibC libm functions which leads us to this issue. From the Patch below, seems this fix the GCC9 crash issue but still not allow target_clone to be used together with alias. But this is allowed in GCC8 as we can compile and run well under GCC8. So could you help to make the behavior the same as GCC8 or tell us a way to walkaround it?
[Bug lto/90500] ICE error in copy_forbiden
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90500 Martin Liška changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|--- |FIXED --- Comment #7 from Martin Liška --- Fixed.
[Bug lto/90500] ICE error in copy_forbiden
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90500 --- Comment #6 from Martin Liška --- Fixed on trunk, not planning to backport that.
[Bug lto/90500] ICE error in copy_forbiden
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90500 --- Comment #5 from Martin Liška --- Author: marxin Date: Thu May 16 13:08:48 2019 New Revision: 271289 URL: https://gcc.gnu.org/viewcvs?rev=271289=gcc=rev Log: Do not allow target_clones with alias attr (PR lto/90500). 2019-05-16 Martin Liska PR lto/90500 * multiple_target.c (expand_target_clones): Do not allow target_clones being used with a symbol that is an alias. 2019-05-16 Martin Liska PR lto/90500 * gcc.target/i386/pr90500-1.c: New test. * gcc.target/i386/pr90500-2.c: New test. Added: trunk/gcc/testsuite/gcc.target/i386/pr90500-1.c trunk/gcc/testsuite/gcc.target/i386/pr90500-2.c Modified: trunk/gcc/ChangeLog trunk/gcc/multiple_target.c trunk/gcc/testsuite/ChangeLog