Fireship · @fireship

Mind-bending new programming language for GPUs just dropped...

Uploaded May 17, 2024 · Length 4:01

Mind-bending new programming language for GPUs just dropped...

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.

  1. 0:00

    yesterday the clouds opened up and a

  2. 0:01

    weird new programming language came down

  3. 0:03

    to earth with a promise of parallelism

  4. 0:05

    for allou who writeth code this is big

  5. 0:08

    if true because parallel Computing is a

  6. 0:09

    superpower it allows a programmer to

  7. 0:11

    take a problem that could be solved in a

  8. 0:13

    week and instead solve it in seven days

  9. 0:15

    using seven different computers

  10. 0:16

    unfortunately running code in parallel

  11. 0:18

    is like conducting a symphony one wrong

  12. 0:20

    note and the entire thing becomes a

  13. 0:22

    total disaster but luckily Bend offers

  14. 0:24

    Hope by making a bold promise everything

  15. 0:26

    that can run in parallel will run in

  16. 0:28

    parallel you don't need to know anything

  17. 0:30

    about Cuda blocks locks mutexes or

  18. 0:32

    regex's to write algorithms that take

  19. 0:35

    advantage of all 24 of your CPU cores or

  20. 0:37

    even all 16,000 of your GPU cores you

  21. 0:40

    just write some highlevel python looking

  22. 0:42

    code and the rest is Magic it is May

  23. 0:44

    17th 2024 and you're watching the code

  24. 0:47

    report when you write code in a language

  25. 0:48

    like python your code runs on a single

  26. 0:50

    thread that means only one thing can

  27. 0:52

    happen at a time it's like going to a

  28. 0:54

    KFC with only one employee who takes the

  29. 0:56

    order cleans the toilets and Cooks the

  30. 0:57

    food in that order now on a modern CPU

  31. 1:00

    you might have a clock cycle around 4

  32. 1:01

    GHz and if it's handling one instruction

  33. 1:04

    per cycle you're only able to perform 4

  34. 1:06

    billion instructions per second now if

  35. 1:08

    four giips is not enough you can modify

  36. 1:10

    your python code to take advantage of

  37. 1:12

    multiple threads but it adds a lot of

  38. 1:14

    complexity to your code and there's all

  39. 1:16

    kinds of gotas like race conditions

  40. 1:18

    Deadlocks thread starvation and may even

  41. 1:20

    lead to conflicts with demons even if

  42. 1:22

    you do manage to get it working you

  43. 1:24

    might find that your CPU just doesn't

  44. 1:25

    have enough juice at which point you

  45. 1:27

    look into using the thousands of cacor

  46. 1:29

    on your GPU you but now you'll need to

  47. 1:31

    write some C++ code and likely blow your

  48. 1:33

    leg off in the process well what if

  49. 1:34

    there is a language that just knew how

  50. 1:36

    to run things in parallel by default

  51. 1:38

    that's the promise of Bend imagine we

  52. 1:39

    have a computation that adds two

  53. 1:41

    completely random numbers together in

  54. 1:43

    Python The Interpreter is going to

  55. 1:44

    convert this into B code and then

  56. 1:46

    eventually run it on the python virtual

  57. 1:48

    machine pretty simple but in Bend things

  58. 1:50

    are a little more complex the elements

  59. 1:52

    of the computation are structured into a

  60. 1:54

    graph which are called interaction

  61. 1:55

    combinators you can think of it as a big

  62. 1:57

    network of all the computations that

  63. 1:59

    need to be done when two nodes run into