-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PHI decoupling] simplify "convert_utils.h" in fluid #48168
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
inline proto::VarType::Type TransToProtoVarType(const DataType& dtype) { | ||
return static_cast<proto::VarType::Type>(phi::TransToProtoVarType(dtype)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
添加这个函数而不是直接使用 using
是因为 phi
中的 TransToProtoVarType
返回的是 int
类型的值,如果将 TransToProtoVarType
的返回值赋给某个 proto::VarType::Type
类型的参数编译就会报错,因为不存在 int
到枚举类型的自动转换。
paddle/phi/core/utils/data_type.h
Outdated
inline std::string DataType2String(DataType dtype) { | ||
// We can't depend on the fluid proto::VarType | ||
// so we copy part of fluid proto::VarType here. | ||
enum ProtoVarType { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里换个名字吧,Proto下的VarType是个比较广义的概念,它不仅包含了基本数据类型(int,float等),也包含了其他tensor的类型(Lod_tensor等),这里可以改名为ProtoDataType,这样就比较精准(当然你能想到更合适的名字也可以换一个),另外注释可以再详细一点,说明这里的枚举值与proto::VarType对应的,强调一下如果有修改的话,这里也需要同步进行修改
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的明白了
# or, the first one should depends on mkldnn | ||
if(WITH_MKLDNN) | ||
add_dependencies(convert_utils mkldnn) | ||
endif() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
试试在11行后加
if(WITH_MKLDNN)
set(convert_utils_deps ${convert_utils_deps} mkldnn)
endif()
去掉19-20行
@YuanRisheng ,可以再次 review 了 |
@luotao1 ,帮忙处理一下失败的 CI |
覆盖率流水线已豁免 |
@XiaoguangHu01 , request approval. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
该 PR 合入后会导致 develop 上所有 build 流水线失败,已经在 #48347 修复了,可以再观察下。 |
Sorry,给大家添麻烦了:cry:。 |
没事,合入后后续集成测试发现 Bug 的也有好多,是常态。
因为我们 CI 上有编译缓存在,可能是编译缓存的问题。 |
明白了,感谢 |
PR types
Others
PR changes
Others
Describe
[phi] Decoupled phi from fluid tracking issue #47615
之前已经清理了
phi
对convert_utils.h
的依赖 [PHI decoupling] remove "paddle/fluid/framework/convert_utils.h" in phi #48001这个 PR 本打算清理之前
phi
中意外引入的一个convert_utils.h
依赖同时移除cudnn_desc.h
依赖,但发现cudnn_desc.h
依赖了enforce.h
,这个比较麻烦,所以我稍微简化了一下fluid
下的convert_utils.h
.Changes:
paddle/phi/common/data_type.h
中已经存在了Sizeof
(获取DataType
字节)以及DataTypeToString
这两个函数,这与convert_utils.h
中的DataType2String
(之前移动到了phi
下) 和DataTypeSize
的功能一致,所以移除了convert_utils.h
中的两个函数,并替换相关调用。convert_utils.h
中的TransToPhiDataType
和TransToProtoVarType
与我们之前写的两个map
映射的功能重复了,因为convert_utils.h
中的两个函数考虑的更加全面,然后我将这个两个函数移动到paddle/phi/core/utils/data_type.h"
中,并删除了原来写的map
, 同时替换相关调用。convert_utils.cc
,同时convert_utils.h
中使用using
,本来想完全移除convert_utils.h
,但是依赖它的文件太多了。