The PE for the second generation CGRA (garnet).
Make sure you have python 3.7. Peak needs this.
First install peak
git clone https://github.com/phanrahan/peak.git
cd peak
python setup.py install --user
Install Lassen
git clone git@github.com:StanfordAHA/lassen.git
cd lassen
python setup.py install --user
Run tests using
pytest
Date | Person | Status | Task |
---|---|---|---|
Feb 13 | Alex | Complete | Add BFloat16 add and multiply functional model |
Add Float (configurable width?) type to CoreIR, create float add and multiply operator implementations in CoreIR by wrapping designware module | |||
Add Float type to Magma | |||
Generate verilog from Peak | |||
Figure out what to do about different latencies (if they are different for the floating point ops) | |||
Add multi-PE support to Peak | |||
Change CoreIR mapper, PnR to support multi-PE |
Compared to the first generation PE (Diablo), Lassen shall have two new features:
+/- 1.mantissa * 2 ^ exponent, where mantissa is a 7 bit unsigned integer, and exponent is 8 bit signed integer (. dot means decimal point)
div
out = a/b
, where a, b and out are all BFloatsout = a * (1/b)
, the BFloat multiply already exists as an instruction. So we basically have to implement reciprocal, 1/b
b = +/- 1.f * 2 ^ x
1/b = +/- (1/1.f) * 2 ^ (-x)
(1/1.f)
is stored as a Bfloat in a look up table in a memory tile. It is a table with 128 entries as f is 7 bits. So you read this entry out, let us say it is some +/- 1.g * 2 ^ y
1/b = +/- 1.g * 2 ^ y * 2 ^ (-x) = +/- 1.g * 2 ^ (y - x)
ln
out = ln(a)
where a and out are BFloatsa = +/- 1.f * 2 ^ x
ln(a)
should error out when a < 0
ln(a) = ln(1.f * 2 ^ x) = ln(1.f) + x * ln(2)
ln(1.f)
is a look up table, similar to what we did for divln(2)
is also a BFloate^x
e^x = (2^(1/ln(2)))^x = 2^(x/ln(2)) = 2^y
y
with existing instructions. Bfloat multiply it with a constant 1/ln(2).sin
pow