Stephen Fuld <sfu…@alumni.cmu.edu.invalid> schrieb:
> On 11/9/2026 9:08 AM, Stephen Fuld wrote:
>
> I issued the following "challenge".
>
>> I can't speak to the hardware complexity of the implementation. Perhaps
>> that is a limiting factor. But barring that, and the mental effort
>> required to "reorient" your thinking, I don't see why any new clean
>> sheet design would use SIMD instructions. Perhaps someone can explain
>> why it should.
>
> The results were, at least to me, quite enlightening. I think it might
> be useful to summarize these responses. I group the types of problems
> that people thought SIMD was better at than VVM into three areas.
>
> The first group is exemplified by Anton bringing up the types of
> problems where memory values are reused in the vector registers. He
> gave matrix multiplication as an example. Terje presented an algorithm
> which others indicated was competitive with the SIMD method. Note that
> I am not ruling out that there may be other problems that fit into this
> group but aren't amenable to the kind of solution Terje presented. So I
> count that as worst case, a "tie". But so far, not a compelling
> argument for SIMD.
I'm not really sure I understand, then. VVM always has to access
memory at cache latencies (4-5 cycles); register access does not
need that, and clever algorithms can resuse that data to good effect.
> The second group is "reductions" of various types. Mostly, this came
> down to the question of whether the operation on the given data type
> could be parallelized or "reassociated". I think we have come down to
> the following:
>
> For operations on unsigned integers, or on signed integers with certain
> compile options, and operations such as MAX, VVM has the advantage as it
> can parallelize them and, perhaps with some additional design work by
> Mitch, combine the partial results at the end, including handling sizes
> that are not a integer multiple of the amount of parallelization. This
> seems like a big win for VVM.
VVM is always at an advantage when the SINDified and the size of
the hardware SIMD registers is unknown at comile and can leave
all the loop peeling and other assorted nastiness to hardware.
But a four-lane SIMD, for example, could do the same. It would
need a reduction step at the and, as well.
> For operations on signed integers where preserving possible internal
> overflows, etc. are required VVM can't parallelize them (signified by
> specifying 1 in the number of lanes field in the VEC instruction).
That is an interesting question. Today's hardware does two's
complement, so under "as if" rule a compiler could just happily do
the summation in hardware and look at the end result; intermediate
overflows will just be ignored, and as long as the end result fits,
all is in order. A Fortran compiler calculating the SUM
intrinsic could just do that. A C compiler could also do that
if it chose to (and it seems that LLVM choses to do so at least
for the a + b + c + d case).
> But
> there is still a more modest advantage for VVM in that reading the data
> from memory doesn't "scrub" the cache, and the loop termination test is
> a single instruction.
>
> For operations on floating point, with some "not yet filed" stuff, VVM
> has the advantage in that the operation can be parallelized without loss
> of precision.
>
> So overall, for this second group, I see no argument for SIMD.
If VVM can do reductions, yes.
> The third group, and one we really haven't discussed in this thread
> beyond Thomas' first mention is wide permutations. I wasn't familiar
> with the relevant capabilities in AVX512, so I had to do a little
> research. While My 66000 has a permute instruction, and perhaps if
> preceded by a Double instruction modifier can be wider, I don't see how
> it can compete with the 512 byte wide permutation in three cycles
> provided by AVX512, nor the capability to do byte wide permutes where
> the source isn't required to be a 8 bit boundary. So if these kinds of
> operations are used often, then SIMD may be a requirement.
That is what i think, too.
Those cases are not for auto-vectorization, you would have to
write them especially with the special SIMD capabilities in mind.
> Of course, I welcome comments, additions, subtractions (!), etc.
--
This USENET posting was made without artificial intelligence,
artificial impertinence, artificial arrogance, artificial stupidity,
artificial flavorings or artificial colorants.