Re: [PATCH v2] testsuite: Update some vect cases for partial vectors
Hi Richard, > >> +# Return true if loops using partial vectors are supported but only for >> loops >> +# whose need to iterate can be removed, that is, value of >> +# param_vect_partial_vector_usage is set to 1. > > For these comments, I think it would be good to use the sourcebuild.texi > wording, but with: > > Return true if the target supports … > > instead of just “Target supports …”. > > OK with those changes, thanks. > Thanks for your review! I updated it as your comments and committed in r11-2943. BR, Kewen
Re: [PATCH v2] testsuite: Update some vect cases for partial vectors
"Kewen.Lin" writes: > Hi Richard, > >>> Yeah, the comments were confusing, its intent is to check which targets >>> support partial vectors and which usage to be used. >>> >>> How about to update them like: >>> >>> "Return true if loops using partial vectors are supported and usage kind is >>> 1/2". >> >> I wasn't really commenting on the comment so much as the intent. >> It should be possible to run the testsuite with: >> >> --target_board unix/--param=vect-partial-vector-usage=1 >> >> and get the right results. >> E.g. maybe use check_compile to run gcc with “-Q --help=params” and an arbitrary output type (probably assembly). Then use “regexp” on the lines to parse the --param=vect-partial-vector-usage value. At that point it would be worth caching the result. >>> >>> Now the default value of this parameter is 2, even for those targets which >>> don't have the supports with partial vectors. Since we will get the value >>> 2 on those unsupported targets, it looks like we have to set it manually? >> >> I think that just means we want: >> >> vect_len_load_store >> the len_load_store equivalent of vect_fully_masked, i.e. whether >> the target supports len load/store (regardless of whether the >> --param enables it) >> >> vect_partial_vectors >> (vect_fully_masked || vect_len_load_store) && param != 0 >> >> vect_partial_vectors_usage_1 >> (vect_fully_masked || vect_len_load_store) && param == 1 >> >> vect_partial_vectors_usage_2 >> (vect_fully_masked || vect_len_load_store) && param == 2 >> > > Thanks for the clarification! > > Sorry for the late update, this new version depends on the --help= patch, > I held it for a while. > > Bootstrapped/regtested on powerpc64le-linux-gnu P9, with/without any > explicit usage setting, it also works well with --target_board > unix/--param=vect-partial-vector-usage=1. > > By the way, for the testing on usage 1, it needs the function > check_effective_target_vect_len_load_store to return true for Power9, > this part will be sent for review separately. Gah, sorry for the slow reply. Thought I'd already reviewed this, but just realised I hadn't. > diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi > index 9f37ac26241..2290af5812d 100644 > --- a/gcc/doc/sourcebuild.texi > +++ b/gcc/doc/sourcebuild.texi > @@ -1689,6 +1689,19 @@ Target supports AND, IOR and XOR reduction on vectors. > > @item vect_fold_extract_last > Target supports the @code{fold_extract_last} optab. > + > +@item vect_len_load_store > +Target supports loops using length-based partial vectors. Probably easiest to talk in terms of internals, so: Target supports the @code{len_load} and @code{len_store} optabs. > +@item vect_partial_vectors_usage_1 > +Target supports loops using partial vectors but only for those loops whose > need > +to iterate can be removed. Here too I think it might be better to talk in terms of existing features and flags, so: Target supports loop vectorization with partial vectors and @code{vect-partial-vector-usage} is set to 1. > +@item vect_partial_vectors_usage_2 > +Target supports loops using partial vectors and for all loops. Similarly here for 2. > + > +@item vect_partial_vectors > +Target supports loops using partial vectors. For this one, probably: Target supports loop vectorization with partial vectors and @code{vect-partial-vector-usage} is nonzero. > diff --git a/gcc/testsuite/gcc.dg/vect/slp-multitypes-11.c > b/gcc/testsuite/gcc.dg/vect/slp-multitypes-11.c > index 5200ed1cd94..d6b0604db78 100644 > --- a/gcc/testsuite/gcc.dg/vect/slp-multitypes-11.c > +++ b/gcc/testsuite/gcc.dg/vect/slp-multitypes-11.c > @@ -49,5 +49,7 @@ int main (void) > } > > /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target > vect_unpack } } } */ > -/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" > { target vect_unpack xfail { vect_variable_length && vect_load_lanes } } } } > */ > +/* The epilogues are vectorized using partial vectors. */ > +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" > { target { vect_unpack && {! vect_partial_vectors_usage_1 } } xfail { > vect_variable_length && vect_load_lanes } } } } */ > +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" > { target { vect_unpack && { vect_partial_vectors_usage_1 } } xfail { > vect_variable_length && vect_load_lanes } } } } */ No need for the braces around vect_partial_vectors_usage_1 when it's not negated. Same for later tests. > +# Return true if loops using partial vectors are supported but only for loops > +# whose need to iterate can be removed, that is, value of > +# param_vect_partial_vector_usage is set to 1. For these comments, I think it would be good to use the sourcebuild.texi wording, but with: Return true if the target supports … instead of just “Target supports …”. OK with those changes, thanks. Richard
[PATCH v2] testsuite: Update some vect cases for partial vectors
Hi Richard, >> Yeah, the comments were confusing, its intent is to check which targets >> support partial vectors and which usage to be used. >> >> How about to update them like: >> >> "Return true if loops using partial vectors are supported and usage kind is >> 1/2". > > I wasn't really commenting on the comment so much as the intent. > It should be possible to run the testsuite with: > > --target_board unix/--param=vect-partial-vector-usage=1 > > and get the right results. > >>> E.g. maybe use check_compile to run gcc with “-Q --help=params” and an >>> arbitrary output type (probably assembly). Then use “regexp” on the >>> lines to parse the --param=vect-partial-vector-usage value. At that >>> point it would be worth caching the result. >> >> Now the default value of this parameter is 2, even for those targets which >> don't have the supports with partial vectors. Since we will get the value >> 2 on those unsupported targets, it looks like we have to set it manually? > > I think that just means we want: > > vect_len_load_store > the len_load_store equivalent of vect_fully_masked, i.e. whether > the target supports len load/store (regardless of whether the > --param enables it) > > vect_partial_vectors > (vect_fully_masked || vect_len_load_store) && param != 0 > > vect_partial_vectors_usage_1 > (vect_fully_masked || vect_len_load_store) && param == 1 > > vect_partial_vectors_usage_2 > (vect_fully_masked || vect_len_load_store) && param == 2 > Thanks for the clarification! Sorry for the late update, this new version depends on the --help= patch, I held it for a while. Bootstrapped/regtested on powerpc64le-linux-gnu P9, with/without any explicit usage setting, it also works well with --target_board unix/--param=vect-partial-vector-usage=1. By the way, for the testing on usage 1, it needs the function check_effective_target_vect_len_load_store to return true for Power9, this part will be sent for review separately. Is it ok for trunk? BR, Kewen - gcc/ChangeLog: * doc/sourcebuild.texi (vect_len_load_store, vect_partial_vectors_usage_1, vect_partial_vectors_usage_2, vect_partial_vectors): Document. gcc/testsuite/ChangeLog: * gcc.dg/vect/bb-slp-pr69907.c: Adjust for partial vector usages. * gcc.dg/vect/slp-3.c: Likewise. * gcc.dg/vect/slp-multitypes-11.c: Likewise. * gcc.dg/vect/slp-perm-1.c: Likewise. * gcc.dg/vect/slp-perm-5.c: Likewise. * gcc.dg/vect/slp-perm-6.c: Likewise. * gcc.dg/vect/slp-perm-7.c: Likewise. * gcc.dg/vect/slp-perm-8.c: Likewise. * gcc.dg/vect/slp-perm-9.c: Likewise. * gcc.dg/vect/vect-version-2.c: Likewise. * lib/target-supports.exp (check_vect_partial_vector_usage): New function. (check_effective_target_vect_len_load_store): Likewise. (check_effective_target_vect_partial_vectors_usage_1): Likewise. (check_effective_target_vect_partial_vectors_usage_2): Likewise. (check_effective_target_vect_partial_vectors): Likewise. diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi index 9f37ac26241..2290af5812d 100644 --- a/gcc/doc/sourcebuild.texi +++ b/gcc/doc/sourcebuild.texi @@ -1689,6 +1689,19 @@ Target supports AND, IOR and XOR reduction on vectors. @item vect_fold_extract_last Target supports the @code{fold_extract_last} optab. + +@item vect_len_load_store +Target supports loops using length-based partial vectors. + +@item vect_partial_vectors_usage_1 +Target supports loops using partial vectors but only for those loops whose need +to iterate can be removed. + +@item vect_partial_vectors_usage_2 +Target supports loops using partial vectors and for all loops. + +@item vect_partial_vectors +Target supports loops using partial vectors. @end table @subsubsection Thread Local Storage attributes diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr69907.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr69907.c index fe52d18525a..b348526b62f 100644 --- a/gcc/testsuite/gcc.dg/vect/bb-slp-pr69907.c +++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pr69907.c @@ -1,5 +1,7 @@ /* { dg-do compile } */ -/* { dg-additional-options "-O3" } */ +/* Disable for vectorization using partial vectors since it would have only + one iteration left, consequently BB vectorization won't happen. */ +/* { dg-additional-options "-O3 --param=vect-partial-vector-usage=0" } */ /* { dg-require-effective-target vect_unpack } */ #include "tree-vect.h" diff --git a/gcc/testsuite/gcc.dg/vect/slp-3.c b/gcc/testsuite/gcc.dg/vect/slp-3.c index 5e40499ff96..46ab584419a 100644 --- a/gcc/testsuite/gcc.dg/vect/slp-3.c +++ b/gcc/testsuite/gcc.dg/vect/slp-3.c @@ -141,8 +141,8 @@ int main (void) return 0; } -/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" { target { ! vect_fully_masked } } } } */ -/* { dg-final { scan-tree-dump-times "vectorized 4 loops" 1 "vect" { target vect_fully_masked } } } */ -/* { dg-final {