Libre RISC-V Mailing list Archives (accessible via public-inbox)
 help / color / Atom feed
* [libre-riscv-dev] [Bug 208] implement CORDIC in a general way sufficient to do transcendentals
From: bugzilla-daemon @ 2020-05-05 16:28 UTC (permalink / raw)
  To: libre-riscv-dev
In-Reply-To: <bug-208-13@https.bugs.libre-soc.org/>

https://bugs.libre-soc.org/show_bug.cgi?id=208

--- Comment #52 from Michael Nolan <mtnolan2640@gmail.com> ---
(In reply to Luke Kenneth Casson Leighton from comment #50)
> btw 12 stages is too many, because we need a minimum of one FunctionUnit
> "managing" (matching up) source operands and results.
> 
> each extra Function Unit added creates an Order N^2 increase in the overall
> size of the Dependency Matrices.
> 
> so - and i don't mean right now - if this can be either:
> 
> * cut into two separate pipelines (partial data fed back as a micro-op)
> * number of combinatorial blocks increased to 5 or 6
> 
> we stand a chance of keeping the FU count down (8 is ok).
> 
> have to think that through carefully, how to do micro-ops.

Sure. I don't know about splitting it up into multiple uops, but reducing the
number of stages is pretty easy. I added a parameter to the module called
rounds_per_stage which governs how many cordic rounds go in each pipeline
stage. Increasing that number will decrease the number of pipeline stages. 

(In reply to Luke Kenneth Casson Leighton from comment #51)
> the other option:
> 
> keep the long pipeline lengths: we *know* that there's more stages than
> there are FUs, and that's just "tough luck".  we know that with only
> 8 FUs and 12 pipeline stages, 4 of those at any one time will run
> empty, and we just... live with that.

I was going to ask if we could do something like this. Since I don't think the
cordic will be used *that* often, this seems like a reasonable thing to do.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev

^ permalink raw reply

* Re: [libre-riscv-dev] Finished Scoreboard
From: Luke Kenneth Casson Leighton @ 2020-05-05 16:26 UTC (permalink / raw)
  To: Yehowshua; +Cc: Libre-RISCV General Development
In-Reply-To: <74E24B62-C4E6-4F95-88AC-DE45C5117D88@gatech.edu>

On Tue, May 5, 2020 at 5:15 PM Yehowshua <yimmanuel3@gatech.edu> wrote:
>
> Do you think the scoreboard can be done by mid June?

i'm assuming you meant to ask this on the list.

the actual scoreboard (dependency matrices) themselves are "done".  it
was only the change to multi-signal control at the register file that
needed alteration, and *that* was done several weeks ago (didn't take
long).

it's the "arbitration" connectivity to the register file (3 days
design work on the cyclic buffer system), the LDSTCompUnit (10 days
redesign, 2-3 days implementing, the change to the ALU CompUnit (8
days redesign, 2-3 days implementing) that is the time-sink.

the next phase is to create a POWER9 "Condition" Register File
containing CR0-CR7, CTR and other essential registers related to
Branch Control.  this *extra register file* was the primary motivation
behind the additional scoreboard read/write "operand" wires, because
one set manages the INT/FP regfile, another set manages the "Condition
Register" regfile (oh, and another set - with a completely different
DM Matrix - manages the SPRs.

which is why we need people to focus on "ancillary" tasks because
without people focussing on ancillary tasks, we're not going to have
instructions completed, the pipelines designed, the memory interface
completed, no Branch Prediction Unit, no TLB, no RADIX MMU.

hence the urgency of asking people to focus on specific tasks, and not
anything else.

the amount that we have to do in such a short amount of time is
enormous, and we need to bash through it, without wasting *any* time.

l.

_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev

^ permalink raw reply

* [libre-riscv-dev] [Bug 208] implement CORDIC in a general way sufficient to do transcendentals
From: bugzilla-daemon @ 2020-05-05 16:16 UTC (permalink / raw)
  To: libre-riscv-dev
In-Reply-To: <bug-208-13@https.bugs.libre-soc.org/>

https://bugs.libre-soc.org/show_bug.cgi?id=208

--- Comment #51 from Luke Kenneth Casson Leighton <lkcl@lkcl.net> ---
the other option:

keep the long pipeline lengths: we *know* that there's more stages than
there are FUs, and that's just "tough luck".  we know that with only
8 FUs and 12 pipeline stages, 4 of those at any one time will run
empty, and we just... live with that.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev

^ permalink raw reply

* [libre-riscv-dev] [Bug 301] New: design a micro-op subsystem that works with scoreboards
From: bugzilla-daemon @ 2020-05-05 16:14 UTC (permalink / raw)
  To: libre-riscv-dev

https://bugs.libre-soc.org/show_bug.cgi?id=301

            Bug ID: 301
           Summary: design a micro-op subsystem that works with
                    scoreboards
           Product: Libre-SOC's first SoC
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: CONFIRMED
          Severity: enhancement
          Priority: ---
         Component: Source Code
          Assignee: lkcl@lkcl.net
          Reporter: lkcl@lkcl.net
                CC: libre-riscv-dev@lists.libre-riscv.org
   NLnet milestone: ---

we need to be able to split some operations that would otherwise take too
long, blocking other operations from completing or worse requiring a
significant
increase in the number of Function Units.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev

^ permalink raw reply

* [libre-riscv-dev] [Bug 208] implement CORDIC in a general way sufficient to do transcendentals
From: bugzilla-daemon @ 2020-05-05 16:12 UTC (permalink / raw)
  To: libre-riscv-dev
In-Reply-To: <bug-208-13@https.bugs.libre-soc.org/>

https://bugs.libre-soc.org/show_bug.cgi?id=208

--- Comment #50 from Luke Kenneth Casson Leighton <lkcl@lkcl.net> ---
btw 12 stages is too many, because we need a minimum of one FunctionUnit
"managing" (matching up) source operands and results.

each extra Function Unit added creates an Order N^2 increase in the overall
size of the Dependency Matrices.

so - and i don't mean right now - if this can be either:

* cut into two separate pipelines (partial data fed back as a micro-op)
* number of combinatorial blocks increased to 5 or 6

we stand a chance of keeping the FU count down (8 is ok).

have to think that through carefully, how to do micro-ops.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev

^ permalink raw reply

* [libre-riscv-dev] [Bug 208] implement CORDIC in a general way sufficient to do transcendentals
From: bugzilla-daemon @ 2020-05-05 16:03 UTC (permalink / raw)
  To: libre-riscv-dev
In-Reply-To: <bug-208-13@https.bugs.libre-soc.org/>

https://bugs.libre-soc.org/show_bug.cgi?id=208

--- Comment #49 from Luke Kenneth Casson Leighton <lkcl@lkcl.net> ---
(In reply to Michael Nolan from comment #39)
> (In reply to Luke Kenneth Casson Leighton from comment #37)
> > ah excellent!  you did a FSM-based version as well, that's superb.
> > if the pipelined version turns out to be insanely gate-hungry, or
> > just not that important, we can use it.
> 
> Ooof, yeah. Running synthesis on the 32 bit pipelined version (4 cordic
> rounds per pipeline stage) gives somewhere around 77k gates.

uh-huhn :)

so you see why i thought it might be a teeeny tiny bit of a good idea
to make it as general-purpose as possible?  used for a batch of
operations not just SIN/COS.

and why most GPUs have a massive concerted effort to shrink transcendentals
as much as possible.

Mitch's patents (bought by Samsung) actually use... what is it...
they use cubic equations, which is extremely efficient and, more than
that, accurate to >1.0 ULP (unit in last place) for the majority
of FP32 operations.

he gets about a quarter of the gate count of other SIN/COS hard macros.

if the gate count is too massive for FP64, we may *have* to use the
FSM-based version for FP64.  the priority as a GPU is on FP32.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev

^ permalink raw reply

* [libre-riscv-dev] [Bug 208] implement CORDIC in a general way sufficient to do transcendentals
From: bugzilla-daemon @ 2020-05-05 15:13 UTC (permalink / raw)
  To: libre-riscv-dev
In-Reply-To: <bug-208-13@https.bugs.libre-soc.org/>

https://bugs.libre-soc.org/show_bug.cgi?id=208

--- Comment #48 from Michael Nolan <mtnolan2640@gmail.com> ---
(In reply to Luke Kenneth Casson Leighton from comment #46)

> 
> oh sorry.  nmutil.

Ok!

(In reply to Luke Kenneth Casson Leighton from comment #47)
> (In reply to Michael Nolan from comment #45)
> 
> > Aha! pipe_data.py has the following:
> > 
> >     def __iter__(self):
> >         yield from self.x
> >         yield from self.y
> >         yield from self.ctx
> > 
> > I'll try changing those to yields and see if that works
> 
> done already.  git pull.  sorry! :)

Yep, saw that after I posted my comment :P

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev

^ permalink raw reply

* [libre-riscv-dev] [Bug 208] implement CORDIC in a general way sufficient to do transcendentals
From: bugzilla-daemon @ 2020-05-05 15:10 UTC (permalink / raw)
  To: libre-riscv-dev
In-Reply-To: <bug-208-13@https.bugs.libre-soc.org/>

https://bugs.libre-soc.org/show_bug.cgi?id=208

--- Comment #47 from Luke Kenneth Casson Leighton <lkcl@lkcl.net> ---
(In reply to Michael Nolan from comment #45)

> Aha! pipe_data.py has the following:
> 
>     def __iter__(self):
>         yield from self.x
>         yield from self.y
>         yield from self.ctx
> 
> I'll try changing those to yields and see if that works

done already.  git pull.  sorry! :)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev

^ permalink raw reply

* [libre-riscv-dev] [Bug 208] implement CORDIC in a general way sufficient to do transcendentals
From: bugzilla-daemon @ 2020-05-05 15:10 UTC (permalink / raw)
  To: libre-riscv-dev
In-Reply-To: <bug-208-13@https.bugs.libre-soc.org/>

https://bugs.libre-soc.org/show_bug.cgi?id=208

--- Comment #46 from Luke Kenneth Casson Leighton <lkcl@lkcl.net> ---
(In reply to Michael Nolan from comment #43)
> (In reply to Luke Kenneth Casson Leighton from comment #41)
> > 
> > yes.  an "Op".  this is what the "Op" field is for... see... ahh.. 1sec...
> > DivPipeCoreConfig and DivPipeCoreOperation (etc.)
> > 
> Ok 
> > 
> > it's actually really important to conform to this API because it's where
> > the "cancellation", identifier information etc. critically necessary for
> > the use of the pipeline in the scoreboard system is all placed.
> 
> Oh hold on, I thought that cancellation bit was for the pipeline to produce
> a result early. Since the cordic doesn't do that, I left it out. It sounds
> like I need to add that back in huh?

yyup :)

all operations need to be "cancellable" by way of a globally-broadcast
mask, equal in width to the number of Concurrent Computation Unit "front-ends".
see https://libre-soc.org/3d_gpu/architecture/6600scoreboard/

"Concurrent Computation Unit" diagram (which is from Mitch's Scoreboard
Mechanics, 2nd chapter).

so there will be... how many FP stages? 8? eek!  12! :) so we will need
*TWELVE* Function Unit front-ends, one to manage and track every single
result, and "re-match" that result *BACK* to the FU when it pops out.

now, we _could_ not have cancellation.  we could instead do this:

* let the result come out and when it arrives, throw it away.

  this means we have a Function Unit completely wasted, blocked and
  unusable for up to 12 cycles

* create a complex "ID" system (at least double the number of FU frontends)

  not a big fan of this method.  a counter wraps around, the ID associated
  with "new" requests, and is cleared to zero if the result is not to
  be put into the result FU buffer.


the simpler way is: have an unary "broadcast" mask that goes right the
way through the whole pipeline (one bit per "FU") and we just... simply...
pull that bit.

result dies.

FunctionUnit can rest.

job done.


so yes, you'll need to put that back in.  by conforming to the API,
you should *NOT* have to worry about whether the data is cancelled or
not, because the "MaskCancellable" Pipeline Mix-In class takes care
of that *automatically*.

but.

if FPPipeContext is *not used*... that is *not possible to do*.


> 
> > 
> > can you do that move?  the unit test as well.
> 
> Sorry, you mentioned nmutil and never said which place you thought it should
> go. nmutil or fpcommon?

oh sorry.  nmutil.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev

^ permalink raw reply

* [libre-riscv-dev] [Bug 208] implement CORDIC in a general way sufficient to do transcendentals
From: bugzilla-daemon @ 2020-05-05 15:00 UTC (permalink / raw)
  To: libre-riscv-dev
In-Reply-To: <bug-208-13@https.bugs.libre-soc.org/>

https://bugs.libre-soc.org/show_bug.cgi?id=208

--- Comment #45 from Michael Nolan <mtnolan2640@gmail.com> ---
(In reply to Luke Kenneth Casson Leighton from comment #42)
> 
> yep it means that in the data_i or data_o you've missed a "yield from"
> and used "yield" instead.  or vice-versa.
> 
> "yield from x" would iterate *through x* and that tells nmigen "please
> return slices of single-bits of x".
> 
> i'll take a look

Aha! pipe_data.py has the following:

    def __iter__(self):
        yield from self.x
        yield from self.y
        yield from self.ctx

I'll try changing those to yields and see if that works

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev

^ permalink raw reply

* [libre-riscv-dev] [Bug 208] implement CORDIC in a general way sufficient to do transcendentals
From: bugzilla-daemon @ 2020-05-05 15:00 UTC (permalink / raw)
  To: libre-riscv-dev
In-Reply-To: <bug-208-13@https.bugs.libre-soc.org/>

https://bugs.libre-soc.org/show_bug.cgi?id=208

--- Comment #44 from Luke Kenneth Casson Leighton <lkcl@lkcl.net> ---
found it.  the code was doing exactly as you'd asked: walking through
self.x and self.y by iteration.

"yield from" will treat the object *as* an iterator, returning calls
to object.__iter__() and returning those objects in sequence, as
*MULTIPLE* results.

"yield" will return the OBJECT - once and only once as *THE* (one and
only) result.

if the Signal did not have an __iter__ function, you would have got an
error.


diff --git a/src/ieee754/cordic/pipe_data.py b/src/ieee754/cordic/pipe_data.py
index c3f600a..d83dbe7 100644
--- a/src/ieee754/cordic/pipe_data.py
+++ b/src/ieee754/cordic/pipe_data.py
@@ -28,8 +28,8 @@ class CordicOutputData:
         self.muxid = self.ctx.muxid

     def __iter__(self):
-        yield from self.x
-        yield from self.y
+        yield self.x
+        yield self.y
         yield from self.ctx

     def eq(self, i):

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev

^ permalink raw reply

* [libre-riscv-dev] [Bug 208] implement CORDIC in a general way sufficient to do transcendentals
From: bugzilla-daemon @ 2020-05-05 14:58 UTC (permalink / raw)
  To: libre-riscv-dev
In-Reply-To: <bug-208-13@https.bugs.libre-soc.org/>

https://bugs.libre-soc.org/show_bug.cgi?id=208

--- Comment #43 from Michael Nolan <mtnolan2640@gmail.com> ---
(In reply to Luke Kenneth Casson Leighton from comment #41)
> 
> yes.  an "Op".  this is what the "Op" field is for... see... ahh.. 1sec...
> DivPipeCoreConfig and DivPipeCoreOperation (etc.)
> 
Ok 
> 
> it's actually really important to conform to this API because it's where
> the "cancellation", identifier information etc. critically necessary for
> the use of the pipeline in the scoreboard system is all placed.

Oh hold on, I thought that cancellation bit was for the pipeline to produce a
result early. Since the cordic doesn't do that, I left it out. It sounds like I
need to add that back in huh?

> 
> can you do that move?  the unit test as well.

Sorry, you mentioned nmutil and never said which place you thought it should
go. nmutil or fpcommon?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev

^ permalink raw reply

* [libre-riscv-dev] [Bug 208] implement CORDIC in a general way sufficient to do transcendentals
From: bugzilla-daemon @ 2020-05-05 14:55 UTC (permalink / raw)
  To: libre-riscv-dev
In-Reply-To: <bug-208-13@https.bugs.libre-soc.org/>

https://bugs.libre-soc.org/show_bug.cgi?id=208

--- Comment #42 from Luke Kenneth Casson Leighton <lkcl@lkcl.net> ---
(In reply to Michael Nolan from comment #40)
> Luke, your latest commit (74af221) breaks the tests for the pipelined fpsin:

yep i commented it out for now (and explained why!)

> ======================================================================
> ERROR: test_rand (__main__.SinCosTestCase)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "test_fp_pipe.py", line 80, in test_rand
>     self.run_test(iter(inputs), outputs=iter(outputs))
>   File "test_fp_pipe.py", line 21, in run_test
>     vl = rtlil.convert(dut, ports=dut.ports())
>   File
> "/home/mnolan/.local/lib/python3.8/site-packages/nmigen/back/rtlil.py", line
> 1017, in convert
>     fragment = ir.Fragment.get(elaboratable, platform).prepare(**kwargs)
>   File "/home/mnolan/.local/lib/python3.8/site-packages/nmigen/hdl/ir.py",
> line 540, in prepare
>     raise TypeError("Only signals may be added as ports, not {!r}"
> TypeError: Only signals may be added as ports, not (slice (sig x) 0:1)
> 
> It looks like dut.ports() is returning a bunch of slices for the output
> signals and I'm not sure why:

yep it means that in the data_i or data_o you've missed a "yield from"
and used "yield" instead.  or vice-versa.

"yield from x" would iterate *through x* and that tells nmigen "please
return slices of single-bits of x".

i'll take a look

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev

^ permalink raw reply

* [libre-riscv-dev] [Bug 208] implement CORDIC in a general way sufficient to do transcendentals
From: bugzilla-daemon @ 2020-05-05 14:53 UTC (permalink / raw)
  To: libre-riscv-dev
In-Reply-To: <bug-208-13@https.bugs.libre-soc.org/>

https://bugs.libre-soc.org/show_bug.cgi?id=208

--- Comment #41 from Luke Kenneth Casson Leighton <lkcl@lkcl.net> ---
(In reply to Michael Nolan from comment #38)
> (In reply to Luke Kenneth Casson Leighton from comment #36)
> > 
> > (just running the tests, you forgot to commit cordic/renormalize.py.
> >  for future reference, use "git status" and you should spot missing
> >  files, fairly easily.  that's if we're properly maintaining ".gitignore")
> 
> Oops, fixed!

been there :)

> > if however we do macro-op fusion, spotting two (commonly-used)
> > operations together, the two results *will* be needed.
> 
> Ah ok, so maybe I should add an input that selects one or the other?

yes.  an "Op".  this is what the "Op" field is for... see... ahh.. 1sec...
DivPipeCoreConfig and DivPipeCoreOperation (etc.)

https://git.libre-soc.org/?p=ieee754fpu.git;a=blob;f=src/ieee754/div_rem_sqrt_rsqrt/core.py;h=fea59dce0c4f73d652985faa8181d5af97d5877c;hb=dd3919a0df8e1190f2fe985b0448701f164b392a#l54

which is set up as the "context" (ctx) here:
https://git.libre-soc.org/?p=ieee754fpu.git;a=blob;f=src/ieee754/div_rem_sqrt_rsqrt/div_pipe.py;h=d7b81729499b5d763eb1d150b031dceeefecbda9;hb=dd3919a0df8e1190f2fe985b0448701f164b392a#l42

and it is of type "FPPipeContext", declared here:
https://git.libre-soc.org/?p=ieee754fpu.git;a=blob;f=src/ieee754/fpcommon/getop.py;h=117d29223d23ab8176382e76b2dd129382735721;hb=dd3919a0df8e1190f2fe985b0448701f164b392a#l65

and if you look at lines 63 and 65 you can see that you can EITHER:

* specify just a bitwidth (in which case you get a signal and it's
  your responsibility to manage conversion from the "op" into that Signal)

OR

* specify an *actual class* as a parameter to FPPipeContext, and an instance
  *of* that class will be instantiated on your behalf.

it's actually really important to conform to this API because it's where
the "cancellation", identifier information etc. critically necessary for
the use of the pipeline in the scoreboard system is all placed.



> (kinda
> sucks that we need to calculate both for the cordic to work, oh well)

:)

divide is the same.  it produces two results: DIV and REM.

fascinatingly CORDIC and DIV (and SQRT and RSQRT) all use the same
core concept / algorithm, so it is no surprise that there are two results.


> (In reply to Luke Kenneth Casson Leighton from comment #37)
> > ah excellent!  you did a FSM-based version as well, that's superb.
> > if the pipelined version turns out to be insanely gate-hungry, or
> > just not that important, we can use it.
> 
> Unfortunately, that one isn't as complete as the pipelined one. It doesn't
> handle denormals or 0 well because I had to roll my own denormalization
> stage instead of using the existing one from the multiplier. And it doesn't
> (yet) support conversion back into floating point at the end. 

ok not a problem.  it got you bootstrapped to where you needed to go.
let's leave it for now, but do document that (briefly).

> > 
> > also as a "general-purpose library" it's extremely useful to have
> > because other developers might not want a full pipeline version.
> 
> Makes sense.

can you do that move?  the unit test as well.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev

^ permalink raw reply

* [libre-riscv-dev] [Bug 208] implement CORDIC in a general way sufficient to do transcendentals
From: bugzilla-daemon @ 2020-05-05 14:52 UTC (permalink / raw)
  To: libre-riscv-dev
In-Reply-To: <bug-208-13@https.bugs.libre-soc.org/>

https://bugs.libre-soc.org/show_bug.cgi?id=208

--- Comment #40 from Michael Nolan <mtnolan2640@gmail.com> ---
Luke, your latest commit (74af221) breaks the tests for the pipelined fpsin:

======================================================================
ERROR: test_rand (__main__.SinCosTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test_fp_pipe.py", line 80, in test_rand
    self.run_test(iter(inputs), outputs=iter(outputs))
  File "test_fp_pipe.py", line 21, in run_test
    vl = rtlil.convert(dut, ports=dut.ports())
  File "/home/mnolan/.local/lib/python3.8/site-packages/nmigen/back/rtlil.py",
line 1017, in convert
    fragment = ir.Fragment.get(elaboratable, platform).prepare(**kwargs)
  File "/home/mnolan/.local/lib/python3.8/site-packages/nmigen/hdl/ir.py", line
540, in prepare
    raise TypeError("Only signals may be added as ports, not {!r}"
TypeError: Only signals may be added as ports, not (slice (sig x) 0:1)

It looks like dut.ports() is returning a bunch of slices for the output signals
and I'm not sure why:

[(sig p_valid_i), (sig p_ready_o), (sig a), (sig muxid), (sig op), (sig
n_ready_i), (sig n_valid_o), (slice (sig x) 0:1), (slice (sig x) 1:2), (slice
(sig x) 2:3), (slice (sig x) 3:4), (slice (sig x) 4:5), (slice (sig x) 5:6),
(slice (sig x) 6:7), (slice (sig x) 7:8), (slice (sig x) 8:9), (slice (sig x)
9:10), (slice (sig x) 10:11), (slice (sig x) 11:12), (slice (sig x) 12:13),
(slice (sig x) 13:14), (slice (sig x) 14:15), (slice (sig x) 15:16), (slice
(sig x) 16:17), (slice (sig x) 17:18), (slice (sig x) 18:19), (slice (sig x)
19:20), (slice (sig x) 20:21), (slice (sig x) 21:22), (slice (sig x) 22:23),
(slice (sig x) 23:24), (slice (sig x) 24:25), (slice (sig x) 25:26), (slice
(sig x) 26:27), (slice (sig x) 27:28), (slice (sig x) 28:29), (slice (sig x)
29:30), (slice (sig x) 30:31), (slice (sig x) 31:32), (slice (sig y) 0:1),
(slice (sig y) 1:2), (slice (sig y) 2:3), (slice (sig y) 3:4), (slice (sig y)
4:5), (slice (sig y) 5:6), (slice (sig y) 6:7), (slice (sig y) 7:8), (slice
(sig y) 8:9), (slice (sig y) 9:10), (slice (sig y) 10:11), (slice (sig y)
11:12), (slice (sig y) 12:13), (slice (sig y) 13:14), (slice (sig y) 14:15),
(slice (sig y) 15:16), (slice (sig y) 16:17), (slice (sig y) 17:18), (slice
(sig y) 18:19), (slice (sig y) 19:20), (slice (sig y) 20:21), (slice (sig y)
21:22), (slice (sig y) 22:23), (slice (sig y) 23:24), (slice (sig y) 24:25),
(slice (sig y) 25:26), (slice (sig y) 26:27), (slice (sig y) 27:28), (slice
(sig y) 28:29), (slice (sig y) 29:30), (slice (sig y) 30:31), (slice (sig y)
31:32), (sig muxid), (sig op)]

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev

^ permalink raw reply

* [libre-riscv-dev] [Bug 208] implement CORDIC in a general way sufficient to do transcendentals
From: bugzilla-daemon @ 2020-05-05 14:42 UTC (permalink / raw)
  To: libre-riscv-dev
In-Reply-To: <bug-208-13@https.bugs.libre-soc.org/>

https://bugs.libre-soc.org/show_bug.cgi?id=208

--- Comment #39 from Michael Nolan <mtnolan2640@gmail.com> ---
(In reply to Luke Kenneth Casson Leighton from comment #37)
> ah excellent!  you did a FSM-based version as well, that's superb.
> if the pipelined version turns out to be insanely gate-hungry, or
> just not that important, we can use it.

Ooof, yeah. Running synthesis on the 32 bit pipelined version (4 cordic rounds
per pipeline stage) gives somewhere around 77k gates.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev

^ permalink raw reply

* [libre-riscv-dev] [Bug 208] implement CORDIC in a general way sufficient to do transcendentals
From: bugzilla-daemon @ 2020-05-05 14:29 UTC (permalink / raw)
  To: libre-riscv-dev
In-Reply-To: <bug-208-13@https.bugs.libre-soc.org/>

https://bugs.libre-soc.org/show_bug.cgi?id=208

--- Comment #38 from Michael Nolan <mtnolan2640@gmail.com> ---
(In reply to Luke Kenneth Casson Leighton from comment #36)
> 
> (just running the tests, you forgot to commit cordic/renormalize.py.
>  for future reference, use "git status" and you should spot missing
>  files, fairly easily.  that's if we're properly maintaining ".gitignore")

Oops, fixed!
> 
> 
> > However, for the conversion back to floating point I had to write my own
> > class to do so, as none of the existing ones (used in fpadd for instance)
> > support *two* outputs. 
> 
> yeah, keenly aware of that.
> 
> > I don't imagine we want to continue using my
> > implementation, so what would be the best way of going about this?
> 
> hmmm hmmm well we will actually need double-output functions at some
> point (and more): NORMALISE, DOTPRODUCT, they're all multi-output.
> 
> however for the plain "SIN" and "COS" operations - and others that
> will use "General CORDIC" - we simply *drop* the output on the floor
> if it's unused.
> 
> if however we do macro-op fusion, spotting two (commonly-used)
> operations together, the two results *will* be needed.

Ah ok, so maybe I should add an input that selects one or the other? (kinda
sucks that we need to calculate both for the cordic to work, oh well)


(In reply to Luke Kenneth Casson Leighton from comment #37)
> ah excellent!  you did a FSM-based version as well, that's superb.
> if the pipelined version turns out to be insanely gate-hungry, or
> just not that important, we can use it.

Unfortunately, that one isn't as complete as the pipelined one. It doesn't
handle denormals or 0 well because I had to roll my own denormalization stage
instead of using the existing one from the multiplier. And it doesn't (yet)
support conversion back into floating point at the end. 

> 
> also as a "general-purpose library" it's extremely useful to have
> because other developers might not want a full pipeline version.

Makes sense.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev

^ permalink raw reply

* Re: [libre-riscv-dev] global network of developers
From: Luke Kenneth Casson Leighton @ 2020-05-05 14:26 UTC (permalink / raw)
  To: Libre-RISCV General Development
In-Reply-To: <624E1265-0D56-4A9E-8BA2-6F91AD72EDC2@gatech.edu>

On Tue, May 5, 2020 at 2:10 PM Yehowshua <yimmanuel3@gatech.edu> wrote:
>
>
>
> > On May 5, 2020, at 7:09 AM, Luke Kenneth Casson Leighton <lkcl@lkcl.net> wrote:
> >
> > i found out today a bit more about them: https://marketnext.org/what-we-do-3/ <https://marketnext.org/what-we-do-3/>
>
> This is quite exciting. Would NLNet be paying them from funding currently reserved for parts of the Libre-Soc project?

the NLNet Grants are reserved for "whomever completes the tasks".
therefore, the answer will be "yes".  as the "gateway" is a
Foundation, it's a no-brainer.

> Also, I’d really hope that MarketNext can put us in touch with grad students - we do need skilled labor.

yes.  we'll see how it goes.

l.

_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev

^ permalink raw reply

* Re: [libre-riscv-dev] daily status update 05may2020
From: Luke Kenneth Casson Leighton @ 2020-05-05 14:24 UTC (permalink / raw)
  To: Libre-RISCV General Development
In-Reply-To: <A96607D2-362B-4720-B1FE-2C2BBACD472D@gatech.edu>

On Tue, May 5, 2020 at 2:07 PM Yehowshua <yimmanuel3@gatech.edu> wrote:
>
>
>
> > On May 5, 2020, at 6:47 AM, Luke Kenneth Casson Leighton <lkcl@lkcl.net> wrote:
> >
> > it would be good if everyone else did as well, as we
> > can keep in touch and see what's going on.
>
> I’m working my way through the codebase and slowly adding documentation.

ah good.  thank you for this, yehowshua.

l.

_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev

^ permalink raw reply

* Re: [libre-riscv-dev] daily status update 05may2020
From: Luke Kenneth Casson Leighton @ 2020-05-05 14:23 UTC (permalink / raw)
  To: Libre-RISCV General Development
In-Reply-To: <1C547BD5-D8BF-42CF-872A-1A6BE039A156@gatech.edu>

On Tue, May 5, 2020 at 2:02 PM Yehowshua <yimmanuel3@gatech.edu> wrote:

> What exactly is a LDSTCompUnit? A cursory Google search just brings up Libre-SOC.

:)  Load Store Computational Unit.

see Mitch Alsup's "Scoreboard Mechanics" chapters (which are a
critical pre-requisite to read, for understanding).

10.4.6 A Computational Unit
A Computational Unit is responsible for the data manipulation of an
instruction, while the
Function Unit is responsible for the data-flow of an instruction.
Thus, a CDC 6600
Computational Unit will contain storage for the 6-bit instruction,
storage for both operand
values, storage for the result value(s), and a ​Timing Chain​. The
timing chain is used to
generate the Request_Release signal back to the ScoreBoard, at the
appropriate point in
time. Some more modern Function Units will have implicit Request_Release timing.

therefore, a  "Load Store Computational Unit" is responsible for the
data-manipulation side of LOAD and STOREs.

> Does it take a LD/ST instruction and compute the offset before access?

it "manages":

* the computation of the Effective Address,
* the communcation to the actual LOAD/STORE memory
* the sending (ST) or receipt (LD) of data

i just updated the docstring to explain it further:
https://git.libre-soc.org/?p=soc.git;a=blob;f=src/soc/experiment/compldst_multi.py;hb=HEAD

> Why do you call it cache buffer - I’ve only heard the term cache.

because it effectively performs both roles.  it both buffers the LD/ST
data and also has some of the characteristics of a cache.  and because
i couldn't decide which it was :)

> Also, how many ways is the cache?

one.  it's not a "normal" cache.

> Is it configureable

yes, however it strictly matches the total number of LDSTCompUnits as
inputs, and is strictly and specifically designed to have "dual ports"
- connecting to interleaved odd-even *dual* L1 128-bit-wide Caches.

  https://libre-soc.org/3d_gpu/twin_l0_cache_buffer.jpg

so the "options" are hard-coded by other resources.  its role is
basically to "merge" a whopping *SIXTEEN* non-cache-aligned individual
and narrow LD/ST operations into (two) wide cache-aligned
operations... *on every clock cycle*.

yes, 16 incoming 64-bit requests on every cycle.

yes, 2 outgoing 128-bit requests on every cycle.

this is the only way we're going to meet the (insane) memory bandwidth
requirements of a GPU.


> are you pulling in the source from minerva?

that's already been done.  i described this yesterday.

the plan is to move the source code from minerva for the L1 Caches
(and delete everything else as extraneous), widen the minerva L1 cache
code to 128 bit wide cache lines, and add double 64-bit Wishbone
Interfaces to *each*.

we'll need Wishbone Arbiters to do that.

> > today i'll be working on the redesigned LD/ST Computational Unit which
> > has 3R-2W (indexed and update) capability.
> > https://libre-soc.org/3d_gpu/ld_st_comp_unit.jpg <https://libre-soc.org/3d_gpu/ld_st_comp_unit.jpg>
> Can we have a link to the gittree for this code.

yes, sorry.  just committed the work-in-progress:
https://git.libre-soc.org/?p=soc.git;a=blob;f=src/soc/experiment/compldst_multi.py;hb=HEAD

l.

_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev

^ permalink raw reply

* [libre-riscv-dev] [Bug 208] implement CORDIC in a general way sufficient to do transcendentals
From: bugzilla-daemon @ 2020-05-05 14:06 UTC (permalink / raw)
  To: libre-riscv-dev
In-Reply-To: <bug-208-13@https.bugs.libre-soc.org/>

https://bugs.libre-soc.org/show_bug.cgi?id=208

--- Comment #37 from Luke Kenneth Casson Leighton <lkcl@lkcl.net> ---
ah excellent!  you did a FSM-based version as well, that's superb.
if the pipelined version turns out to be insanely gate-hungry, or
just not that important, we can use it.

also as a "general-purpose library" it's extremely useful to have
because other developers might not want a full pipeline version.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev

^ permalink raw reply

* [libre-riscv-dev] [Bug 208] implement CORDIC in a general way sufficient to do transcendentals
From: bugzilla-daemon @ 2020-05-05 14:04 UTC (permalink / raw)
  To: libre-riscv-dev
In-Reply-To: <bug-208-13@https.bugs.libre-soc.org/>

https://bugs.libre-soc.org/show_bug.cgi?id=208

--- Comment #36 from Luke Kenneth Casson Leighton <lkcl@lkcl.net> ---
(In reply to Michael Nolan from comment #35)
> So I think I got the floating point cordic all the way working yesterday. It
> converts the floating point input to a fixed point 50 bit number, calculates
> the sine and cosine, then converts them back to floating point.

hurrah!

(just running the tests, you forgot to commit cordic/renormalize.py.
 for future reference, use "git status" and you should spot missing
 files, fairly easily.  that's if we're properly maintaining ".gitignore")


> However, for the conversion back to floating point I had to write my own
> class to do so, as none of the existing ones (used in fpadd for instance)
> support *two* outputs. 

yeah, keenly aware of that.

> I don't imagine we want to continue using my
> implementation, so what would be the best way of going about this?

hmmm hmmm well we will actually need double-output functions at some
point (and more): NORMALISE, DOTPRODUCT, they're all multi-output.

however for the plain "SIN" and "COS" operations - and others that
will use "General CORDIC" - we simply *drop* the output on the floor
if it's unused.

if however we do macro-op fusion, spotting two (commonly-used)
operations together, the two results *will* be needed.


> I also needed to write a module for counting the number of leading zeros in
> the fixed point number. 

ah goood.  actually i think... somewhere... very ineptly-named, there
is a class that does this.  probably "MultiShiftRMerge".

don't worry about it :)

> I don't imagine this would only be useful to the
> cordic; where would be the best place to put it? fpcommon?

on one hand i'd be inclined to suggest nmutil (because CLZ is pretty
useful, generally)

on the other, it's a basic "ALU" operation.

hmm hmm...  the decision would be based then on whether CLZ (count leading
zeros) has uses *outside* of an ALU, and my feeling is, it probably does.

actually, just looking at it, i really like it!  it reminds me of the
reference that Jacob put... what was it... "Common Task something"?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev

^ permalink raw reply

* [libre-riscv-dev] [Bug 208] implement CORDIC in a general way sufficient to do transcendentals
From: bugzilla-daemon @ 2020-05-05 13:17 UTC (permalink / raw)
  To: libre-riscv-dev
In-Reply-To: <bug-208-13@https.bugs.libre-soc.org/>

https://bugs.libre-soc.org/show_bug.cgi?id=208

--- Comment #35 from Michael Nolan <mtnolan2640@gmail.com> ---
So I think I got the floating point cordic all the way working yesterday. It
converts the floating point input to a fixed point 50 bit number, calculates
the sine and cosine, then converts them back to floating point.

However, for the conversion back to floating point I had to write my own class
to do so, as none of the existing ones (used in fpadd for instance) support
*two* outputs. I don't imagine we want to continue using my implementation, so
what would be the best way of going about this?

I also needed to write a module for counting the number of leading zeros in the
fixed point number. I don't imagine this would only be useful to the cordic;
where would be the best place to put it? fpcommon?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev

^ permalink raw reply

* Re: [libre-riscv-dev] global network of developers
From: Yehowshua @ 2020-05-05 13:10 UTC (permalink / raw)
  To: Libre-RISCV General Development
In-Reply-To: <CAPweEDwrdHjZBe9TdUnA4FCZ-J48BZ7sVJUb2t1gbSuNSWpS2g@mail.gmail.com>



> On May 5, 2020, at 8:51 AM, Luke Kenneth Casson Leighton <lkcl@lkcl.net> wrote:
> 
>  i'd like everyone to have the opportunity to participate in
> those.  more when i have more info.

Noted.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev

^ permalink raw reply

* Re: [libre-riscv-dev] global network of developers
From: Yehowshua @ 2020-05-05 13:10 UTC (permalink / raw)
  To: Libre-RISCV General Development
In-Reply-To: <CAPweEDwUvRqWHvN6AjuWVeCNk76HZ65FwmVth__gf3XxqWe0OA@mail.gmail.com>



> On May 5, 2020, at 7:09 AM, Luke Kenneth Casson Leighton <lkcl@lkcl.net> wrote:
> 
> i found out today a bit more about them: https://marketnext.org/what-we-do-3/ <https://marketnext.org/what-we-do-3/>

This is quite exciting. Would NLNet be paying them from funding currently reserved for parts of the Libre-Soc project?

Also, I’d really hope that MarketNext can put us in touch with grad students - we do need skilled labor.

Yehowshua
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev

^ permalink raw reply

page:   latest

Libre RISC-V Mailing list Archives (accessible via public-inbox)

Archives are clonable: git clone --mirror https://inbox.libre-soc.org/libre-riscv-dev

Example config snippet for mirrors


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git