Join Us For ADC24 - Bristol - 11-13 November 2024
More Info: https://audio.dev/
@audiodevcon
Fast Audio Thread Synchronization for GPU Data - Evan Mezeske - ADC 2023
While building my GPU-based physics simulation instrument Anukari (https://www.youtube.com/watch?v=nUO6iMcbao4), 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 (https://www.youtube.com/@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! https://discord.gg/ywwYfhGbDp
_
Streamed & Edited by Digital Medium Ltd: https://online.digital-medium.co.uk
_
Organized and produced by JUCE: https://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