public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: [PATCH 1/3] Inline vect_get_max_nscalars_per_iter
       [not found] <20230614114802.BED073858288@sourceware.org>
@ 2023-06-14 13:21 ` Richard Sandiford
  2023-06-14 13:46   ` Richard Biener
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Sandiford @ 2023-06-14 13:21 UTC (permalink / raw)
  To: Richard Biener via Gcc-patches; +Cc: Richard Biener

Richard Biener via Gcc-patches <gcc-patches@gcc.gnu.org> writes:
> The function is only meaningful for LOOP_VINFO_MASKS processing so
> inline it into the single use.
>
> Bootstrapped and tested on x86_64-unknown-linux-gnu, OK?
>
> 	* tree-vect-loop.cc (vect_get_max_nscalars_per_iter): Inline
> 	into ...
> 	(vect_verify_full_masking): ... this.

I think we did have a use for the separate function internally,
but obviously it was never submitted.  Personally I'd prefer
to keep things as they are though.



> ---
>  gcc/tree-vect-loop.cc | 22 ++++++----------------
>  1 file changed, 6 insertions(+), 16 deletions(-)
>
> diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
> index ace9e759f5b..a9695e5b25d 100644
> --- a/gcc/tree-vect-loop.cc
> +++ b/gcc/tree-vect-loop.cc
> @@ -1117,20 +1117,6 @@ can_produce_all_loop_masks_p (loop_vec_info loop_vinfo, tree cmp_type)
>    return true;
>  }
>  
> -/* Calculate the maximum number of scalars per iteration for every
> -   rgroup in LOOP_VINFO.  */
> -
> -static unsigned int
> -vect_get_max_nscalars_per_iter (loop_vec_info loop_vinfo)
> -{
> -  unsigned int res = 1;
> -  unsigned int i;
> -  rgroup_controls *rgm;
> -  FOR_EACH_VEC_ELT (LOOP_VINFO_MASKS (loop_vinfo), i, rgm)
> -    res = MAX (res, rgm->max_nscalars_per_iter);
> -  return res;
> -}
> -
>  /* Calculate the minimum precision necessary to represent:
>  
>        MAX_NITERS * FACTOR
> @@ -1210,8 +1196,6 @@ static bool
>  vect_verify_full_masking (loop_vec_info loop_vinfo)
>  {
>    unsigned int min_ni_width;
> -  unsigned int max_nscalars_per_iter
> -    = vect_get_max_nscalars_per_iter (loop_vinfo);
>  
>    /* Use a normal loop if there are no statements that need masking.
>       This only happens in rare degenerate cases: it means that the loop
> @@ -1219,6 +1203,12 @@ vect_verify_full_masking (loop_vec_info loop_vinfo)
>    if (LOOP_VINFO_MASKS (loop_vinfo).is_empty ())
>      return false;
>  
> +  /* Calculate the maximum number of scalars per iteration for every rgroup.  */
> +  unsigned int max_nscalars_per_iter = 1;
> +  for (auto rgm : LOOP_VINFO_MASKS (loop_vinfo))
> +    max_nscalars_per_iter
> +      = MAX (max_nscalars_per_iter, rgm.max_nscalars_per_iter);
> +
>    /* Work out how many bits we need to represent the limit.  */
>    min_ni_width
>      = vect_min_prec_for_max_niters (loop_vinfo, max_nscalars_per_iter);

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/3] Inline vect_get_max_nscalars_per_iter
  2023-06-14 13:21 ` [PATCH 1/3] Inline vect_get_max_nscalars_per_iter Richard Sandiford
@ 2023-06-14 13:46   ` Richard Biener
  2023-06-14 19:43     ` Richard Sandiford
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Biener @ 2023-06-14 13:46 UTC (permalink / raw)
  To: Richard Sandiford; +Cc: Richard Biener via Gcc-patches

On Wed, 14 Jun 2023, Richard Sandiford wrote:

> Richard Biener via Gcc-patches <gcc-patches@gcc.gnu.org> writes:
> > The function is only meaningful for LOOP_VINFO_MASKS processing so
> > inline it into the single use.
> >
> > Bootstrapped and tested on x86_64-unknown-linux-gnu, OK?
> >
> > 	* tree-vect-loop.cc (vect_get_max_nscalars_per_iter): Inline
> > 	into ...
> > 	(vect_verify_full_masking): ... this.
> 
> I think we did have a use for the separate function internally,
> but obviously it was never submitted.  Personally I'd prefer
> to keep things as they are though.

OK - after 3/3 it's no longer "generic" (it wasn't before,
it doesn't inspect the _len groups either), it's only meaningful
for WHILE_ULT style analysis.

> 
> 
> > ---
> >  gcc/tree-vect-loop.cc | 22 ++++++----------------
> >  1 file changed, 6 insertions(+), 16 deletions(-)
> >
> > diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
> > index ace9e759f5b..a9695e5b25d 100644
> > --- a/gcc/tree-vect-loop.cc
> > +++ b/gcc/tree-vect-loop.cc
> > @@ -1117,20 +1117,6 @@ can_produce_all_loop_masks_p (loop_vec_info loop_vinfo, tree cmp_type)
> >    return true;
> >  }
> >  
> > -/* Calculate the maximum number of scalars per iteration for every
> > -   rgroup in LOOP_VINFO.  */
> > -
> > -static unsigned int
> > -vect_get_max_nscalars_per_iter (loop_vec_info loop_vinfo)
> > -{
> > -  unsigned int res = 1;
> > -  unsigned int i;
> > -  rgroup_controls *rgm;
> > -  FOR_EACH_VEC_ELT (LOOP_VINFO_MASKS (loop_vinfo), i, rgm)
> > -    res = MAX (res, rgm->max_nscalars_per_iter);
> > -  return res;
> > -}
> > -
> >  /* Calculate the minimum precision necessary to represent:
> >  
> >        MAX_NITERS * FACTOR
> > @@ -1210,8 +1196,6 @@ static bool
> >  vect_verify_full_masking (loop_vec_info loop_vinfo)
> >  {
> >    unsigned int min_ni_width;
> > -  unsigned int max_nscalars_per_iter
> > -    = vect_get_max_nscalars_per_iter (loop_vinfo);
> >  
> >    /* Use a normal loop if there are no statements that need masking.
> >       This only happens in rare degenerate cases: it means that the loop
> > @@ -1219,6 +1203,12 @@ vect_verify_full_masking (loop_vec_info loop_vinfo)
> >    if (LOOP_VINFO_MASKS (loop_vinfo).is_empty ())
> >      return false;
> >  
> > +  /* Calculate the maximum number of scalars per iteration for every rgroup.  */
> > +  unsigned int max_nscalars_per_iter = 1;
> > +  for (auto rgm : LOOP_VINFO_MASKS (loop_vinfo))
> > +    max_nscalars_per_iter
> > +      = MAX (max_nscalars_per_iter, rgm.max_nscalars_per_iter);
> > +
> >    /* Work out how many bits we need to represent the limit.  */
> >    min_ni_width
> >      = vect_min_prec_for_max_niters (loop_vinfo, max_nscalars_per_iter);
> 

-- 
Richard Biener <rguenther@suse.de>
SUSE Software Solutions Germany GmbH, Frankenstrasse 146, 90461 Nuernberg,
Germany; GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman;
HRB 36809 (AG Nuernberg)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/3] Inline vect_get_max_nscalars_per_iter
  2023-06-14 13:46   ` Richard Biener
@ 2023-06-14 19:43     ` Richard Sandiford
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Sandiford @ 2023-06-14 19:43 UTC (permalink / raw)
  To: Richard Biener; +Cc: Richard Biener via Gcc-patches

Richard Biener <rguenther@suse.de> writes:
> On Wed, 14 Jun 2023, Richard Sandiford wrote:
>
>> Richard Biener via Gcc-patches <gcc-patches@gcc.gnu.org> writes:
>> > The function is only meaningful for LOOP_VINFO_MASKS processing so
>> > inline it into the single use.
>> >
>> > Bootstrapped and tested on x86_64-unknown-linux-gnu, OK?
>> >
>> > 	* tree-vect-loop.cc (vect_get_max_nscalars_per_iter): Inline
>> > 	into ...
>> > 	(vect_verify_full_masking): ... this.
>> 
>> I think we did have a use for the separate function internally,
>> but obviously it was never submitted.  Personally I'd prefer
>> to keep things as they are though.
>
> OK - after 3/3 it's no longer "generic" (it wasn't before,
> it doesn't inspect the _len groups either), it's only meaningful
> for WHILE_ULT style analysis.

Ah, yeah, that's fair.  Sorry, I hadn't seen the rgc_vec/rgc_map
thing when I wrote the above.

So yeah, please go ahead.

Thanks,
Richard

>
>> 
>> 
>> > ---
>> >  gcc/tree-vect-loop.cc | 22 ++++++----------------
>> >  1 file changed, 6 insertions(+), 16 deletions(-)
>> >
>> > diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
>> > index ace9e759f5b..a9695e5b25d 100644
>> > --- a/gcc/tree-vect-loop.cc
>> > +++ b/gcc/tree-vect-loop.cc
>> > @@ -1117,20 +1117,6 @@ can_produce_all_loop_masks_p (loop_vec_info loop_vinfo, tree cmp_type)
>> >    return true;
>> >  }
>> >  
>> > -/* Calculate the maximum number of scalars per iteration for every
>> > -   rgroup in LOOP_VINFO.  */
>> > -
>> > -static unsigned int
>> > -vect_get_max_nscalars_per_iter (loop_vec_info loop_vinfo)
>> > -{
>> > -  unsigned int res = 1;
>> > -  unsigned int i;
>> > -  rgroup_controls *rgm;
>> > -  FOR_EACH_VEC_ELT (LOOP_VINFO_MASKS (loop_vinfo), i, rgm)
>> > -    res = MAX (res, rgm->max_nscalars_per_iter);
>> > -  return res;
>> > -}
>> > -
>> >  /* Calculate the minimum precision necessary to represent:
>> >  
>> >        MAX_NITERS * FACTOR
>> > @@ -1210,8 +1196,6 @@ static bool
>> >  vect_verify_full_masking (loop_vec_info loop_vinfo)
>> >  {
>> >    unsigned int min_ni_width;
>> > -  unsigned int max_nscalars_per_iter
>> > -    = vect_get_max_nscalars_per_iter (loop_vinfo);
>> >  
>> >    /* Use a normal loop if there are no statements that need masking.
>> >       This only happens in rare degenerate cases: it means that the loop
>> > @@ -1219,6 +1203,12 @@ vect_verify_full_masking (loop_vec_info loop_vinfo)
>> >    if (LOOP_VINFO_MASKS (loop_vinfo).is_empty ())
>> >      return false;
>> >  
>> > +  /* Calculate the maximum number of scalars per iteration for every rgroup.  */
>> > +  unsigned int max_nscalars_per_iter = 1;
>> > +  for (auto rgm : LOOP_VINFO_MASKS (loop_vinfo))
>> > +    max_nscalars_per_iter
>> > +      = MAX (max_nscalars_per_iter, rgm.max_nscalars_per_iter);
>> > +
>> >    /* Work out how many bits we need to represent the limit.  */
>> >    min_ni_width
>> >      = vect_min_prec_for_max_niters (loop_vinfo, max_nscalars_per_iter);
>> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/3] Inline vect_get_max_nscalars_per_iter
@ 2023-06-14 11:47 Richard Biener
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Biener @ 2023-06-14 11:47 UTC (permalink / raw)
  To: gcc-patches; +Cc: richard.sandiford

The function is only meaningful for LOOP_VINFO_MASKS processing so
inline it into the single use.

Bootstrapped and tested on x86_64-unknown-linux-gnu, OK?

	* tree-vect-loop.cc (vect_get_max_nscalars_per_iter): Inline
	into ...
	(vect_verify_full_masking): ... this.
---
 gcc/tree-vect-loop.cc | 22 ++++++----------------
 1 file changed, 6 insertions(+), 16 deletions(-)

diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
index ace9e759f5b..a9695e5b25d 100644
--- a/gcc/tree-vect-loop.cc
+++ b/gcc/tree-vect-loop.cc
@@ -1117,20 +1117,6 @@ can_produce_all_loop_masks_p (loop_vec_info loop_vinfo, tree cmp_type)
   return true;
 }
 
-/* Calculate the maximum number of scalars per iteration for every
-   rgroup in LOOP_VINFO.  */
-
-static unsigned int
-vect_get_max_nscalars_per_iter (loop_vec_info loop_vinfo)
-{
-  unsigned int res = 1;
-  unsigned int i;
-  rgroup_controls *rgm;
-  FOR_EACH_VEC_ELT (LOOP_VINFO_MASKS (loop_vinfo), i, rgm)
-    res = MAX (res, rgm->max_nscalars_per_iter);
-  return res;
-}
-
 /* Calculate the minimum precision necessary to represent:
 
       MAX_NITERS * FACTOR
@@ -1210,8 +1196,6 @@ static bool
 vect_verify_full_masking (loop_vec_info loop_vinfo)
 {
   unsigned int min_ni_width;
-  unsigned int max_nscalars_per_iter
-    = vect_get_max_nscalars_per_iter (loop_vinfo);
 
   /* Use a normal loop if there are no statements that need masking.
      This only happens in rare degenerate cases: it means that the loop
@@ -1219,6 +1203,12 @@ vect_verify_full_masking (loop_vec_info loop_vinfo)
   if (LOOP_VINFO_MASKS (loop_vinfo).is_empty ())
     return false;
 
+  /* Calculate the maximum number of scalars per iteration for every rgroup.  */
+  unsigned int max_nscalars_per_iter = 1;
+  for (auto rgm : LOOP_VINFO_MASKS (loop_vinfo))
+    max_nscalars_per_iter
+      = MAX (max_nscalars_per_iter, rgm.max_nscalars_per_iter);
+
   /* Work out how many bits we need to represent the limit.  */
   min_ni_width
     = vect_min_prec_for_max_niters (loop_vinfo, max_nscalars_per_iter);
-- 
2.35.3


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-06-14 19:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20230614114802.BED073858288@sourceware.org>
2023-06-14 13:21 ` [PATCH 1/3] Inline vect_get_max_nscalars_per_iter Richard Sandiford
2023-06-14 13:46   ` Richard Biener
2023-06-14 19:43     ` Richard Sandiford
2023-06-14 11:47 Richard Biener

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).