31
CoNGA’19 | BOCCO Andrea | 13 March 2019 SMURF: SCALAR MULTIPLE-PRECISION UNUM RISC-V FLOATING- POINT ACCELERATOR FOR SCIENTIFIC COMPUTING

SMURF: SCALAR MULTIPLE-PRECISION UNUM RISC-V FLOATING ... · § It is synchronized with others macro-stages through a ready-valid protocol § Stop and Wait protocol Ø In this way,

  • Upload
    others

  • View
    12

  • Download
    0

Embed Size (px)

Citation preview

Page 1: SMURF: SCALAR MULTIPLE-PRECISION UNUM RISC-V FLOATING ... · § It is synchronized with others macro-stages through a ready-valid protocol § Stop and Wait protocol Ø In this way,

CoNGA’19 | BOCCO Andrea | 13 March 2019

SMURF: SCALAR MULTIPLE-PRECISION UNUM RISC-V FLOATING-POINT ACCELERATOR FOR SCIENTIFIC COMPUTING

Page 2: SMURF: SCALAR MULTIPLE-PRECISION UNUM RISC-V FLOATING ... · § It is synchronized with others macro-stages through a ready-valid protocol § Stop and Wait protocol Ø In this way,

| 2

INTRODUCTION: STATE OF THE ART

Ø Variable Precision (VP) computing has been investigated to improve convergence of algorithms based on the IEEE 754 [1] standard :§ Software (SW): GMP [2] and MPFR [3]

§ Slow, they might not met requirements in high speed applications§ Hardware (HW):

§ Kulisch [4] : large fixed point accumulator§ Schulte and Swartzlander [5] : mantissas divided in multiple words

Ø None of the previous works show how to store efficiently VP Floating Point ( FP) number in main memory§ They support IEEE 754 FP format in main memory

[1] IEEE754-2008 2008. IEEE Standard for Floating-Point Arithmetic. IEEE 754-2008 https://doi.org/10.1109/IEEESTD.2008.4610935[2] Torbjörn Granlund and the GMP development team. 2012. GNU MP: The GNU Multiple Precision Arithmetic Library. https://gmplib.org/[3] Laurent Fousse, et al. MPFR: A Multiple precision Binary Floating-point Library with Correct Rounding. https://doi.org/10.1145/1236463.1236468[4] Ulirich Kulisch. 2013. Computer arithmetic and validity: Theory, implementation, and applications[5] M. J. Schulte and E. E. Swartzlander. 2000. A family of variable precision interval arithmetic processors. https://doi.org/10.1109/12.859535

Page 3: SMURF: SCALAR MULTIPLE-PRECISION UNUM RISC-V FLOATING ... · § It is synchronized with others macro-stages through a ready-valid protocol § Stop and Wait protocol Ø In this way,

| 3

INTRODUCTION: MY WORK

In this work we present the SMURF:• Scalar• Multiple-precision• Unum• Risc-V• Floating-point Accelerator for Scientific Computing

SMURF: VP FP hardware accelerator§ It supports the UNUM type I FP format in main

memory up to 256 mantissa bits.§ It supports internally FP numbers with up to 512

mantissa bits.§ It supports Interval Arithmetic (IA)

Page 4: SMURF: SCALAR MULTIPLE-PRECISION UNUM RISC-V FLOATING ... · § It is synchronized with others macro-stages through a ready-valid protocol § Stop and Wait protocol Ø In this way,

| 4

OUTLINE

• Choice of the memory format: the UNUM type I• The SMURF architecture• The SMURF Instruction Set Architecture (ISA)• The SMURF micro-architecture hardware implementation• Validation, FPGA integration and Synthesis results• An experimental software setup of the SMURF architecture.• Conclusions

Page 5: SMURF: SCALAR MULTIPLE-PRECISION UNUM RISC-V FLOATING ... · § It is synchronized with others macro-stages through a ready-valid protocol § Stop and Wait protocol Ø In this way,

| 5

OUTLINE

• Choice of the memory format: the UNUM type I• The SMURF architecture• The SMURF Instruction Set Architecture (ISA)• The SMURF micro-architecture hardware implementation• Validation, FPGA integration and Synthesis results• An experimental software setup of the SMURF architecture.• Conclusions

Page 6: SMURF: SCALAR MULTIPLE-PRECISION UNUM RISC-V FLOATING ... · § It is synchronized with others macro-stages through a ready-valid protocol § Stop and Wait protocol Ø In this way,

| 6

CHOICE OF THE MEMORY FORMAT: THE UNUM TYPE I

We decided to use the UNUM type I FP format in main memory• It is 6 sub-fields self-descriptive FP format

3 more that conventional IEEE 754 FP numbers• WHY?

• UNUM is a VP FP format• It self-handles the exponent and fraction field lengths

However UNUM type I has some peculiarities to be fixed:• How to organize UNUM arrays in main memory• How to organize the UNUM fields in memory

s e f u es-1 fs-1

sign exponent fraction ubit exponentsize

fractionsize

es bits fs bits

Page 7: SMURF: SCALAR MULTIPLE-PRECISION UNUM RISC-V FLOATING ... · § It is synchronized with others macro-stages through a ready-valid protocol § Stop and Wait protocol Ø In this way,

| 7

REFINEMENTS ON THE UNUM TYPE I FP FORMAT:- UNUM ARRAY ORGANIZATION

Handling a two-element UNUM array on main memory with p bits parallelism

U2_0 U2_1 U2_2

U1_0 U1_1

p p

2p 3p0 p

p

U2 :

U1 :

bitlength

p

@2’:

@1’:

FF--FF

00--00 1

U1_1

U1_0

U2_1

U2_0

U2_2

@2’’:

@1’:

pFF--FF

00--00 2

U1_1

U1_0

U2_2

U2_1

U2_0 U3_2

U3_1

U3_0

U3_2

U3_1

U3_0

!

U3=U1*U2Array support:Guarantee affine memory accesses

Page 8: SMURF: SCALAR MULTIPLE-PRECISION UNUM RISC-V FLOATING ... · § It is synchronized with others macro-stages through a ready-valid protocol § Stop and Wait protocol Ø In this way,

| 8

REFINEMENTS ON THE UNUM TYPE I FP FORMAT:- UNUM FIELD ORGANIZATION

For a UNUM/ubound which spans multiple addresses in main memory it is important to have the descriptor fields present in the lower addresses.Ø We have re-organized the order of the fields for UNUM and ubound

left right left right left rights u es-1 fs-1 s u es-1 fs-1 e e f f

s u es-1 fs-1 e f

2

1LSB MSB

@1’:

pFF--FF

00--00

U1

?

?

?

?

?

?

p

@1’:

FF--FF

00--00

U1

?

@2’:U2 ?

Page 9: SMURF: SCALAR MULTIPLE-PRECISION UNUM RISC-V FLOATING ... · § It is synchronized with others macro-stages through a ready-valid protocol § Stop and Wait protocol Ø In this way,

| 9

OUTLINE

• Choice of the memory format: the UNUM type I• The SMURF architecture• The SMURF Instruction Set Architecture (ISA)• The SMURF micro-architecture hardware implementation• Validation, FPGA integration and Synthesis results• An experimental software setup of the SMURF architecture.• Conclusions

Page 10: SMURF: SCALAR MULTIPLE-PRECISION UNUM RISC-V FLOATING ... · § It is synchronized with others macro-stages through a ready-valid protocol § Stop and Wait protocol Ø In this way,

| 10

Data organization:Ø UNUMs/u-bounds are strictly considered as memory formatsØ Data inside the coprocessor scratchpad have dedicated FP format

§ Mantissa is normalized§ Mantissa is divided in 8 chunks of 64 bits each§ Exponent is explicit and signed

Ø Conversions between formats are handled by a dedicated Load and Store unit (L&S)

THE SMURF ARCHITECTURE

gRF[i]

f e L

64

.1 m0m1···

mLmax

f e L

64

.1 m0m1···

mLmax

Page 11: SMURF: SCALAR MULTIPLE-PRECISION UNUM RISC-V FLOATING ... · § It is synchronized with others macro-stages through a ready-valid protocol § Stop and Wait protocol Ø In this way,

| 11

• 1 integer register file (iRF): 32 integer general purpose register (GPR) + pc, in the main processor.

• 1 g-bound register file (gRF): 32 entries, in the co-processor.• UNUMs/u-bounds are strictly considered as memory formats:

• Load operations:• Load UNUMs/u-bounds from the main memory, and converts them into internal g-bounds.

• Store operations:• Convert internal g-bounds (entries of the internal gRF) into u-bounds. Store the latter the

main memory.• The coprocessor internal parallelism is fixed to 64 bits• Coprocessor’s status registers:

• DUE• SUE• WGP

THE SMURF ARCHITECTURE

Rocket tile

UNUMco-proc

RoCC

L&S

RISC-VRocket Chip

FPU

L&S$L1

RAM

Scratchpad

$L1

RAM

1

23

4

5

Page 12: SMURF: SCALAR MULTIPLE-PRECISION UNUM RISC-V FLOATING ... · § It is synchronized with others macro-stages through a ready-valid protocol § Stop and Wait protocol Ø In this way,

| 12

Mantissas are divided in chunks of 64 bitsØ The WGP status register defines the maximum mantissa chunks

that an operator of the coprocessor can output.

Ø The user has a latency/precision tradeoff to exploit for his computation

THE SMURF ARCHITECTURE

gOP

gRF[7]

f e L

64

.1 m0m1···

mLmax

f e L

64

.1 m0m1···

mLmax

gRF[3]

f e L

64

.1 m0m1···

mLmax

f e L

64

.1 m0m1···

mLmax

gRF[10]

f e L

64

.1 m0m1···

mLmax

f e L

64

.1 m0m1···

mLmax

WGP = 2

Page 13: SMURF: SCALAR MULTIPLE-PRECISION UNUM RISC-V FLOATING ... · § It is synchronized with others macro-stages through a ready-valid protocol § Stop and Wait protocol Ø In this way,

| 13

OUTLINE

• Choice of the memory format: the UNUM type I• The SMURF architecture• The SMURF Instruction Set Architecture (ISA)• The SMURF micro-architecture hardware implementation• Validation, FPGA integration and Synthesis results• An experimental software setup of the SMURF architecture.• Conclusions

Page 14: SMURF: SCALAR MULTIPLE-PRECISION UNUM RISC-V FLOATING ... · § It is synchronized with others macro-stages through a ready-valid protocol § Stop and Wait protocol Ø In this way,

| 14

THE SMURF INSTRUCTION SET ARCHITECTURE (ISA)

• The SMURF ISA is divided in four groups:

Page 15: SMURF: SCALAR MULTIPLE-PRECISION UNUM RISC-V FLOATING ... · § It is synchronized with others macro-stages through a ready-valid protocol § Stop and Wait protocol Ø In this way,

| 15

THE SMURF INSTRUCTION SET ARCHITECTURE (ISA)

• The SMURF ISA is divided in four groups:• Status Register settings

Page 16: SMURF: SCALAR MULTIPLE-PRECISION UNUM RISC-V FLOATING ... · § It is synchronized with others macro-stages through a ready-valid protocol § Stop and Wait protocol Ø In this way,

| 16

THE SMURF INSTRUCTION SET ARCHITECTURE (ISA)

• The SMURF ISA is divided in four groups:• Status Register settings• Mov operations

Page 17: SMURF: SCALAR MULTIPLE-PRECISION UNUM RISC-V FLOATING ... · § It is synchronized with others macro-stages through a ready-valid protocol § Stop and Wait protocol Ø In this way,

| 17

THE SMURF INSTRUCTION SET ARCHITECTURE (ISA)

• The SMURF ISA is divided in four groups:• Status Register settings• Mov operations• Arithmetic operations

Page 18: SMURF: SCALAR MULTIPLE-PRECISION UNUM RISC-V FLOATING ... · § It is synchronized with others macro-stages through a ready-valid protocol § Stop and Wait protocol Ø In this way,

| 18

THE SMURF INSTRUCTION SET ARCHITECTURE (ISA)

• The SMURF ISA is divided in four groups:• Status Register settings• Mov operations• Arithmetic operations• Load and Store operations

Page 19: SMURF: SCALAR MULTIPLE-PRECISION UNUM RISC-V FLOATING ... · § It is synchronized with others macro-stages through a ready-valid protocol § Stop and Wait protocol Ø In this way,

| 19

OUTLINE

• Choice of the memory format: the UNUM type I• The SMURF architecture• The SMURF Instruction Set Architecture (ISA)• The SMURF micro-architecture hardware implementation• Validation, FPGA integration and Synthesis results• An experimental software setup of the SMURF architecture.• Conclusions

Page 20: SMURF: SCALAR MULTIPLE-PRECISION UNUM RISC-V FLOATING ... · § It is synchronized with others macro-stages through a ready-valid protocol § Stop and Wait protocol Ø In this way,

| 20

THE SMURF MICRO-ARCHITECTURE HARDWARE IMPLEMENTATION

RoCCinterface

Instr.

Data out

Data In

MemoryInterface

(cache L1)

cwControlUnit

gRF• 2 read ports• 1 write port• 32 VP g-bounds

(64 g-numbers)

d_cw

gALU

gop2gop1

e_cw

gres

gres_dec

gres_exe

bus arbiter

gop1

+ g

op2

gres

gADD / gSUBgGUESS / gRADIUS

gMUL

gMOV

gCMP

gLSUG2U U2G

Cache IF

SR

Left

f e L

DW

m1

mLmax

.1 m0

Right

f e L

DW

m1

mLmax

.1 m0

4 5

6

7 8

9

2 31

Page 21: SMURF: SCALAR MULTIPLE-PRECISION UNUM RISC-V FLOATING ... · § It is synchronized with others macro-stages through a ready-valid protocol § Stop and Wait protocol Ø In this way,

| 21

THE SMURF MICRO-ARCHITECTURE HARDWARE IMPLEMENTATION

Internal operators pipelines are divided in “macro-stages”:Ø A “macro-stage” is the logic which iterates on mantissas chunks:

§ It implements a basic mantissa operation: mov, lzc, add, sub, shift, mul, …§ It reads the input mantissa from an input buffer (BUFF)§ It computes the resulting mantissa chunk-wise (64 bits per clock cycle)

§ Variable latency§ It writes the computed result in an output buffer (BUFF)§ It is synchronized with others macro-stages through a ready-valid protocol

§ Stop and Wait protocol

Ø In this way, the complexity to do operations on multiple mantissas chunks is pushed inside each macro stage.

STAGEi-1

STAGEi

STAGEi+1

readyvalid

readyvalid

BUFF

f e L

DW

m1

mLmax

. m0IB

GB

BUFF

f e L

DW

m1

mLmax

. m0IB

GB

FF-barrierFF-barrier

Page 22: SMURF: SCALAR MULTIPLE-PRECISION UNUM RISC-V FLOATING ... · § It is synchronized with others macro-stages through a ready-valid protocol § Stop and Wait protocol Ø In this way,

| 22

OUTLINE

• Choice of the memory format: the UNUM type I• The SMURF architecture• The SMURF Instruction Set Architecture (ISA)• The SMURF micro-architecture hardware implementation• Validation, FPGA integration and Synthesis results• An experimental software setup of the SMURF architecture.• Conclusions

Page 23: SMURF: SCALAR MULTIPLE-PRECISION UNUM RISC-V FLOATING ... · § It is synchronized with others macro-stages through a ready-valid protocol § Stop and Wait protocol Ø In this way,

| 23

VALIDATION, FPGA INTEGRATION AND SYNTHESIS RESULTS

Validation: SMURF sub-components are validated against 50 millions pseudo-generated input vectorsFPGA integration: SMURF is integrated in a Xilinx Virtex 7 FPGA board @50 MHzASIC synthesis: working frequency 600MHz

Page 24: SMURF: SCALAR MULTIPLE-PRECISION UNUM RISC-V FLOATING ... · § It is synchronized with others macro-stages through a ready-valid protocol § Stop and Wait protocol Ø In this way,

| 24

VALIDATION, FPGA INTEGRATION AND SYNTHESIS RESULTS

Validation: SMURF sub-components are validated against 50 millions pseudo-generated input vectorsFPGA integration: SMURF is integrated in a Xilinx Virtex 7 FPGA board @50 MHzASIC synthesis: working frequency 600MHz

Ø Buffers have an important contribution in area (67%) and power (25%)

Ø We can reduce the buffer impact optimizing the design

Page 25: SMURF: SCALAR MULTIPLE-PRECISION UNUM RISC-V FLOATING ... · § It is synchronized with others macro-stages through a ready-valid protocol § Stop and Wait protocol Ø In this way,

| 25

VALIDATION, FPGA INTEGRATION AND SYNTHESIS RESULTS

RISC-V1%

64bit FPU2%

I cache9%

D cache13%

gMUL7%

gLSU4%gRF2%

gADD2%

gCMP1%

clock tree50%

others9%

ASIC POWER [%]

UNUM coproc:17,9 %

RISC-V+FPU:2,3 %

RISC-V2%

64bit FPU4%

I cache27%

D cache31%

gMUL9%

gRF9%

gLSU5%

gADD4%

gCMP2%

others7%

ASIC AREA [%]

UNUMcoproc:29,7 %

Rocketcore+FPU:4,9 %

The SMURF coprocessor vs. a standard IEEE FPU:• 9 times bigger• 12 times more energy consuming• Flops performances have the same order of magnitude

Ø This unit is meant to be used only when VP is needed: the rest of the time it behaves as dark silicon

Page 26: SMURF: SCALAR MULTIPLE-PRECISION UNUM RISC-V FLOATING ... · § It is synchronized with others macro-stages through a ready-valid protocol § Stop and Wait protocol Ø In this way,

| 26

OUTLINE

• Choice of the memory format: the UNUM type I• The SMURF architecture• The SMURF Instruction Set Architecture (ISA)• The SMURF micro-architecture hardware implementation• Validation, FPGA integration and Synthesis results• An experimental software setup of the SMURF architecture.• Conclusions

Page 27: SMURF: SCALAR MULTIPLE-PRECISION UNUM RISC-V FLOATING ... · § It is synchronized with others macro-stages through a ready-valid protocol § Stop and Wait protocol Ø In this way,

| 27

AN EXPERIMENTAL SOFTWARE SETUP

We measured the SMURF flop performance on a Newton-Raphson (NR) division example:The latency of a NR iteration• Using the SMURF it varies between

33 and 362 clock cycles:54 – 5 Mflops @ 600MHz

• Using MPFR with 512-bits of accuracy1 Mflop @ 600MHz

• Using the IEEE FPU it takes3 clock cycles:200 Mflops @ 600MHz

Ø +5x performance with respect to MPFRØ -4x performance with respect to 64bits

IEEE FPU

Page 28: SMURF: SCALAR MULTIPLE-PRECISION UNUM RISC-V FLOATING ... · § It is synchronized with others macro-stages through a ready-valid protocol § Stop and Wait protocol Ø In this way,

| 28

AN EXPERIMENTAL SOFTWARE SETUP

We measured the SMURF flop performance on a Newton-Raphson (NR) division example:The latency of a NR iteration• Using the SMURF it varies between

33 and 362 clock cycles:54 – 5 Mflops @ 600MHz

• Using MPFR with 512-bits of accuracy1 Mflop @ 600MHz

• Using the IEEE FPU it takes3 clock cycles:200 Mflops @ 600MHz

Ø +5x performance with respect to MPFRØ -4x performance with respect to 64bits

IEEE FPU

Work in progress:Ø We are working on a real programming

model to program real VP FP kernels

Page 29: SMURF: SCALAR MULTIPLE-PRECISION UNUM RISC-V FLOATING ... · § It is synchronized with others macro-stages through a ready-valid protocol § Stop and Wait protocol Ø In this way,

| 29

OUTLINE

• Choice of the memory format: the UNUM type I• The SMURF architecture• The SMURF Instruction Set Architecture (ISA)• The SMURF micro-architecture hardware implementation• Validation, FPGA integration and Synthesis results• An experimental software setup of the SMURF architecture.• Conclusions

Page 30: SMURF: SCALAR MULTIPLE-PRECISION UNUM RISC-V FLOATING ... · § It is synchronized with others macro-stages through a ready-valid protocol § Stop and Wait protocol Ø In this way,

| 30

CONCLUSIONS

This work proposes a Variable Precision (VP) Floating Point (FP) accelerator(SMURF) based on RISC-V ISA (Instruction Set Architecture) for high performance computing servers as an alternative to VP FP software routines.• SMURF is implemented as a RISC-V coprocessor• SMURF supports UNUM/ubound format in main memory

• It supports several Unum Environments: from (1,1) to (4,8), up to 256 mantissa bits• SMURF supports a dedicated internal format in its Register File

• 32 intervals; Each interval endpoint can have up to 512 mantissa bits• SMURF is pipelined with an internal parallelism fixed at 64 bit

• Mantissas are threated iteratively 64 bits per clock cycle• SMURF has 9x area and 12x power with respect a standard IEEE 64bit

FPU• The SMURF behaves as dark silicon when is not used

• SMURF flops performances are better than software libraries (MPFR) and they stays within the same range of a regular fixed-precision IEEE FPU.

Page 31: SMURF: SCALAR MULTIPLE-PRECISION UNUM RISC-V FLOATING ... · § It is synchronized with others macro-stages through a ready-valid protocol § Stop and Wait protocol Ø In this way,

Leti, technology research instituteCommissariat à l’énergie atomique et aux énergies alternativesMinatec Campus | 17 rue des Martyrs | 38054 Grenoble Cedex | Francewww.leti.fr

THANK YOU FOR YOUR ATTENTION!

Contacts:Andrea [email protected]