Real-time Confessions in C++ - Fabian Renn-Giles - ADC23

แชร์
ฝัง
  • เผยแพร่เมื่อ 28 ก.ย. 2024
  • audio.dev/ -- @audiodevcon​
    _
    Real-time Confessions in C++: The Most Common “Sins” in Real-Time Code - Fabian Renn-Giles - ADC 2023
    This talk examines the most prevailing misconceptions and frequent errors encountered when audio developers handle real-time code in C++. With my background as a contractor in the audio industry, I’m often called in to help fix subtle bugs in, or review code with real-time constraints. Yet, I see (and have myself made) the same type of mistakes over and over again resulting from a few common misconceptions of real-time C++ code.This talk offers an in-depth analysis of each of these misconceptions, debunking them with compelling examples from the audio industry.
    Ranging from the ignorance of C++'s data-safety rules altogether, to the overuse of std::atomic and misbeliefs about the forbidden usage of locks and exceptions in real-time code, this presentation navigates the landscape between the theoretical rules of the C++ standard and real-world practical realities. This talk is an essential guide for developers seeking to avoid common pitfalls and write more efficient, reliable real-time code.
    _
    Link to Slides: docs.google.co...
    _
    Fabian Renn-Giles
    Fabian is a freelance C++ programmer, entrepreneur and consultant in the audio software industry. Before this, he was staff engineer at ROLI Ltd. and the lead maintainer/developer of the JUCE C++ framework (www.juce.com) - an audio framework used by thousands of commercial audio software companies. Before joining ROLI, he completed his PhD at Imperial College London, developing a numerical quantum optics solver with modern digital signal processing techniques and C++/MPI/OpenCL. Fabian is now a regular consultant specializing on low-level real-time C++, embedded audio, time sensitive networks, audio over WiFi and audio plug-in formats. His clients range from early startups to FAANG companies. Additionally, he is a regular speaker at the audio developer conference ADC and other C++ conferences.
    _
    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 #audiodev #cppprogramming #audio

ความคิดเห็น • 7

  • @Voy2378
    @Voy2378 6 หลายเดือนก่อน

    44:50 explanation is very confusing, e.g. what if I reorder the lines with wpos and rpos, why is wpos atomic... But more importantly why not just recommend a library instead of encouraging people to write their own broken atomic code?
    Oh and obviously his clever atomic stuff does not matter since he will probably get false sharing between wpos and rpos.

  • @Heater-v1.0.0
    @Heater-v1.0.0 5 หลายเดือนก่อน

    I agree one should employ good tooling and diagnostics to tackle the problems described here. So let's start with using a language the detects a lot of those problems at compile time.

  • @Voy2378
    @Voy2378 6 หลายเดือนก่อน

    51:22 why have array of atomics, I presume asm will be generating atomic instruction for every float, should be much faster to batch the writes to nonatomic array and guard that batch write?

  • @constexprDuck
    @constexprDuck 6 หลายเดือนก่อน +1

    9:14 I don't understand Sin #2. Isn't the underlying issue having UB in the code? I haven't finished the talk yet, I'm sorry if this will be addressed later.

    • @Voy2378
      @Voy2378 6 หลายเดือนก่อน

      That is what he said: UB lead to optimization that "broke"(it was broken already) program.

    • @FabianRenn
      @FabianRenn 5 หลายเดือนก่อน

      Yes, you are exactly right. The underlying issue is that there is UB in the code. The sin is that some people think that - even though it is UB - it will never have negative consequences on their platform. The argument goes something like this: "The C++ rules only mark concurrent access as UB because CPUs re-order loads/stores, have caches etc. But my micro embedded controller has no load/store, cache, and so even though my code is UB, it will still work in practice on my CPU". I should have made this clearer in the talk.

  • @friendlywavingrobot
    @friendlywavingrobot 6 หลายเดือนก่อน

    Great talk!