[libre-riscv-dev] Yehowshua - Interested in open GPU dev

Luke Kenneth Casson Leighton lkcl at lkcl.net
Mon Jan 6 21:29:37 GMT 2020


On 1/6/20, Jacob Lifshay <programmerjake at gmail.com> wrote:
> On Mon, Jan 6, 2020 at 10:16 AM Jacob Lifshay <programmerjake at gmail.com>
> wrote:
>> see https://salsa.debian.org/Kazan-team/simple-soft-float for some
>> reference code I wrote, which should match the IEEE 754 FP standard
>> (it matches Berkeley soft-float for all the cases I tested).
>>
>> simple-soft-float uses RealAlgebraicNumber, which is a type that
>> behaves like an infinitely-precise real number which I used instead of
>> something else since I think that makes the logic easier to
>> understand.
>
> See
> https://docs.rs/simple-soft-float/0.1.0/simple_soft_float/struct.Float.html#method.fused_mul_add
> for the docs for the fused-mul-add implementation.

excellent, going to need that.  could you track down the bugreport for
fmac and throw that in so it's not lost?

yehowshua, here's the PartitionedAdder class:
https://git.libre-riscv.org/?p=ieee754fpu.git;a=blob;f=src/ieee754/part_mul_add/adder.py;h=0c28e6c4be4b6930c227b7614df025fa10399132;hb=a60f0c986284e28b204c1057ba9a501353683449#l108

you can see from the docstring, the partition points (in this unique
case, a trick which may or may not carry over to other __operators__)
are implemented as a carry bit.

the first step will be to create that PartitionedSignal class which
has an __add__ method that literally integrates and takes that
PartitionedAdder class and, combinatorially, just calls it.

exactly how that's done given that Signal cannot at the moment be
derived from (due to whitequark trying to early-optimise through use
of "type", and not properly respect python coding conventions and
warnings *sigh*) can i leave it to you to investigate?

for GE, LT, etc. this same or a similar trick *might* actually work,
given that, ultimately, GE, LT etc. are all based (loosely) around
(subsets of) subtraction.

however for a first iteration, it would be perfectly acceptable to do
something like:

* partitionpoints = Signal(8)
* a,b, output = [Signal(64)]*3
* for i in range(8): o_8ths[i] = a_8ths[i] >= b_8ths[i]
* if partitionpoints[i] and a_8ths[i] == b_8ths[i]: # TODO carry over
comparison to next partition

you get the general idea, i'm sure.  it's quite a neat, self-contained
elegant task.

l.



More information about the libre-riscv-dev mailing list