refactor: adapt dispatcher for full C++17 compatibility and support pip install on MetaX#5
Open
Ziminli wants to merge 5 commits intofeat/dev-infrafrom
Open
refactor: adapt dispatcher for full C++17 compatibility and support pip install on MetaX#5Ziminli wants to merge 5 commits intofeat/dev-infrafrom
pip install on MetaX#5Ziminli wants to merge 5 commits intofeat/dev-infrafrom
Conversation
- dispatcher now does not depend on C++20 features - udpate the current dispatcher use cases - add some relevant constexpr traits in common/traits.h - add `PYBIND_ENABLE_EXTRAS` internal cmake variable for controlling the flags introduced by pybind
voltjia
requested changes
Feb 28, 2026
| template <auto... Items> | ||
| struct List {}; | ||
|
|
||
| // ListGet<I>(List<Items...>{}) extracts the Ith value from a List tag. |
Collaborator
There was a problem hiding this comment.
先检查所有模板参数中的非类型参数的命名,应该按照变量来,比如应该是 i 而不是 I。之后检查注释和报错信息中代码是否使用了 Markdown,如:`ListGet<i>(List<items...>{})` extracts the `i`th value from a `List` tag.。后面同理,同类问题先不 comment 了,统一处理即可。
| // ----------------------------------------------------------------------------- | ||
|
|
||
| // Checks if a Functor's template operator()<Value> can be called with Args. | ||
| // Checks if a Functor can be called with a ValueTag<Value> and Args... |
Collaborator
There was a problem hiding this comment.
这个地方着重说一下,怕改错了,正常英文如果结尾是 "..." 就不需要额外的句号,但是改成 Markdown 语法后还需要额外加,因为代码段里的点不算真正的英文句号。
CMakeLists.txt
Outdated
| set(CMAKE_CXX_STANDARD 17) | ||
| set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
|
|
||
| # Internal variable to control pybind11's automatic optimization flags (like -flto) |
CMakeLists.txt
Outdated
| set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
|
|
||
| # Internal variable to control pybind11's automatic optimization flags (like -flto) | ||
| set(PYBIND_ENABLE_EXTRAS ON) |
Collaborator
There was a problem hiding this comment.
改成 PYBIND11_ENABLE_EXTRAS 吧。
src/dispatcher.h
Outdated
| : false)); | ||
|
|
||
| if (!handled) { | ||
| std::cerr << "Dispatch error (void): Value " << static_cast<int>(value) |
Collaborator
There was a problem hiding this comment.
报错信息格式有问题,请参考相关飞书文档。下同,建议严查全篇。
b06f7b6 to
87bd2c0
Compare
…, `common/constexpr_map.h` and `dispatcher.h`
87bd2c0 to
1740234
Compare
pip install
pip installpip install on MetaX
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TL;DR: Refactors the dispatcher to remove C++20-specific features and ensure full C++17 compatibility, and support
pip install .[dev]on MetaX.Key Changes
Dispatcher Refactor:
Support Pytest on MetaX:
mxcc) does not support. By adding a wrapper script, it processes the flags and makepip installwork.Support Auto-detection on MetaX:
InfiniOpscan just dopip install .[dev]instead ofpip install .[dev] -C cmake.define.WITH_CPU="ON" -C cmake.define.WITH_METAX="ON".Fix Styling Issues:
common/traits.h,common/constexpr_map.handsrc/dispatcher.h.Known Issues & Future Work: