Sujet : Re: Short Vectors Versus Long Vectors
De : cr88192 (at) *nospam* gmail.com (BGB)
Groupes : comp.archDate : 24. Apr 2024, 00:36:49
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v09gmk$1te49$1@dont-email.me>
References : 1 2 3 4 5 6
User-Agent : Mozilla Thunderbird
On 4/23/2024 5:39 PM, MitchAlsup1 wrote:
BGB wrote:
On 4/23/2024 1:22 AM, Anton Ertl wrote:
Lawrence D'Oliveiro <ldo@nz.invalid> writes:
On Tue, 23 Apr 2024 02:14:32 +0000, MitchAlsup1 wrote:
big snip>
As can be noted, SIMD is easy to implement.
ADD/SUB is, MUL and DIV and SHIFTs and CMPs are not; especially when
MUL does 2n = n × n and DIV does 2n / n -> n (quotient) + n (remainder)
MUL:
Have a few instructions, giving the Low, High-Signed, and High-Unsigned results.
DIV:
Didn't bother with this.
Typically faked using multiply-by-reciprocal and taking the high result.
Something like MOD would need to be faked, but SIMD modulo doesn't really tend to be a thing IME.
Division by a non-constant scalar/vector value will need a runtime call.
SHIFT:
Mostly faked using ALU shifts and masking.
CMPxx:
There are dedicated instructions for this.
Main obvious drawback is the potential for combinatorial explosions of instructions. One needs to keep a fairly careful watch over this.
Like, if one is faced with an NxN or NxM grid of possibilities, naive strategy is to be like "I will define an instruction for every possibility in the grid.", but this is bad. More reasonable to devise a minimal set of instructions that will allow the operation to be done within in a reasonable number of instructions.
But, then again, I can also note that I axed things like packed-byte operations and saturating arithmetic, which are pretty much de-facto in packed-integer SIMD.
MANY SIMD algorithms need saturating arithmetic because they cannot do
b + b -> h and avoid the overflow. And they cannot do B + b -> h because
that would consume vast amounts of encoding space.
There are ways to fake it.
Though, granted, most end up involving extra instructions and 1 bit of dynamic range.
Though, the main case where one can't spare any dynamic range is typically packed byte, which I had skipped (in favor of faking packed-byte scenarios using packed word).
But, could add, say:
PSHAR.W Rm, Rn //Packed Shift right 1 bit, arithmetic
PSHLR.W Rm, Rn //Packed Shift right 1 bit, logical
PSHAL.W Rm, Rn //Packed Shift left 1 bit, arithmetic saturate
PSHLL.W Rm, Rn //Packed Shift left 1 bit, logical saturate
In a naive case, one could fake a virtual PADDSS.W instruction as, say:
PSHAR.W R4, R16
PSHAR.W R5, R17
PADD.W R16, R17, R18
PSHAL.W R18, R2
These could more efficiently address both saturation, and 1-bit shift (the most common case).
Shift left 1-bit (without saturation) can generally be handled with:
PADD.W R4, R4, R2
Or similar.
Likewise, a lot of the gaps are filled in with specialized converter and helper ops. Even here, some conversion chains will require multiple instructions.
Well, and if there is no practical difference between a scalar and SIMD version of an instruction, may well just use the SIMD version for scalar.
....
- anton
Date | Sujet | # | | Auteur |
23 Apr 24 | Short Vectors Versus Long Vectors | 109 | | Lawrence D'Oliveiro |
23 Apr 24 | Re: Short Vectors Versus Long Vectors | 97 | | MitchAlsup1 |
23 Apr 24 | Re: Short Vectors Versus Long Vectors | 21 | | Lawrence D'Oliveiro |
23 Apr 24 | Re: Short Vectors Versus Long Vectors | 15 | | Anton Ertl |
23 Apr 24 | Re: Short Vectors Versus Long Vectors | 3 | | Lawrence D'Oliveiro |
23 Apr 24 | Re: Short Vectors Versus Long Vectors | 1 | | Anton Ertl |
23 Apr 24 | Re: Short Vectors Versus Long Vectors | 1 | | MitchAlsup1 |
23 Apr 24 | Re: Short Vectors Versus Long Vectors | 1 | | MitchAlsup1 |
23 Apr 24 | Re: Short Vectors Versus Long Vectors | 10 | | BGB |
24 Apr 24 | Re: Short Vectors Versus Long Vectors | 9 | | MitchAlsup1 |
24 Apr 24 | Re: Short Vectors Versus Long Vectors | 8 | | BGB |
24 Apr 24 | Re: Short Vectors Versus Long Vectors | 6 | | Lawrence D'Oliveiro |
24 Apr 24 | Re: Short Vectors Versus Long Vectors | 5 | | MitchAlsup1 |
24 Apr 24 | Re: Short Vectors Versus Long Vectors | 2 | | BGB |
24 Apr 24 | Re: Short Vectors Versus Long Vectors | 1 | | Lawrence D'Oliveiro |
24 Apr 24 | Re: Short Vectors Versus Long Vectors | 2 | | Terje Mathisen |
25 Apr 24 | Re: Short Vectors Versus Long Vectors | 1 | | MitchAlsup1 |
24 Apr 24 | Re: Short Vectors Versus Long Vectors | 1 | | MitchAlsup1 |
23 Apr 24 | Re: Short Vectors Versus Long Vectors | 5 | | MitchAlsup1 |
23 Apr 24 | Re: Short Vectors Versus Long Vectors | 4 | | Lawrence D'Oliveiro |
24 Apr 24 | Re: Short Vectors Versus Long Vectors | 3 | | MitchAlsup1 |
24 Apr 24 | Re: Short Vectors Versus Long Vectors | 2 | | Lawrence D'Oliveiro |
24 Apr 24 | Re: Short Vectors Versus Long Vectors | 1 | | MitchAlsup1 |
24 Apr 24 | Re: Short Vectors Versus Long Vectors | 75 | | John Savard |
24 Apr 24 | Re: Short Vectors Versus Long Vectors | 26 | | MitchAlsup1 |
24 Apr 24 | Re: Short Vectors Versus Long Vectors | 23 | | John Savard |
24 Apr 24 | Re: Short Vectors Versus Long Vectors | 2 | | Lawrence D'Oliveiro |
24 Apr 24 | Re: Short Vectors Versus Long Vectors | 1 | | BGB |
24 Apr 24 | Re: Short Vectors Versus Long Vectors | 19 | | Anton Ertl |
25 Apr 24 | Re: Short Vectors Versus Long Vectors | 18 | | Lawrence D'Oliveiro |
25 Apr 24 | Re: Short Vectors Versus Long Vectors | 2 | | Michael S |
27 Apr 24 | Re: Short Vectors Versus Long Vectors | 1 | | Lawrence D'Oliveiro |
25 Apr 24 | Re: Short Vectors Versus Long Vectors | 15 | | John Levine |
25 Apr 24 | Re: Short Vectors Versus Long Vectors | 14 | | MitchAlsup1 |
25 Apr 24 | Re: Short Vectors Versus Long Vectors | 9 | | Michael S |
25 Apr 24 | Re: Short Vectors Versus Long Vectors | 8 | | MitchAlsup1 |
25 Apr 24 | Re: Short Vectors Versus Long Vectors | 7 | | Michael S |
25 Apr 24 | Re: Short Vectors Versus Long Vectors | 6 | | BGB |
27 Apr 24 | Re: Short Vectors Versus Long Vectors | 5 | | Thomas Koenig |
27 Apr 24 | Re: Short Vectors Versus Long Vectors | 3 | | John Levine |
28 Apr 24 | Re: Short Vectors Versus Long Vectors | 2 | | Lawrence D'Oliveiro |
28 Apr 24 | Re: Short Vectors Versus Long Vectors | 1 | | John Levine |
28 Apr 24 | Re: Short Vectors Versus Long Vectors | 1 | | Tim Rentsch |
26 Apr 24 | Re: Short Vectors Versus Long Vectors | 4 | | Lawrence D'Oliveiro |
26 Apr 24 | Re: Short Vectors Versus Long Vectors | 3 | | MitchAlsup1 |
26 Apr 24 | Re: Short Vectors Versus Long Vectors | 2 | | Lawrence D'Oliveiro |
26 Apr 24 | Re: Short Vectors Versus Long Vectors | 1 | | MitchAlsup1 |
24 Apr 24 | Re: Short Vectors Versus Long Vectors | 1 | | David Schultz |
27 Apr 24 | Re: Short Vectors Versus Long Vectors | 2 | | aph |
27 Apr 24 | Re: Short Vectors Versus Long Vectors | 1 | | MitchAlsup1 |
24 Apr 24 | Re: Short Vectors Versus Long Vectors | 2 | | Lawrence D'Oliveiro |
24 Apr 24 | Re: Short Vectors Versus Long Vectors | 1 | | Anton Ertl |
24 Apr 24 | Re: Short Vectors Versus Long Vectors | 1 | | Thomas Koenig |
24 Apr 24 | Re: Short Vectors Versus Long Vectors | 45 | | Anton Ertl |
24 Apr 24 | Re: Short Vectors Versus Long Vectors | 43 | | Lawrence D'Oliveiro |
24 Apr 24 | Re: Short Vectors Versus Long Vectors | 42 | | Anton Ertl |
25 Apr 24 | Re: Short Vectors Versus Long Vectors | 41 | | Lawrence D'Oliveiro |
25 Apr 24 | Re: Short Vectors Versus Long Vectors | 40 | | John Savard |
25 Apr 24 | Re: Short Vectors Versus Long Vectors | 39 | | Lawrence D'Oliveiro |
25 Apr 24 | Re: Short Vectors Versus Long Vectors | 3 | | Michael S |
26 Apr 24 | Re: Short Vectors Versus Long Vectors | 2 | | Lawrence D'Oliveiro |
26 Apr 24 | Re: Short Vectors Versus Long Vectors | 1 | | Michael S |
25 Apr 24 | Re: Short Vectors Versus Long Vectors | 7 | | John Levine |
25 Apr 24 | Re: Short Vectors Versus Long Vectors | 6 | | Thomas Koenig |
29 Apr 24 | Re: Short Vectors Versus Long Vectors | 5 | | George Neuner |
29 Apr 24 | Re: Short Vectors Versus Long Vectors | 3 | | Terje Mathisen |
29 Apr 24 | Re: Short Vectors Versus Long Vectors | 1 | | BGB |
30 Apr 24 | Re: Short Vectors Versus Long Vectors | 1 | | George Neuner |
29 Apr 24 | Re: lotsa power, Short Vectors Versus Long Vectors | 1 | | John Levine |
25 Apr 24 | Re: Short Vectors Versus Long Vectors | 28 | | John Savard |
25 Apr 24 | Re: Short Vectors Versus Long Vectors | 27 | | Thomas Koenig |
25 Apr 24 | Re: lots of juice, Short Vectors Versus Long Vectors | 3 | | John Levine |
27 Apr 24 | Re: lots of juice, Short Vectors Versus Long Vectors | 2 | | Thomas Koenig |
28 Apr 24 | Re: lots of juice, Short Vectors Versus Long Vectors | 1 | | Lawrence D'Oliveiro |
28 Apr 24 | Re: Short Vectors Versus Long Vectors | 23 | | Tim Rentsch |
30 Apr 24 | Re: Short Vectors Versus Long Vectors | 22 | | Thomas Koenig |
30 Apr 24 | Re: old power, Short Vectors Versus Long Vectors | 19 | | John Levine |
30 Apr 24 | Re: old power, Short Vectors Versus Long Vectors | 18 | | Lawrence D'Oliveiro |
1 May 24 | Re: old power, Short Vectors Versus Long Vectors | 17 | | John Levine |
1 May 24 | Re: old power, Short Vectors Versus Long Vectors | 1 | | MitchAlsup1 |
2 May 24 | Re: old power, Short Vectors Versus Long Vectors | 15 | | BGB |
2 May 24 | Re: old power, Short Vectors Versus Long Vectors | 14 | | MitchAlsup1 |
3 May 24 | Re: old power, Short Vectors Versus Long Vectors | 1 | | BGB |
3 May 24 | Re: old power, Short Vectors Versus Long Vectors | 12 | | Lawrence D'Oliveiro |
3 May 24 | Re: old power, Short Vectors Versus Long Vectors | 11 | | BGB |
4 May 24 | Re: old power, Short Vectors Versus Long Vectors | 10 | | MitchAlsup1 |
5 May 24 | Re: old power, Short Vectors Versus Long Vectors | 4 | | Thomas Koenig |
5 May 24 | Re: old power, Short Vectors Versus Long Vectors | 1 | | BGB |
5 May 24 | Re: old power, Short Vectors Versus Long Vectors | 2 | | MitchAlsup1 |
5 May 24 | Re: old power, Short Vectors Versus Long Vectors | 1 | | BGB |
5 May 24 | Re: old power, Short Vectors Versus Long Vectors | 2 | | BGB |
5 May 24 | Re: old power, Short Vectors Versus Long Vectors | 1 | | MitchAlsup1 |
6 May 24 | Re: not even sort of old power, Short Vectors Versus Long Vectors | 3 | | John Levine |
6 May 24 | Re: not even sort of old power, Short Vectors Versus Long Vectors | 1 | | MitchAlsup1 |
6 May 24 | Re: not even sort of old power, Short Vectors Versus Long Vectors | 1 | | Thomas Koenig |
1 May 24 | Re: Short Vectors Versus Long Vectors | 2 | | Tim Rentsch |
1 May 24 | Re: Short Vectors Versus Long Vectors | 1 | | Thomas Koenig |
24 Apr 24 | Re: Short Vectors Versus Long Vectors | 1 | | MitchAlsup1 |
30 Apr 24 | Re: Short Vectors Versus Long Vectors | 11 | | MitchAlsup1 |
30 Apr 24 | Re: Short Vectors Versus Long Vectors | 1 | | MitchAlsup1 |
1 May 24 | Re: Short Vectors Versus Long Vectors | 9 | | Lawrence D'Oliveiro |