I loved this talk. He uses simple ideas and examples of "here is what compilers do kind of". Instead of overly unnecessary theoretical nomenclature - that often tend to be wrong or just not suitable. Loved the talk.
Huh, a lot of Coroutines _Experts_ in this talk. They could all get together and implement a Coroutines Library or help Eric Niebler with the integration into Senders and Receivers👌🏽 Anyways... Good job, Dian-Lun👏🏽
*Summary* *What are C++ Coroutines? (**0:41**)* * Functions that can suspend themselves and resume later, allowing for asynchronous, non-blocking code. * Similar to functions in Go and Python. * Simplify asynchronous programming by allowing code to appear concurrent within a single thread. * Can lead to improved performance and more readable code. *Why use C++ Coroutines? (**2:47**)* * Enable efficient multitasking by overlapping tasks, like CPU and GPU operations. * Provide greater expressiveness compared to splitting tasks into multiple functions and managing synchronization. *Four Components of C++ Coroutines: (**17:18**)* * *Coroutine: (**17:38**)* The function itself, defined using keywords like `co_await`, `co_yield`, or `co_return`. * *Promise: (**17:24**)* Controls the coroutine's behavior, including suspension points, exception handling, and return object creation. * *Awaitable: (**29:26**)* Determines the behavior at specific suspension points, allowing for customization beyond simple suspension. * *Coroutine Handle: (**36:03**)* A pointer-like object used to access the promise and resume the coroutine. *Scheduler Implementations Demonstrated: (**37:38**)* * *Single-Threaded Scheduler: (**37:38**)* Simple scheduler demonstrating basic coroutine execution. * *Multi-Threaded Scheduler: (**53:21**)* Utilizes multiple threads to execute coroutines concurrently, showcasing task distribution and synchronization. * *CPU-GPU Scheduler: (**59:44**)* Demonstrates efficient task scheduling by overlapping CPU and GPU operations using coroutines. *Performance Evaluation: (**1:06:21**)* * Benchmarking revealed a performance improvement when using coroutines for CPU-GPU workloads, especially with a larger number of tasks. * The overhead of using coroutines was minimal compared to the performance gains from efficient task overlapping. *Key Takeaways:* * C++ coroutines provide a powerful mechanism for writing asynchronous code. * Coroutines are particularly beneficial for heterogeneous computing environments with tasks that can be overlapped. * Understanding the four components of C++ coroutines is crucial for effective implementation and customization. * While powerful, effectively utilizing coroutines requires careful consideration of asynchronous API design and potential overhead. i summarized the transcript with gemini 1.5 pro
Thanks. Dian-Lun Lin can be heard with reasonable audio. The audience members have inferior audio. This degrades the listening experience. I am a little surprised that some moderator did not ask the audience to speak into a microphone. Can someone from CppNow make a comment on the audio quality? Lin himself can be seen using extra nano effort to hear the audience.
Excellent Content. 🥰 Please Make a complete tutorials: How to implements the OS Concept in C++ like, Memory Allocation and De-Allocation, Memory Management, Process Shcedulling, Semaphorse, Mutex, Virtual Memory and Secure Coding Concept. If you have already uploaded this, Kindly do share the link. thanks
Please please do not use this scheduler as a basis for your scheduler or thread pool, instead, have `sch.suspend()` (or better yet, `marshal()` and `yield()`) that returns an awaitable that will post the coroutine handle back onto the scheduler's queue or stack, otherwise your coroutine is forbidden from awaiting anything other than the scheduler. If you do await something else, then you will end up with a surreptitious resumption from the scheduler that accesses the incomplete awatable that was awaited. Additionally when the awaited thing completes, you will end up with a double `resume()` of your coroutine, causing all sorts of undefined behavior with the internal state machine
I loved this talk. He uses simple ideas and examples of "here is what compilers do kind of". Instead of overly unnecessary theoretical nomenclature - that often tend to be wrong or just not suitable.
Loved the talk.
Nice presentation and style
Huh, a lot of Coroutines _Experts_ in this talk.
They could all get together and implement a Coroutines Library or help Eric Niebler with the integration into Senders and Receivers👌🏽
Anyways...
Good job, Dian-Lun👏🏽
Awesome talk! That "compiler's view" comparison really clarifies things to me
*Summary*
*What are C++ Coroutines? (**0:41**)*
* Functions that can suspend themselves and resume later, allowing for asynchronous, non-blocking code.
* Similar to functions in Go and Python.
* Simplify asynchronous programming by allowing code to appear concurrent within a single thread.
* Can lead to improved performance and more readable code.
*Why use C++ Coroutines? (**2:47**)*
* Enable efficient multitasking by overlapping tasks, like CPU and GPU operations.
* Provide greater expressiveness compared to splitting tasks into multiple functions and managing synchronization.
*Four Components of C++ Coroutines: (**17:18**)*
* *Coroutine: (**17:38**)* The function itself, defined using keywords like `co_await`, `co_yield`, or `co_return`.
* *Promise: (**17:24**)* Controls the coroutine's behavior, including suspension points, exception handling, and return object creation.
* *Awaitable: (**29:26**)* Determines the behavior at specific suspension points, allowing for customization beyond simple suspension.
* *Coroutine Handle: (**36:03**)* A pointer-like object used to access the promise and resume the coroutine.
*Scheduler Implementations Demonstrated: (**37:38**)*
* *Single-Threaded Scheduler: (**37:38**)* Simple scheduler demonstrating basic coroutine execution.
* *Multi-Threaded Scheduler: (**53:21**)* Utilizes multiple threads to execute coroutines concurrently, showcasing task distribution and synchronization.
* *CPU-GPU Scheduler: (**59:44**)* Demonstrates efficient task scheduling by overlapping CPU and GPU operations using coroutines.
*Performance Evaluation: (**1:06:21**)*
* Benchmarking revealed a performance improvement when using coroutines for CPU-GPU workloads, especially with a larger number of tasks.
* The overhead of using coroutines was minimal compared to the performance gains from efficient task overlapping.
*Key Takeaways:*
* C++ coroutines provide a powerful mechanism for writing asynchronous code.
* Coroutines are particularly beneficial for heterogeneous computing environments with tasks that can be overlapped.
* Understanding the four components of C++ coroutines is crucial for effective implementation and customization.
* While powerful, effectively utilizing coroutines requires careful consideration of asynchronous API design and potential overhead.
i summarized the transcript with gemini 1.5 pro
Thanks. Dian-Lun Lin can be heard with reasonable audio. The audience members have inferior audio. This degrades the listening experience. I am a little surprised that some moderator did not ask the audience to speak into a microphone. Can someone from CppNow make a comment on the audio quality? Lin himself can be seen using extra nano effort to hear the audience.
Great talk, but the amount of the audience talking was distracting
13:30 my boi Fedor
After hearing some of his his cppcon talks I can't forget his voice lol
Excellent Content. 🥰
Please Make a complete tutorials: How to implements the OS Concept in C++ like, Memory Allocation and De-Allocation, Memory Management, Process Shcedulling, Semaphorse, Mutex, Virtual Memory and Secure Coding Concept. If you have already uploaded this, Kindly do share the link. thanks
Please please do not use this scheduler as a basis for your scheduler or thread pool, instead, have `sch.suspend()` (or better yet, `marshal()` and `yield()`) that returns an awaitable that will post the coroutine handle back onto the scheduler's queue or stack, otherwise your coroutine is forbidden from awaiting anything other than the scheduler. If you do await something else, then you will end up with a surreptitious resumption from the scheduler that accesses the incomplete awatable that was awaited. Additionally when the awaited thing completes, you will end up with a double `resume()` of your coroutine, causing all sorts of undefined behavior with the internal state machine
This would be great if there weren't so many hecklers in the crowd. Let the man speak and ask questions later. Thank you. Nice presentation, Dian-lun.