public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Ajit Kumar Agarwal <ajit.kumar.agarwal@xilinx.com>
To: Jeff Law <law@redhat.com>, Richard Biener <richard.guenther@gmail.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>,
	Vinod Kathail <vinodk@xilinx.com>,
	Shail Aditya Gupta <shailadi@xilinx.com>,
	Vidhumouli Hunsigida	<vidhum@xilinx.com>,
	Nagaraju Mekala <nmekala@xilinx.com>
Subject: RE: [Patch,tree-optimization]: Add new path Splitting pass on tree ssa representation
Date: Tue, 20 Oct 2015 16:05:00 -0000	[thread overview]
Message-ID: <37378DC5BCD0EE48BA4B082E0B55DFAA429A543F@XAP-PVEXMBX02.xlnx.xilinx.com> (raw)
In-Reply-To: <37378DC5BCD0EE48BA4B082E0B55DFAA42989BDF@XAP-PVEXMBX02.xlnx.xilinx.com>

Hello Jeff:

Did you get a chance to look at the below response. Please let me know your opinion on the below.

Thanks & Regards
Ajit

-----Original Message-----
From: gcc-patches-owner@gcc.gnu.org [mailto:gcc-patches-owner@gcc.gnu.org] On Behalf Of Ajit Kumar Agarwal
Sent: Saturday, September 12, 2015 4:09 PM
To: Jeff Law; Richard Biener
Cc: GCC Patches; Vinod Kathail; Shail Aditya Gupta; Vidhumouli Hunsigida; Nagaraju Mekala
Subject: RE: [Patch,tree-optimization]: Add new path Splitting pass on tree ssa representation



-----Original Message-----
From: Jeff Law [mailto:law@redhat.com]
Sent: Thursday, September 10, 2015 3:10 AM
To: Ajit Kumar Agarwal; Richard Biener
Cc: GCC Patches; Vinod Kathail; Shail Aditya Gupta; Vidhumouli Hunsigida; Nagaraju Mekala
Subject: Re: [Patch,tree-optimization]: Add new path Splitting pass on tree ssa representation

On 08/26/2015 11:29 PM, Ajit Kumar Agarwal wrote:
>
> Thanks. The following testcase testsuite/gcc.dg/tree-ssa/ifc-5.c
>
> void dct_unquantize_h263_inter_c (short *block, int n, int qscale, int
> nCoeffs) { int i, level, qmul, qadd;
>
> qadd = (qscale - 1) | 1; qmul = qscale << 1;
>
> for (i = 0; i <= nCoeffs; i++) { level = block[i]; if (level < 0) 
> level = level * qmul - qadd; else level = level * qmul + qadd; 
> block[i] = level; } }
>
> The above Loop is a candidate of path splitting as the IF block merges 
> at the latch of the Loop and the path splitting duplicates The latch 
> of the loop which is the statement block[i] = level into the 
> predecessors THEN and ELSE block.
>
> Due to above path splitting,  the IF conversion is disabled and the 
> above IF-THEN-ELSE is not IF-converted and the test case fails.
>>So I think the question then becomes which of the two styles generally results in better code?  The path-split version or the older if-converted version.

>>If the latter, then this may suggest that we've got the path splitting code at the wrong stage in the optimizer pipeline or that we need better heuristics for >>when to avoid applying path splitting.

The code generated by the Path Splitting is useful when it exposes the DCE, PRE,CCP candidates. Whereas the IF-conversion is useful When the if-conversion exposes the vectorization candidates. If the  if-conversion doesn't exposes the vectorization and the path splitting doesn't Exposes the DCE, PRE redundancy candidates, it's hard to predict. If the if-conversion does not exposes the vectorization and in the similar case Path splitting exposes the DCE , PRE  and CCP redundancy candidates then path splitting is useful. Also the path splitting increases the granularity of the THEN and ELSE path makes better register allocation and code scheduling.

The suggestion for keeping the path splitting later in the pipeline after the if-conversion and the vectorization is useful as it doesn't break the Existing Deja GNU tests. Also useful to keep the path splitting later in the pipeline after the if-conversion and vectorization is that path splitting Can always duplicate the merge node into its predecessor after the if-conversion and vectorization pass, if the if-conversion and vectorization Is not applicable to the Loops. But this suppresses the CCP, PRE candidates which are earlier in the optimization pipeline.


>
> There were following review comments from the above patch.
>
> +/* This function performs the feasibility tests for path splitting
>> +   to perform. Return false if the feasibility for path splitting
>> +   is not done and returns true if the feasibility for path
>> splitting +   is done. Following feasibility tests are performed.
>> + +   1. Return false if the join block has rhs casting for assign
>> +      gimple statements.
>
> Comments from Jeff:
>
>>> These seem totally arbitrary.  What's the reason behind each of 
>>> these restrictions?  None should be a correctness requirement 
>>> AFAICT.
>
> In the above patch I have made a check given in point 1. in the loop 
> latch and the Path splitting is disabled and the IF-conversion happens 
> and the test case passes.
>>That sounds more like a work-around/hack.  There's nothing inherent with a type conversion that should disable path splitting.

I have sent the patch with this change and I will remove the above check from the patch.

>>What happens if we delay path splitting to a point after if-conversion is complete?

This is better suggestion as explained above, but gains achieved through path splitting by keeping earlier in the pipeline before if-conversion , tree-vectorization, tree-vrp is suppressed if the following optimization after path splitting is not applicable for the above loops.

I have made the above changes and the existing set up doesn't break but the gains achieved in the benchmarks like rgbcmy_lite(EEMBC) Benchmarks is suppressed. The path splitting for the above EEMBC benchmarks give gains of 9% and for such loops if-conversion and Vectorization is not applicable  exposing gain with path splitting optimizations.

>>Alternately, could if-conversion export a routine which indicates if a particular sub-graph is likely to be if-convertable?  The path splitting pass could then use >>that routine to help determine if the path ought to be split or if it should instead rely on if-conversion.

Exporting the above routine from IF-conversion is not useful as the heuristics used in IF-conversion populates the Data Dependence through Scalar evolution which is trigger much later in the optimization pipeline. Populating such info in the earlier stage of the optimizations will not work as the Data Dependence through scalar evolution is trigger much later in the optimization  pipeline. Structure of basic block hierarchy required for if-conversion Looks similar to path splitting and exporting such function disables the path splitting for the cases where if-conversion is not applicable as there Are more data dependency check that distinguishes the if-conversion and path splitting.

Considering all the above, Keeping path splitting after if-conversion and vectorization looks better suggestion though this suppresses gains achieved Given above because of having path splitting after  tree-vrp, PRE, CCP. There is a dce path after the tree-vrp, if-conversion and tree-vectorize So the path splitting exposing DCE will not be affected.

Please suggest.

Thanks & Regards
Ajit

Jeff

  reply	other threads:[~2015-10-20 16:02 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-30  8:34 Ajit Kumar Agarwal
2015-06-30 10:38 ` Bernhard Reutner-Fischer
2015-06-30 10:43   ` Ajit Kumar Agarwal
2015-06-30 10:51     ` Bernhard Reutner-Fischer
2015-06-30 11:39 ` Richard Biener
2015-06-30 12:07   ` Ajit Kumar Agarwal
2015-07-04 12:40   ` Ajit Kumar Agarwal
2015-07-07  8:50     ` Richard Biener
2015-07-07 13:22       ` Ajit Kumar Agarwal
2015-07-16 11:20         ` Richard Biener
2015-07-29  7:44           ` Ajit Kumar Agarwal
2015-08-15 23:13             ` Ajit Kumar Agarwal
2015-08-19 19:47               ` Jeff Law
2015-08-20 15:40                 ` Ajit Kumar Agarwal
2015-08-20 15:49                   ` Jeff Law
2015-08-27  6:00                     ` Ajit Kumar Agarwal
2015-09-09 21:45                       ` Jeff Law
2015-09-12 12:05                         ` Ajit Kumar Agarwal
2015-10-20 16:05                           ` Ajit Kumar Agarwal [this message]
2015-11-11  7:01                           ` Jeff Law
2015-08-19 21:53               ` Jeff Law
2015-08-20 15:41                 ` Ajit Kumar Agarwal
2015-09-04 18:07                 ` Ajit Kumar Agarwal
2015-11-11 20:38                   ` Jeff Law
2015-11-12 10:58                     ` Richard Biener
2015-11-12 17:05                       ` Jeff Law
2015-11-12 18:33                         ` Jeff Law
2015-11-12 19:40                           ` Richard Biener
2015-11-12 19:52                             ` Jeff Law
2015-11-12 21:58                           ` Jeff Law
2015-11-13 10:13                             ` Richard Biener
2015-11-13 16:26                               ` Jeff Law
2015-11-13 18:09                                 ` Richard Biener
2015-11-13 20:23                                   ` Jeff Law
2015-11-13 23:36                                     ` Jeff Law
2015-11-18  7:44                                       ` Tom de Vries
2015-11-18 14:24                                         ` Ajit Kumar Agarwal
2015-12-03 14:38                                       ` Richard Biener
2015-12-03 14:45                                         ` Richard Biener
2015-12-10 20:12                                           ` Jeff Law
2015-12-03 15:46                                         ` Jeff Law
2015-12-10 20:08                                         ` Jeff Law
2015-12-11  9:11                                           ` Ajit Kumar Agarwal
2015-12-23  6:36                                             ` Jeff Law
2015-12-25  8:40                                               ` Ajit Kumar Agarwal
2016-01-02  7:32                                                 ` Jeff Law
2016-01-04 14:32                                               ` Ajit Kumar Agarwal
2016-01-13  8:10                                                 ` Jeff Law
     [not found]                                                   ` <56976289.3080203@redhat.com! >
2016-01-14  8:55                                                   ` Jeff Law
2016-01-15 23:02                                                     ` Jeff Law
2016-01-18 18:27                                                       ` Ajit Kumar Agarwal
2016-01-27  7:17                                                         ` Jeff Law
2016-01-27 17:21                                                           ` Ajit Kumar Agarwal
2016-01-15 22:38                                                   ` Jeff Law
2016-01-16  6:32                                                 ` Jeff Law
2016-01-18  9:13                                                   ` Ajit Kumar Agarwal
2016-01-27  7:13                                                     ` Jeff Law
2016-01-27  9:35                                                       ` Ajit Kumar Agarwal
2016-02-04  8:57                                                 ` Jeff Law
2015-12-11 10:06                                           ` Richard Biener
2015-12-15 23:50                                             ` Jeff Law
2015-12-16  7:44                                               ` Ajit Kumar Agarwal
2015-12-16  9:57                                                 ` Richard Biener
2015-12-16 10:13                                                   ` Ajit Kumar Agarwal
2015-12-17 10:38                                                     ` Ajit Kumar Agarwal
2015-12-17 23:41                                             ` Jeff Law
2015-12-18 15:43                                               ` Zamyatin, Igor
2015-11-13 13:19                             ` Ajit Kumar Agarwal
2015-06-30 12:39 ` Ajit Kumar Agarwal
2015-06-30 22:18 ` Joseph Myers
2015-07-02  3:52   ` Ajit Kumar Agarwal
2015-07-06 20:08     ` Jeff Law

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=37378DC5BCD0EE48BA4B082E0B55DFAA429A543F@XAP-PVEXMBX02.xlnx.xilinx.com \
    --to=ajit.kumar.agarwal@xilinx.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=law@redhat.com \
    --cc=nmekala@xilinx.com \
    --cc=richard.guenther@gmail.com \
    --cc=shailadi@xilinx.com \
    --cc=vidhum@xilinx.com \
    --cc=vinodk@xilinx.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).