Refactor custom allreduce logics#13710
Conversation
Summary of ChangesHello @iforgetmyname, 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 the custom allreduce implementations within the system. The primary goal is to enhance code clarity, maintainability, and robustness by centralizing platform-specific checks and separating the logic for different allreduce mechanisms. This prevents platform-specific import issues and warnings, leading to a cleaner and more efficient initialization process for distributed operations. Additionally, common utility functions are optimized for performance through caching. Highlights
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
|
There was a problem hiding this comment.
Code Review
This pull request refactors the logic for custom all-reduce operations by centralizing the availability checks into _custom_ops.py. This is a great improvement for code clarity and maintainability, as it removes duplicated checks and try-except blocks from multiple files. The addition of lru_cache to the platform-checking functions is also a nice optimization.
However, I've found a critical issue in the logic for determining the availability of the custom all-reduce feature, which would prevent it from being enabled on any platform. My review includes a specific comment with a suggested fix for this issue.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
|
/tag-and-rerun-ci |
|
/tag-and-rerun-ci |
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: Kangyan-Zhou <zky314343421@gmail.com> Co-authored-by: Lianmin Zheng <lianminzheng@gmail.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: Kangyan-Zhou <zky314343421@gmail.com> Co-authored-by: Lianmin Zheng <lianminzheng@gmail.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: Kangyan-Zhou <zky314343421@gmail.com> Co-authored-by: Lianmin Zheng <lianminzheng@gmail.com>
Motivation
_custom_ops.pyintroduced three kinds of customized allreduce implementation:However, due to the coarse-grained implementation, this file and any related imports often cause import errors or give useless but annoying warning messages on un-supported platforms. This pr is intended to help clearify and unify the definition logics, preventing duplicated condition checks.
Modifications
_custom_ops.pyto reduce try-catchesis_x()Accuracy Tests
Benchmarking and Profiling
Checklist