[Libre-soc-dev] SimdSignal update

lkcl luke.leighton at gmail.com
Thu Oct 28 09:31:54 BST 2021



On October 28, 2021 4:10:14 AM UTC, Jacob Lifshay <programmerjake at gmail.com> wrote:
>On Wed, Oct 27, 2021 at 7:59 PM Jacob Lifshay
><programmerjake at gmail.com> wrote:
>> Yeah, I can work on adding arithmetic to SimdShape, though
>fixed_width should be a hint as outlined in my last email.
>
>Added; didn't change fixed_width to a hint yet till you can review. No
>tests yet.
>
>https://git.libre-soc.org/?p=ieee754fpu.git;a=blob;f=src/ieee754/part/partsig.py;h=d85566dcbe6c4ae8075db16ac7fc89c2be40028e;hb=5e13f1efdcea7a6ea664448f440ec9b19fd14127#l182

ok brilliant.  it's currently unused so is fine to be no tests.

deep breath: the analysis i'm walking through in the wiki page shows that there are a completely mad number of combinations for interaction, here.

*per operator*!

(some of the options will not make sense)

* LHS (self) fixedwidth priority, RHS (other) int
* LHS (self) vec_el_widths priority, RHS (other) int
* LHS (self) both/no priority, RHS (other) int

and that's just the integers!  there is a table containing *nine* (!!) further combinations for the 3options LHS 3options RHS but fortunately they reduce down to only two:

* LHS (self) fixedwidth priority, RHS (other) fixedwidth
* everything else.


for RHS=int, for mul and shift-left the scaling means that, very fortuitously, multiplying fixedwidths and elwidths, they both scale equally (i.e. the multiply factors out) so no problem there.

however for add and subtract that is *not* the case, if you add 3 to an elwidth it is actually 3 TIMES the number of partitions.

therefore, exceptions need to be raised when both fixedwidth and elwidth are given as parameters, explaining that the impossible has been requested.

although it sounds like it's probably a good idea to raise an exception if the amount being added to fixed_width is not divisible by the maximum part_count, i *think* layout() has this covered already.

*gibber*.

this is why a flag is needed in SimdShape (constructor)

FIXED_WIDTH=0b01
ELWIDTH=0b10
if fixed_width is not None:
     self.mode = FIXED_WIDTH
if vec_el_counts is not None
     self.mode |= ELWIDTH

and that mode used in detection of interaction in each operator.

completely mad, i know.

l.



More information about the Libre-soc-dev mailing list