Fast Audio Thread Synchronization for GPU Data - Evan Mezeske - ADC23
ฝัง
- เผยแพร่เมื่อ 3 ต.ค. 2024
- Join Us For ADC24 - Bristol - 11-13 November 2024
More Info: audio.dev/
@audiodevcon
Fast Audio Thread Synchronization for GPU Data - Evan Mezeske - ADC 2023
While building my GPU-based physics simulation instrument Anukari ( • Introducing Anukari ), I had to solve a number of significant challenges, and I'll explain my solutions in this talk. The talk is not about Anukari per se; rather it's about some of the interesting solutions I developed as part of building it.
One challenge had to do with synchronizing the Anukari's data model from the GUI thread to the audio thread. Anukari models arbitrary networks of masses and springs, and can simulate close to a thousand masses and many thousands of springs. This data model is thus rather large, and it was nontrivial to provide model updates from the GUI to the audio thread. I designed a reliable wait-free approach that works without mutexes, without memory allocation, has support for transactions, and with minimal data transfer between threads. I will discuss a few technologies that I used together, including wait-free SPSC queues, the difference between wait-free and lock-free algorithms, reasons for avoiding mutexes and memory allocations, and custom data structures for avoiding memory allocations.
Another challenge was in regards to running GPU physics simulations at audio sample rates (48kHz). Memory bandwidth was a major issue, as well as kernel execution latency and cross-GPU-thread synchronization. I will discuss the OpenCL language and its limitations, the approaches I used to deal with OpenCL kernel execution latency, and the on-GPU thread synchronization, and memory optimizations..
And, of course, I will show how all of this ties together into a reliable system for synchronizing the GUI and audio threads with no waits, despite a large data model and compute-intensive physics simulation.
Prerequisite(s): Familiarity with C++ programming Familiarity with thread synchronization primitives like mutexes.
_
Evan Mezeske
Evan Mezeske is a software engineer and amateur musician based out of Arizona, USA. He spent the last 10 years working as a senior engineering leader on large-scale distributed systems at Google before defecting in early 2023 to found his music software company, Anukari Music. Anukari's upcoming eponymous flagship product will allow users to construct 3D arbitrary models of springs and masses and to manipulate them in real time to produce music, sound effects, and audio filters ( / @anukarimusic . Primarily a jazz guitarist, Evan also plays keyboards, produces electronic music, and enjoys learning obscure musical instruments (such as the two-chamber Peruvian Ocarina). Anyone interested in learning more about Anukari is encouraged to join Anukari's Discord server! / discord
_
Streamed & Edited by Digital Medium Ltd: online.digital...
_
Organized and produced by JUCE: juce.com/
_
Special thanks to the ADC23 Team:
Sophie Carus
Derek Heimlich
Andrew Kirk
Bobby Lombardi
Tom Poole
Ralph Richbourg
Jim Roper
Jonathan Roper
Prashant Mishra
#adc #cppprogramming #dsp #audio
Super innovative stuff. It's amazing what a bit of real low level engineering can unlock.
This was so much engaging to watch! Fun stuff :D
Looking fwd to more
ADC, could you please post the 20 minute Q&A for this session? I did not get to see it but am very interested in doing so
00:00 Introduction
00:47 What is Anukari?
02:43 Chapter 1: Thread Synchronization
09:38 Wait-free Diff Queue
21:38 Intermission: A Simple way to prove NO memory allocation
24:45 Chapter 2: GPU Computation
31:57 GPU synchronization bug: crazy physics explosion video
OpenCL is amazing. I wish it was the standard.
9:37 check immer library, copying doesnt have to be slow