[PATCH] D111529: Specify Clang vector builtins.

Florian Hahn via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 18 05:18:42 PDT 2021


fhahn marked 2 inline comments as done.
fhahn added inline comments.


================
Comment at: clang/docs/LanguageExtensions.rst:553
+Each builtin returns a scalar equivalent to applying the specified
+operation(x, y) as horizontal recursive pairwise reduction to all vector
+elements. In each reduction step, ``operation(x, y)`` is applied to adjacent
----------------
kparzysz wrote:
> It's really not clear what "horizontal recursive pairwise" means unless one has read the mailing list discussions.  Maybe you could spell it out, e.g. "recursive even-odd pairwise reduction" or something like that.
Thanks, I used that wording!


================
Comment at: clang/docs/LanguageExtensions.rst:552
+operation(x, y) as pairwise tree reduction to the input. The pairs are formed
+by concatenating both inputs and pairing adjacent elements.
+
----------------
craig.topper wrote:
> fhahn wrote:
> > craig.topper wrote:
> > > scanon wrote:
> > > > fhahn wrote:
> > > > > craig.topper wrote:
> > > > > > I'm not sure I understand what is being concatenated here.
> > > > > I tried to spell it out more clearly. I'm still not sure if that spells it out as clearly as possibly and I'd appreciate any suggestions on how to improve the wording.
> > > > It's unclear because there's no apparent "first" or "second" vector; there's just a single argument, and the result isn't a vector, it's a scalar. I think you want to say something like: "the operation is repeatedly applied to adjacent pairs of elements until the result is a scalar" and then provide a worked example.
> > > The input is a single vector. I'm not understanding where we get a second vector to concatenate.
> > Oh yes, now I see where the confusion was coming from. I was thinking about the reduction tree and how the input is broken up. Sorry for the confusing wording. I gave it another try, should be much simpler again now.
> Should it somehow mention the pair is the even element `i` and the odd element `i+1`. There are n-1 adjacent pairs in an n element vector, but we want non-overlapping pairs.
> 
> Should probably spell out the non-power2 behavior. Presumably we pad identity elements after the last element to widen the vector out to a power 2 and then proceed normally?
> Should it somehow mention the pair is the even element i and the odd element i+1. There are n-1 adjacent pairs in an n element vector, but we want non-overlapping pairs.

Thanks, I tried to update the wording to make it clear that it operates on even-odd non-overlapping pairs.


> Should probably spell out the non-power2 behavior. Presumably we pad identity elements after the last element to widen the vector out to a power 2 and then proceed normally?

Good point, done!

>  I think you want to say something like: "the operation is repeatedly applied to adjacent pairs of elements until the result is a scalar" and then provide a worked example.

Used and added an example.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111529



More information about the cfe-commits mailing list