Refactor: inline ring buffer hot paths and expand scheduler API#158
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly refactors core runtime components, primarily focusing on performance and API consistency. By inlining critical ring buffer allocation functions and integrating scheduler task management directly into the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
- Move pto2_heap_ring_alloc and pto2_task_ring_alloc from .cpp to .h as inline member methods for better codegen on hot allocation paths - Add spinlock-based ready queue, release_fanin_and_check_ready, and init_task as PTO2SchedulerState member methods - Convert pto2_task_slot to scheduler member method - Update orchestrator call sites for new member APIs
e1b313c to
0135388
Compare
There was a problem hiding this comment.
Code Review
This pull request effectively refactors hot-path functions for inlining and enhances the scheduler's concurrency model with spinlocks and optimized atomic operations, aiming to improve performance and thread safety. However, it introduces several critical security vulnerabilities, including a buffer overflow in task submission due to missing parameter count validation, an integer overflow in output size calculation that can lead to heap corruption, and a race condition in the scheduler's ring pointer management. Additionally, a logic error in the dependency resolution mechanism will cause tasks with no dependencies to hang, resulting in a denial of service. These issues should be addressed before merging.
…ative-sys#158) - Move pto2_heap_ring_alloc and pto2_task_ring_alloc from .cpp to .h as inline member methods for better codegen on hot allocation paths - Add spinlock-based ready queue, release_fanin_and_check_ready, and init_task as PTO2SchedulerState member methods - Convert pto2_task_slot to scheduler member method - Update orchestrator call sites for new member APIs
Summary
pto2_heap_ring_alloc,pto2_task_ring_alloc) from.cppinto.has member methodspto2_ready_queue_push/get_ready_task/on_task_complete)pto2_task_slotandpto2_scheduler_init_tasktoPTO2SchedulerStatemember methodsrelease_fanin_and_check_readyfor atomic fanin arrive patternTesting
./ci.sh -p a2a3sim— 10/10)