RE: [RFC] ipa: Adjust references to identify read-only globals

2021-07-27 Thread JiangNing OS via Gcc-patches



> -Original Message-
> From: Martin Jambor 
> Sent: Tuesday, July 27, 2021 5:39 PM
> To: JiangNing OS ; Richard Biener
> 
> Cc: GCC Patches ; Jan Hubicka 
> Subject: RE: [RFC] ipa: Adjust references to identify read-only globals
> 
> Hi,
> 
> On Tue, Jul 27 2021, JiangNing OS wrote:
> >> Since it has been pre-approved by Honza, I would like to commit it to
> >> master soon.  Nevertheless, Jiangning, I am OK to wait a day or so if
> >> you can give it another test on your setup.
> >>
> >
> > I failed to apply your patch, so could you please provide a patch file 
> > instead?
> 
> I have committed the patch this morning as commit 13586172d0b - so please
> try that.
> 
> But I really hope the issues are resolved.

Yes. The ICEs I saw before are fixed on trunk.

Thanks,
-Jiangning


RE: [RFC] ipa: Adjust references to identify read-only globals

2021-07-27 Thread JiangNing OS via Gcc-patches
> Since it has been pre-approved by Honza, I would like to commit it to master
> soon.  Nevertheless, Jiangning, I am OK to wait a day or so if you can give it
> another test on your setup.
> 

I failed to apply your patch, so could you please provide a patch file instead?

patch:  malformed patch at line 45: @@ -4008,7 +4009,8 @@ 
ipcp_discover_new_direct_edges (struct cgraph_node *node,

Thanks,
-Jiangning


RE: [RFC] ipa: Adjust references to identify read-only globals

2021-07-20 Thread JiangNing OS via Gcc-patches
> -Original Message-
> From: Gcc-patches  bounces+jiangning=os.amperecomputing@gcc.gnu.org> On Behalf Of
> Martin Jambor
> Sent: Wednesday, June 30, 2021 4:19 AM
> To: GCC Patches 
> Cc: Jan Hubicka 
> Subject: [RFC] ipa: Adjust references to identify read-only globals
> 
> Hi,
> 
> this patch has been motivated by SPEC 2017's 544.nab_r in which there is a
> static variable which is never written to and so zero throughout the run-time
> of the benchmark.  However, it is passed by reference to a function in which
> it is read and (after some multiplications) passed into __builtin_exp which in
> turn unnecessarily consumes almost 10% of the total benchmark run-time.

I do see ~8.5% runtime reduction on aarch64.

> The situation is illustrated by the added testcase remref-3.c.
> 
> The patch adds a flag to ipa-prop descriptor of each parameter to mark such
> parameters.  IPA-CP and inling then take the effort to remove IPA_REF_ADDR
> references in the caller and only add IPA_REF_LOAD reference to the
> clone/overall inlined function.  This is sufficient for subsequent symbol 
> table
> analysis code to identify the read-only variable as such and optimize the 
> code.
> 
> I plan to compile a number of packages with the patch to test it some more
> and get a bit better idea of its impact.  But it has passed bootstrap,
> LTObootstrap and testing on x86_64-linux and i686-linux and so unless I find
> any problem, I would like to commit it at some point next month without any
> major changes, so I'd be grateful for any feedback even now.

I see 3 cases in SPEC2017 failed to compile on aarch64, i.e. 521.wrf_r, 
527.cam4_r, 554.roms_r. For example,

pre_step3d.fppized.f90:1260:35: internal compiler error: Segmentation fault
 1260 |   CALL wclock_on (ng, iNLM, 22)
  |   ^
0x1645c6b internal_error(char const*, ...)
???:0
0xe1f4f4 place_block_symbol(rtx_def*)
???:0
0x84ab33 use_anchored_address(rtx_def*)
???:0
0x868203 expand_expr_real_1(tree_node*, rtx_def*, machine_mode, 
expand_modifier, rtx_def**, bool)
???:0
0x868793 expand_expr_real_1(tree_node*, rtx_def*, machine_mode, 
expand_modifier, rtx_def**, bool)
???:0
0x75b593 expand_call(tree_node*, rtx_def*, int)
???:0
0x86a09f expand_expr_real_1(tree_node*, rtx_def*, machine_mode, 
expand_modifier, rtx_def**, bool)
???:0
Please submit a full bug report

Thanks,
-Jiangning


RE: Should ARMv8-A generic tuning default to -moutline-atomics

2020-05-01 Thread JiangNing OS via Gcc-patches
In reality, a lot of users are still using old gcc versions running on new 
hardware. OpenJDK is a typical example, I think.

> -Original Message-
> From: Richard Earnshaw 
> Sent: Friday, May 1, 2020 6:41 PM
> To: JiangNing OS ; Kyrylo Tkachov
> ; Andrew Pinski ; Florian
> Weimer 
> Cc: gcc-patches@gcc.gnu.org; nmeye...@amzn.com
> Subject: Re: Should ARMv8-A generic tuning default to -moutline-atomics
> 
> On 01/05/2020 11:38, JiangNing OS via Gcc-patches wrote:
> > Hi Kyrill,
> >
> > Can it be backported to gcc 8/9/10 branches?
> >
> 
> I'm not sure changing the defaults of things like this is a good idea on 'dot'
> releases.
> 
> Having the option is one thing.  Changing the default another thing entirely.
> 
> R.
> 
> > Thanks,
> > -Jiangning
> >
> >> -Original Message-
> >> From: Gcc-patches  On Behalf Of
> >> Kyrylo Tkachov
> >> Sent: Thursday, April 30, 2020 8:27 PM
> >> To: Kyrylo Tkachov ; Andrew Pinski
> >> ; Florian Weimer 
> >> Cc: gcc-patches@gcc.gnu.org; nmeye...@amzn.com
> >> Subject: RE: Should ARMv8-A generic tuning default to
> >> -moutline-atomics
> >>
> >>
> >>
> >>> -Original Message-
> >>> From: Gcc-patches  On Behalf Of
> >>> Kyrylo Tkachov
> >>> Sent: 30 April 2020 11:57
> >>> To: Andrew Pinski ; Florian Weimer
> >>> 
> >>> Cc: gcc-patches@gcc.gnu.org; nmeye...@amzn.com
> >>> Subject: RE: Should ARMv8-A generic tuning default to
> >>> -moutline-atomics
> >>>
> >>> [Moving to gcc-patches]
> >>>
> >>>> -Original Message-
> >>>> From: Gcc  On Behalf Of Andrew Pinski via
> >>>> Gcc
> >>>> Sent: 30 April 2020 07:21
> >>>> To: Florian Weimer 
> >>>> Cc: GCC Mailing List ; nmeye...@amzn.com
> >>>> Subject: Re: Should ARMv8-A generic tuning default to
> >>>> -moutline-atomics
> >>>>
> >>>> On Wed, Apr 29, 2020 at 6:25 AM Florian Weimer via Gcc
> >>>> 
> >>>> wrote:
> >>>>>
> >>>>> Distributions are receiving requests to build things with
> >>>>> -moutline-atomics:
> >>>>>
> >>>>>   <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=956418>
> >>>>>
> >>>>> Should this be reflected in the GCC upstream defaults for ARMv8-A
> >>>>> generic tuning?  It does not make much sense to me if every
> >>>>> distribution has to overide these flags, either in their build
> >>>>> system or by patching GCC.
> >>>>
> >>>> At least we should make it a configure option.
> >>>> I do want the ability to default it for our (Marvell) toolchain for
> >>>> Linux (our bare metal toolchain will be defaulting to ARMv8.2-a
> >>>> anyways).
> >>>
> >>> After some internal discussions, I am open to having it on as a default.
> >>> Here are two versions. One has it as a tuning setting that CPUs can
> >>> override, the other just switches it on by default always unless
> >>> overridden by -mno- outline-atomics.
> >>> I slightly prefer the second one as it's cleaner and simpler, but
> >>> happy to take either.
> >>> Any preferences?
> >>> Thanks,
> >>> Kyrill
> >>>
> >>> ChangeLogs:
> >>>
> >>> 2020-04-30  Kyrylo Tkachov  
> >>>
> >>>   * config/aarch64/aarch64-tuning-flags.def (no_outline_atomics):
> >>> Declare.
> >>>   * config/aarch64/aarch64.h (TARGET_OUTLINE_ATOMICS): Define.
> >>>   * config/aarch64/aarch64.opt (moutline-atomics): Change to Int
> >>> variable.
> >>>
> >>> 2020-04-30  Kyrylo Tkachov  
> >>>
> >>>   * config/aarch64/aarch64.h (TARGET_OUTLINE_ATOMICS): Define.
> >>>   * config/aarch64/aarch64.opt (moutline-atomics): Change to Int
> >>> variable.
> >>>   * doc/invoke.texi (moutline-atomics): Document as on by default.
> >>>
> >>
> >> I've pushed this second variant after bootstrap and testing on
> >> aarch64-none- linux-gnu.
> >> Compiled a simple atomic-using testcase with all relevant
> >> combinations of - moutline-atomics and LSE and no-LSE -march options.
> >> Before the results were (as expected):
> >>  |-moutline-atomics | -mno-outline-atomics |  >> outline-atomics option
> >> 
> >> LSE  |  inline LSE  | inline LSE| inline LSE
> >> no-LSE   |  outline | inline LDXR/STXR  | inline LDX/STXR
> >>
> >>
> >> with this patch they are:
> >>  -moutline-atomics  | -mno-outline-atomics |  >> outline-atomics option>
> >> 
> >> LSE  |  inline LSE  | inline LSE   | inline LSE
> >> no-LSE   |  outline | inline LDXR/STXR | outline
> >>
> >> Thanks,
> >> Kyrill



RE: Should ARMv8-A generic tuning default to -moutline-atomics

2020-05-01 Thread JiangNing OS via Gcc-patches
Hi Kyrill,

Can it be backported to gcc 8/9/10 branches?

Thanks,
-Jiangning

> -Original Message-
> From: Gcc-patches  On Behalf Of Kyrylo
> Tkachov
> Sent: Thursday, April 30, 2020 8:27 PM
> To: Kyrylo Tkachov ; Andrew Pinski
> ; Florian Weimer 
> Cc: gcc-patches@gcc.gnu.org; nmeye...@amzn.com
> Subject: RE: Should ARMv8-A generic tuning default to -moutline-atomics
> 
> 
> 
> > -Original Message-
> > From: Gcc-patches  On Behalf Of
> > Kyrylo Tkachov
> > Sent: 30 April 2020 11:57
> > To: Andrew Pinski ; Florian Weimer
> > 
> > Cc: gcc-patches@gcc.gnu.org; nmeye...@amzn.com
> > Subject: RE: Should ARMv8-A generic tuning default to
> > -moutline-atomics
> >
> > [Moving to gcc-patches]
> >
> > > -Original Message-
> > > From: Gcc  On Behalf Of Andrew Pinski via
> > > Gcc
> > > Sent: 30 April 2020 07:21
> > > To: Florian Weimer 
> > > Cc: GCC Mailing List ; nmeye...@amzn.com
> > > Subject: Re: Should ARMv8-A generic tuning default to
> > > -moutline-atomics
> > >
> > > On Wed, Apr 29, 2020 at 6:25 AM Florian Weimer via Gcc
> > > 
> > > wrote:
> > > >
> > > > Distributions are receiving requests to build things with
> > > > -moutline-atomics:
> > > >
> > > >   
> > > >
> > > > Should this be reflected in the GCC upstream defaults for ARMv8-A
> > > > generic tuning?  It does not make much sense to me if every
> > > > distribution has to overide these flags, either in their build
> > > > system or by patching GCC.
> > >
> > > At least we should make it a configure option.
> > > I do want the ability to default it for our (Marvell) toolchain for
> > > Linux (our bare metal toolchain will be defaulting to ARMv8.2-a
> > > anyways).
> >
> > After some internal discussions, I am open to having it on as a default.
> > Here are two versions. One has it as a tuning setting that CPUs can
> > override, the other just switches it on by default always unless
> > overridden by -mno- outline-atomics.
> > I slightly prefer the second one as it's cleaner and simpler, but
> > happy to take either.
> > Any preferences?
> > Thanks,
> > Kyrill
> >
> > ChangeLogs:
> >
> > 2020-04-30  Kyrylo Tkachov  
> >
> > * config/aarch64/aarch64-tuning-flags.def (no_outline_atomics):
> > Declare.
> > * config/aarch64/aarch64.h (TARGET_OUTLINE_ATOMICS): Define.
> > * config/aarch64/aarch64.opt (moutline-atomics): Change to Int
> > variable.
> >
> > 2020-04-30  Kyrylo Tkachov  
> >
> > * config/aarch64/aarch64.h (TARGET_OUTLINE_ATOMICS): Define.
> > * config/aarch64/aarch64.opt (moutline-atomics): Change to Int
> > variable.
> > * doc/invoke.texi (moutline-atomics): Document as on by default.
> >
> 
> I've pushed this second variant after bootstrap and testing on aarch64-none-
> linux-gnu.
> Compiled a simple atomic-using testcase with all relevant combinations of -
> moutline-atomics and LSE and no-LSE -march options.
> Before the results were (as expected):
>  |-moutline-atomics | -mno-outline-atomics |  option
> 
> LSE  |  inline LSE  | inline LSE| inline LSE
> no-LSE   |  outline | inline LDXR/STXR  | inline LDX/STXR
> 
> 
> with this patch they are:
>  -moutline-atomics  | -mno-outline-atomics |  option>
> 
> LSE  |  inline LSE  | inline LSE   | inline LSE
> no-LSE   |  outline | inline LDXR/STXR | outline
> 
> Thanks,
> Kyrill