public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Kewen.Lin" <linkw@linux.ibm.com>
To: GCC Patches <gcc-patches@gcc.gnu.org>, richard.sandiford@arm.com
Cc: Bill Schmidt <wschmidt@linux.ibm.com>,
	Richard Biener <richard.guenther@gmail.com>,
	Segher Boessenkool <segher@kernel.crashing.org>,
	dje.gcc@gmail.com
Subject: Re: [PATCH 5/7 v6] vect: Support vector load/store with length in vectorizer
Date: Wed, 8 Jul 2020 15:01:36 +0800	[thread overview]
Message-ID: <261029e7-4d41-3353-95d4-ce8455fa506a@linux.ibm.com> (raw)
In-Reply-To: <mpt5zazljfn.fsf@arm.com>

Hi Richard,

on 2020/7/7 下午6:15, Richard Sandiford wrote:
> "Kewen.Lin" <linkw@linux.ibm.com> writes:
>> Hi Richard,
>>
>> on 2020/7/1 下午11:17, Richard Sandiford wrote:
>>> "Kewen.Lin" <linkw@linux.ibm.com> writes:
>>>> on 2020/7/1 上午3:53, Richard Sandiford wrote:
>>>>> "Kewen.Lin" <linkw@linux.ibm.com> writes:
>>>>
>>>> Sorry, I didn't quite follow this comment.  Both nscalars_totoal and
>>>> nscalars_step are scaled here.  The remaining related nscalars_*
>>>> seems only nscalars_skip, but length can't support skip.
>>>
>>> Hmm, OK.  But in that case can you update the names of the variables
>>> to match?  It's confusing to have some nscalars_* variables actually
>>> count scalars (and thus have “nitems” equivalents) and other nscalars_*
>>> variables count something else (and thus effectively be nitems_* variables
>>> themselves).
>>>
>>
>> OK.  I'll update the names like nscalars_total/nscalars_step and equivalents
>> to nitems_total/... (or nunits_total better?)
> 
> I agree “items” isn't great.  I was trying to avoid “units” because GCC
> often uses that to mean bytes (BITS_PER_UNIT, UNITS_PER_WORD, etc.).
> In this context that could be confusing, because sometimes the
> “units” actually would be bytes, but not always.
> 

Got it!  Thanks!

[...]
>>> But in this particular test, we're doing outer loop vectorisation,
>>> and the only elements of vres that matter are the ones selected
>>> by loop_mask (since those are the only ones that get stored out).
>>> So applying the loop mask to the VEC_COND_EXPR is “just” an
>>> (important) optimisation, rather than a correctness issue.
>>>  
>>
>> Thanks for the clarification.  It looks the vres is always safe since its
>> further usage is guard with loop mask.  Then sorry that I didn't catch why
>> it is one optimization for this case, is there some difference in backend
>> supports on this different mask for cond_expr?
> 
> No, the idea of the optimisation is to avoid cases in which we have:
> 
>     cmp_res = …compare…
>     cmp_res' = cmp_res & loop_mask
>     IFN_MASK_LOAD (…, cmp_res')
>     z = cmp_res ? x : y
> 
> The problem here is that cmp_res and cmp_res' are live at the same time,
> which prevents cmp_res and cmp_res' from being combined into a single
> instruction.  It's better for the final instruction to be:
> 
>     z = cmp_res' ? x : y
> 
> so that everything uses the same comparison result.
> 
> We can't leave that to later passes because nothing in the gimple IL
> indicates that only the loop_mask elements of z matter.
> 

Nice, thanks for the explanation.


[...]
>>> What's causing the test to start failing with the patch?  I realise
>>> you've probably already said, sorry, but it's been a large patch series
>>> so it's hard to keep all the details committed to memory.
>>>
>>
>> No problem, appreciate your time much!  Since length-based partial vectors
>> doesn't support any reduction so far, the function has the responsibility
>> to disable use_partial_vectors_p for it.  Without the above else-if part,
>> since the reduction_type is TREE_CODE_REDUCTION for this case, the else part
>> will stop this case to use mask-based partial vectors, but the case expects
>> the outer loop still able to use mask-based partial vectors.
>>
>> As your clarification above, else-if looks wrong.  Probably we can change it
>> to check whether the current vectorization is for outer loop and the condition
>> stmt being handled is in the inner loop, we can allow it for partial vectors?
> 
> I think it's more whether, for outer loop vectorisation, the reduction
> is a double reduction or a simple nested-cycle reduction.  Both have
> a COND_EXPR in the inner loop, but the extra elements only matter for
> double reductions.
> 
> There again, I don't think we actually support double reductions for
> COND_EXPR reductions.
> 

OK.  I will send one separate patch with your suggestion on this.

[...]
>>
>> OK, but it seems it's acceptable if the IV wider than the precision since
>> we allows it out of range?
> 
> For example, suppose that a target handled out-of-range values but
> still had a QImode length.  If the IV was wider than QI, we'd truncate
> 0x100 to 0 when generating the pattern, so a full-vector access would
> get truncated to an empty-vector access.
> 

Yeah, it's so true.

BR,
Kewen

  reply	other threads:[~2020-07-08  7:01 UTC|newest]

Thread overview: 80+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-26  5:49 [PATCH 0/7] Support vector load/store with length Kewen.Lin
2020-05-26  5:51 ` [PATCH 1/7] ifn/optabs: " Kewen.Lin
2020-06-10  6:41   ` [PATCH 1/7 V2] " Kewen.Lin
2020-06-10  9:22     ` Richard Sandiford
2020-06-10 12:36       ` [PATCH 1/7 V3] " Kewen.Lin
2020-06-22  8:51         ` [PATCH 1/7 V4] " Kewen.Lin
2020-06-22 19:59           ` Richard Sandiford
2020-06-22 22:19             ` Segher Boessenkool
2020-06-23  3:54             ` [PATCH 1/7 v5] " Kewen.Lin
2020-06-23  9:52               ` Richard Sandiford
2020-06-23 11:25                 ` Richard Biener
2020-06-23 12:20                   ` Richard Sandiford
2020-06-24  2:40                     ` Jim Wilson
2020-06-24  7:34                       ` Richard Sandiford
2020-06-29  6:32                         ` [PATCH 1/7 v6] " Kewen.Lin
2020-06-29 10:07                           ` Richard Sandiford
2020-06-29 10:39                             ` [PATCH 1/7 v7] " Kewen.Lin
2020-06-30 15:32                               ` Richard Sandiford
2020-07-01 13:35                                 ` [PATCH 1/7 v8] " Kewen.Lin
2020-07-07  9:24                                   ` Richard Sandiford
2020-06-24 23:56                     ` [PATCH 1/7 v5] " Segher Boessenkool
2020-06-23  6:47             ` [PATCH 1/7 V4] " Richard Biener
2020-05-26  5:53 ` [PATCH 2/7] rs6000: lenload/lenstore optab support Kewen.Lin
2020-06-10  6:43   ` [PATCH 2/7 V2] " Kewen.Lin
2020-06-10 12:39     ` [PATCH 2/7 V3] " Kewen.Lin
2020-06-11 22:55       ` Segher Boessenkool
2020-06-12  3:02         ` Kewen.Lin
2020-06-23  3:58       ` [PATCH 2/7 v4] " Kewen.Lin
2020-06-29  6:32         ` [PATCH 2/7 v5] " Kewen.Lin
2020-06-29 17:57           ` Segher Boessenkool
2020-05-26  5:54 ` [PATCH 3/7] vect: Factor out codes for niters smaller than vf check Kewen.Lin
2020-05-26  5:55 ` [PATCH 4/7] hook/rs6000: Add vectorize length mode for vector with length Kewen.Lin
2020-06-10  6:44   ` [PATCH 4/7 V2] " Kewen.Lin
2020-05-26  5:57 ` [PATCH 5/7] vect: Support vector load/store with length in vectorizer Kewen.Lin
2020-05-26 12:49   ` Richard Sandiford
2020-05-26 12:52     ` Richard Sandiford
2020-05-27  8:25     ` Kewen.Lin
2020-05-27 10:02       ` Richard Sandiford
2020-05-28  1:21         ` Kewen.Lin
2020-05-29  8:32           ` Richard Sandiford
2020-05-29 12:38             ` Segher Boessenkool
2020-06-02  9:03             ` [PATCH 5/7 v3] " Kewen.Lin
2020-06-02 11:50               ` Richard Sandiford
2020-06-02 17:01                 ` Segher Boessenkool
2020-06-03  6:33                 ` Kewen.Lin
2020-06-10  9:19                   ` [PATCH 5/7 v4] " Kewen.Lin
2020-06-22  8:33                     ` [PATCH 5/7 v5] " Kewen.Lin
2020-06-29  6:33                       ` [PATCH 5/7 v6] " Kewen.Lin
2020-06-30 19:53                         ` Richard Sandiford
2020-07-01 13:23                           ` Kewen.Lin
2020-07-01 15:17                             ` Richard Sandiford
2020-07-02  5:20                               ` Kewen.Lin
2020-07-07  9:26                                 ` Kewen.Lin
2020-07-07 10:44                                   ` Richard Sandiford
2020-07-08  6:52                                     ` Kewen.Lin
2020-07-08 12:50                                       ` Richard Sandiford
2020-07-10  7:40                                         ` Kewen.Lin
2020-07-07 10:15                                 ` Richard Sandiford
2020-07-08  7:01                                   ` Kewen.Lin [this message]
2020-07-10  9:55                           ` [PATCH 5/7 v7] " Kewen.Lin
2020-07-17  9:54                             ` Richard Sandiford
2020-07-20  2:25                               ` Kewen.Lin
2020-05-26  5:58 ` [PATCH 6/7] ivopts: Add handlings for vector with length IFNs Kewen.Lin
2020-07-22 12:51   ` Richard Sandiford
2020-05-26  5:59 ` [PATCH 7/7] rs6000/testsuite: Vector with length test cases Kewen.Lin
2020-07-10 10:07   ` [PATCH 7/7 v2] " Kewen.Lin
2020-07-20 16:58     ` Segher Boessenkool
2020-07-21  2:53       ` Kewen.Lin
2020-05-26  7:12 ` [PATCH 0/7] Support vector load/store with length Richard Biener
2020-05-26  8:51   ` Kewen.Lin
2020-05-26  9:44     ` Richard Biener
2020-05-26 10:10       ` Kewen.Lin
2020-05-26 12:29         ` Richard Sandiford
2020-05-27  0:09           ` Segher Boessenkool
2020-05-27  7:25             ` Richard Biener
2020-05-27  8:50               ` Kewen.Lin
2020-05-27 14:08               ` Segher Boessenkool
2020-05-26 22:34   ` Jim Wilson
2020-05-27  7:21     ` Richard Biener
2020-05-27  7:46       ` Richard Sandiford

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=261029e7-4d41-3353-95d4-ce8455fa506a@linux.ibm.com \
    --to=linkw@linux.ibm.com \
    --cc=dje.gcc@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=richard.guenther@gmail.com \
    --cc=richard.sandiford@arm.com \
    --cc=segher@kernel.crashing.org \
    --cc=wschmidt@linux.ibm.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).