[PATCH] D149893: Rewrite LSV to handle longer chains.

Artem Belevich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 18 15:57:56 PDT 2023


tra accepted this revision.
tra added a comment.
This revision is now accepted and ready to land.

Tests look OK.



================
Comment at: llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp:285
+  /// Splits the chain into subchains of instructions which read/write a
+  /// contiguous block of memory.  Doesn't return length-1 chains.
+  std::vector<Chain> splitChainByContiguity(Chain &C);
----------------
jlebar wrote:
> tra wrote:
> > This raises more questions:
> > 
> > - What *does* it return if it's given a 1-element chain?
> > - Is it allowed not to split a chain (e.g if it's passed a 2-element chain)?
> > - If it's given a 3-element chain, does it mean that it will return the input unchanged? What if we do want to split the chain. E.g. if we have 3 64-bit loads, for NVPTX it would be optimal to vectorize them into v2i64 and i64.
> > 
> > What *does* it return if it's given a 1-element chain?
> 
> Empty list.
> 
> > Is it allowed not to split a chain (e.g if it's passed a 2-element chain)?
> 
> A two-element chain might or might not be split up, depending on whether the instructions read/write a contiguous block of memory.  If it's split up, then we have two length-one chains.  We do not return length-one chains, so we return the empty list.
> 
> > If it's given a 3-element chain, does it mean that it will return the input unchanged?
> 
> If the three-element chain reads or writes contiguous memory, it will not be split up.  If it does not read/write contiguous memory, it will be split up.
> 
> > What if we do want to split the chain. E.g. if we have 3 64-bit loads, for NVPTX it would be optimal to vectorize them into v2i64 and i64.
> 
> This happens later, splitChainByAlignment.
> If the three-element chain reads or writes contiguous memory, it will not be split up. If it does not read/write contiguous memory, it will be split up.

I don't think it's possible to split 3-elements in a way that would not produce an 1-element part. The only choice is not to split and return an empty or a 3-element chain.

Anyways, I think I see what you mean. I'd prefer to see a description of what we *do* ("does not do X" leaves too much room for guessing, IMO), but I'll leave it up to you.





Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149893/new/

https://reviews.llvm.org/D149893



More information about the llvm-commits mailing list