Загрузка видео...

Не удалось загрузить видео

На главную

I spent my summer building TinyTPU : An open source ML inference and training chip. it can do end to end inference + training ENTIRELY on chip. here's how I did it👇:

356,700 просмотров • 1 год назад •via X (Twitter)

Комментарии: 48

Фото профиля surya
surya1 год назад

I worked on this with @evanliin, @XanderChin, and @kennykgguo — incredibly smart people! check out our article to see how our chip works and how we went about developing it: you can also find the code here and play with it yourself:

Фото профиля surya
surya1 год назад

our first step was to decide the scale of this project. we decided to target the simplest possible neural network — the XOR problem. however, we still wanted to make this scalable so a core design philosophy for us was to ensure all of our mechanisms could scale to larger networks.

Фото профиля surya
surya1 год назад

before we got to designing any hardware, we started off with properly understanding the math behind MLPs. we worked out the math by hand for inference and training of our network.

Фото профиля surya
surya1 год назад

then we build the heart of any TPU: the systolic array! each processing element (PE) in the systolic array performs a multiply-accumulate in one clock cycle. when connected in a grid, multiple output matrix elements compute simultaneously. this allows us to very efficiently perform matrix multiplication, the most compute-heavy operation in neural networks!

Фото профиля surya
surya1 год назад

the next operation is adding the bias, for which we made a bias module. since this is an element wise operation, we placed 2 bias modules right under the systolic array (one for each column). we structured the activation module similarly — we chose the leaky ReLU and placed one module under each column of the systolic array.

Фото профиля surya
surya1 год назад

however, we had a big problem with our systolic array — computation at the end of every layer to load in the weights of the new layer (this was negligible with a 2x2 systolic array, but it would very inefficient if we scaled it) to solve this, we introduced double buffering to the systolic array. Each PE in the systolic array would have two buffers — an active and inactive buffer. while the outputs of the previous layer are being computed, we can load in the weights of the next layer in the inactive buffers. once the previous layer is finished, we can instantly start computation on the next layer. this nearly DOUBLES the speed of our TPU when we scaled to a larger systolic array size.

Фото профиля surya
surya1 год назад

now we can move on to training! this was easily the most challenging part since we couldn’t find any resource where someone has done this before. a key insight we had while doing the math for training was that the long chain in the computational graph of the backdrop was identical to the forward pass computation graph. this meant we could calculate the long chain first, cache the gradients and then compute the individual weight and bias gradients!

Фото профиля surya
surya1 год назад

the only problem was...we didn't have any on-chip to store the gradients (LOL) so we decided to make a unified buffer. as we developed this, we realized the unified buffer could replace our accumulators as well, making our design more elegant!

Фото профиля surya
surya1 год назад

the VPU was the next big change we made. all those modules UNDERNEATH the systolic array (bias, activation, loss, derivatives) process column vectors element-wise. we unified them into one scalable unit with pathway bits to enable/skip operations, which is a lot more elegant than interfacing with N number of individual modules (N scales with systolic array size).

Фото профиля surya
surya1 год назад

and finally, here's our 94-bit VLIW instruction set:

Фото профиля surya
surya1 год назад

this was our final TPU architecture:

Фото профиля surya
surya1 год назад

having no hardware knowledge or experience at all until just 6 months ago, this was a very ambitious project to work on. I had no idea how difficult this would be or if I could even complete it without the "prerequisites". but throughout the last 4 months, I developed a style of thinking and solving problems that I can carry forward with me. it can be encompassed by these two philosophies: - always try the dumb ideas first - DRAW EVERYTHING OUT to TRULY understand a concept you can read more about our background and thought process at and with that here's our final waveform that shows the outputs of inference and training:

Фото профиля Lloret
Lloret1 год назад

Bro’s bout to receive a job offer from an AI lab

Фото профиля evan
evan1 год назад

@karpathy

Фото профиля Xander Chin
Xander Chin1 год назад

greatest thing ive ever helped create

Фото профиля Thread Reader App
Thread Reader App1 год назад

Your thread is going viral! #TopUnroll 🙏🏼@ain3sh for 🥇unroll

Фото профиля krupa
krupa1 год назад

@karpathy ‼️

Фото профиля Noah Vandal
Noah Vandal1 год назад

wow this is very nice. were you at all tempted to use verilog and fpgas?

Фото профиля surya
surya1 год назад

yes we did use verilog to build this if you look at we did everything in simulation so far, but plan to deploy on an fpga very soon

Фото профиля Noah Vandal
Noah Vandal1 год назад

wow that is cool

Фото профиля saksham
saksham1 год назад

@karpathy

Фото профиля sλrthak
sλrthak1 год назад

this guy is CRACKED af

Фото профиля evan
evan1 год назад

best teammates i could ask for 🫶

Фото профиля Priyav K Kaneria
Priyav K Kaneria1 год назад

love it when randomly some cracked team shows up with something cooked up hard

Фото профиля Peaboff
Peaboff1 год назад

Nice, I did a project like this too. Implemented it for the DE1-SoC + TensorFlow compatible quantization. The hardest part is wrapping your head around the quantization and wrangling all the hardware bits. I remember I was having so much difficulty getting the DMA reading to work

Фото профиля mikael haji
mikael haji1 год назад

🔥

Фото профиля richa 👩‍💻
richa 👩‍💻1 год назад

@devpatelio KILLED IT

Фото профиля yash karthik
yash karthik1 год назад

Cool!

Фото профиля Satvik Garimella
Satvik Garimella1 год назад

This was a great read!

Фото профиля Little Architect
Little Architect1 год назад

very nice work. you should try parametrizing your buffer sizes, pe sizes, and of course the systolic array num elements and do some sweeps on those to get some insights on the scaling you can get on lat and throughput, the balance needed for bw/compute and hw costs.

Фото профиля saksham
saksham1 год назад

inspirational bro

Фото профиля braeden hall
braeden hall1 год назад

i dont understand it, but its cool asf

Фото профиля dhruvr_43
dhruvr_431 год назад

Yoooo bro went viral. Congrats tho inspirational fr

Фото профиля Andy
Andy1 год назад

this is crazy!!!

Фото профиля Satvik Garimella
Satvik Garimella1 год назад

Very informative

Фото профиля omkaar
omkaar1 год назад

i think @Si_Boehm's diagrams were in the spirit of this article

Фото профиля ταῦ
ταῦ1 год назад

Dope! 🔥

Фото профиля chi
chi1 год назад

incredible

Фото профиля Milind Kumar
Milind Kumar1 год назад

Jeez big man, let’s gooo! 💪

Фото профиля Satvik Garimella
Satvik Garimella1 год назад

Wowwww. Greattttt

Фото профиля tornikeo
tornikeo1 год назад

This is literally you guys 😅 this is some actually impressive stuff. Also the blog reads very well! Nice work!

Фото профиля Lingstr
Lingstr1 год назад

Great post, I see lot of research is done behind this. Thanks for sharing this

Фото профиля cumalot daddy
cumalot daddy10 месяцев назад

Thanks for sharing your work. I have been looking for something like this.

Фото профиля Aayush
Aayush1 год назад

goat 🐐

Фото профиля Hazel Bains
Hazel Bains1 год назад

🔥super impressive growth in 6 months

Фото профиля Atif Saleem
Atif Saleem1 год назад

Are you launching your inference cloud with competitive pricing without compromising on performance? Or is it just open-source? Need to read more about this

Фото профиля unathi 🇿🇦
unathi 🇿🇦1 год назад

fire!

Фото профиля grasgor
grasgor10 месяцев назад

Insane

Похожие видео