Fireship · @fireship
Mind-bending new programming language for GPUs just dropped...
Uploaded May 17, 2024 · Length 4:01
Summary
Fireship explains Bend, a new programming language for parallel computing on GPUs, with examples and performance comparisons.
- bend programming language
- gpu parallel computing
- cuda
- rust language
- high-performance computing
Transcript preview
The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.
- 0:00
yesterday the clouds opened up and a
- 0:01
weird new programming language came down
- 0:03
to earth with a promise of parallelism
- 0:05
for allou who writeth code this is big
- 0:08
if true because parallel Computing is a
- 0:09
superpower it allows a programmer to
- 0:11
take a problem that could be solved in a
- 0:13
week and instead solve it in seven days
- 0:15
using seven different computers
- 0:16
unfortunately running code in parallel
- 0:18
is like conducting a symphony one wrong
- 0:20
note and the entire thing becomes a
- 0:22
total disaster but luckily Bend offers
- 0:24
Hope by making a bold promise everything
- 0:26
that can run in parallel will run in
- 0:28
parallel you don't need to know anything
- 0:30
about Cuda blocks locks mutexes or
- 0:32
regex's to write algorithms that take
- 0:35
advantage of all 24 of your CPU cores or
- 0:37
even all 16,000 of your GPU cores you
- 0:40
just write some highlevel python looking
- 0:42
code and the rest is Magic it is May
- 0:44
17th 2024 and you're watching the code
- 0:47
report when you write code in a language
- 0:48
like python your code runs on a single
- 0:50
thread that means only one thing can
- 0:52
happen at a time it's like going to a
- 0:54
KFC with only one employee who takes the
- 0:56
order cleans the toilets and Cooks the
- 0:57
food in that order now on a modern CPU
- 1:00
you might have a clock cycle around 4
- 1:01
GHz and if it's handling one instruction
- 1:04
per cycle you're only able to perform 4
- 1:06
billion instructions per second now if
- 1:08
four giips is not enough you can modify
- 1:10
your python code to take advantage of
- 1:12
multiple threads but it adds a lot of
- 1:14
complexity to your code and there's all
- 1:16
kinds of gotas like race conditions
- 1:18
Deadlocks thread starvation and may even
- 1:20
lead to conflicts with demons even if
- 1:22
you do manage to get it working you
- 1:24
might find that your CPU just doesn't
- 1:25
have enough juice at which point you
- 1:27
look into using the thousands of cacor
- 1:29
on your GPU you but now you'll need to
- 1:31
write some C++ code and likely blow your
- 1:33
leg off in the process well what if
- 1:34
there is a language that just knew how
- 1:36
to run things in parallel by default
- 1:38
that's the promise of Bend imagine we
- 1:39
have a computation that adds two
- 1:41
completely random numbers together in
- 1:43
Python The Interpreter is going to
- 1:44
convert this into B code and then
- 1:46
eventually run it on the python virtual
- 1:48
machine pretty simple but in Bend things
- 1:50
are a little more complex the elements
- 1:52
of the computation are structured into a
- 1:54
graph which are called interaction
- 1:55
combinators you can think of it as a big
- 1:57
network of all the computations that
- 1:59
need to be done when two nodes run into


