Draft
Conversation
lljbash
reviewed
Apr 22, 2024
lljbash
requested changes
Apr 22, 2024
| #define DIOPI_ATEN_FUNC(opname, diopiFunc, wapperFunc) \ | ||
| #define addAutoCompare(wrapperFunc) wrapperFunc##_autocompare | ||
| #define DIOPI_ATEN_FUNC(opname, diopiFunc, wrapperFunc) \ | ||
| do { \ |
| } while (false); | ||
|
|
||
| #define DIOPI_ATEN_FUNC_DISABLE_AUTOCOMPARE(opname, diopiFunc, wrapperFunc) \ | ||
| do { \ |
| // "SPECIFIED_AUTOCOMPARE_OPS_LIST"; specified_autocompare_config_name = | ||
| // ".specified_autocompare_op_list.config" | ||
|
|
||
| namespace dipu { |
Collaborator
Author
There was a problem hiding this comment.
我把正则匹配相关的函数和变量放到了namespace dipu::opRegexMatch下面
Collaborator
Author
There was a problem hiding this comment.
多数场景下,算子匹配并不会用到很复杂的正则的语法,在readme里面多给几个常用的场景的示例就可以了。
但如果换成wildcard,灵活性会差很多,可能不能满足一些极端场景的需求
Member
|
copy 是否已支持 autocompare,是不是要把 disable 去掉 |
Co-authored-by: Lingjie <lljbash@gmail.com>
lljbash
reviewed
Apr 23, 2024
Member
lljbash
left a comment
There was a problem hiding this comment.
之前 comment 的逻辑简化依然应该做,if else 那堆现在特别难读
| // "SPECIFIED_AUTOCOMPARE_OPS_LIST"; specified_autocompare_config_name = | ||
| // ".specified_autocompare_op_list.config" | ||
|
|
||
| namespace dipu { |
| return list; | ||
| } | ||
|
|
||
| bool whetherOpMatch(const char* opname, |
Member
There was a problem hiding this comment.
Suggested change
| bool whetherOpMatch(const char* opname, | |
| bool isOpMatch(const char* opname, |
lljbash
reviewed
Apr 23, 2024
lljbash
reviewed
Apr 23, 2024
Comment on lines
16
to
21
| extern const char* const fallback_env_name; | ||
| extern const char* const fallback_config_name; | ||
| extern const std::vector<std::regex> fallbackMatchers; | ||
|
|
||
| extern const char* const specified_autocompare_env_name; | ||
| extern const char* const specified_autocompare_config_name; |
Member
There was a problem hiding this comment.
const char* 不用 extern,用 constexpr
lljbash
reviewed
Apr 23, 2024
dipu/QuickStart.md
Outdated
Comment on lines
223
to
227
| - 可以通过设置环境变量`SPECIFIED_AUTOCOMPARE_OPS_LIST=‘.*’`,开启全局的精度对比,这种情况下所有调用的算子都会进行精度对比。 | ||
|
|
||
| ```shell | ||
| # 开启全局的算子精度自动对比功能 | ||
| export SPECIFIED_AUTOCOMPARE_OPS_LIST=‘.*’ |
Member
There was a problem hiding this comment.
Suggested change
| - 可以通过设置环境变量`SPECIFIED_AUTOCOMPARE_OPS_LIST=‘.*’`,开启全局的精度对比,这种情况下所有调用的算子都会进行精度对比。 | |
| ```shell | |
| # 开启全局的算子精度自动对比功能 | |
| export SPECIFIED_AUTOCOMPARE_OPS_LIST=‘.*’ | |
| - 可以通过设置环境变量`SPECIFIED_AUTOCOMPARE_OPS_LIST='.*'`,开启全局的精度对比,这种情况下所有调用的算子都会进行精度对比。 | |
| ```shell | |
| # 开启全局的算子精度自动对比功能 | |
| export SPECIFIED_AUTOCOMPARE_OPS_LIST='.*' |
lljbash
reviewed
Apr 23, 2024
|
|
||
| ```shell | ||
| # 指定匹配add.*?的算子进行自动精度对比 | ||
| export DIPU_AUTOCOMPARE_OPS_LIST=add.*? |
Collaborator
Author
lljbash
approved these changes
Apr 25, 2024
Comment on lines
+64
to
+76
| constexpr const char* fallback_env_name = "DIPU_FORCE_FALLBACK_OPS_LIST"; | ||
| constexpr const char* fallback_config_name = | ||
| ".dipu_force_fallback_op_list.config"; | ||
| const std::vector<std::regex> fallbackMatchers = | ||
| dipu::op_regex_match::loadMatcher(fallback_env_name, fallback_config_name); | ||
|
|
||
| constexpr const char* specified_autocompare_env_name = | ||
| "DIPU_AUTOCOMPARE_OPS_LIST"; | ||
| constexpr const char* specified_autocompare_config_name = | ||
| ".specified_autocompare_op_list.config"; | ||
| const std::vector<std::regex> autocompareMatchers = | ||
| dipu::op_regex_match::loadMatcher(specified_autocompare_env_name, | ||
| specified_autocompare_config_name); |
Member
|
FYI: clang-format 根目录有个脚本可以用 |
lljbash
reviewed
Apr 25, 2024
| else { \ | ||
| m.impl(opname, TORCH_FN(wrapper_func)); \ | ||
| } \ | ||
| #define CONCAT_NAME(a, b) a##b |
Member
There was a problem hiding this comment.
我记得这样是不会展开 a 和 b 的,还得加一层。
不过我们某个头文件里可能已经实现这个基础设施了,没有的话也应该加在那里,因为这个很基础
或者用 C10_CONCATENATE
而且宏绝对不能这么起名字,太容易撞了
xuq7410
pushed a commit
to xuq7410/deeplink.framework
that referenced
this pull request
May 23, 2024
* fix cat bug * use cast in op-plugin and optimize cat * skip cat double test case * enhance empty check * remove OpCommandImpls relate * use diopiCopyInp and diopiDtypeCast * fallback cast to cpu * skip some test case: contiguous to no contiguous * fix copy and cast bug * support stride_copy_support double * enable some test case * skip double test case in copy
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.

重构autocompare,autocompare功能的开启或关闭不再依赖编译,和DIPU_AUTOCOMPARE_OPS_LIST来设置autocompare功能,可以指定算子进行autocompare。