-
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
[PTen] Tidy pten core headers #39188
[PTen] Tidy pten core headers #39188
Conversation
Thanks for your contribution! |
… pten/open_headers_for_custom_kernel
… pten/open_headers_for_custom_kernel
@@ -126,8 +129,8 @@ paddle::framework::proto::VarType::Type TransToProtoVarType( | |||
} | |||
} | |||
|
|||
paddle::framework::LoD TransToFluidLoD(const pten::LoD& lod) { | |||
paddle::framework::LoD out; | |||
pten::LoD TransToFluidLoD(const pten::LoD& lod) { |
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.
TransToFluidLoD
这个转换函数是不是可以去掉了?
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.
done, thx
@@ -136,7 +139,7 @@ paddle::framework::LoD TransToFluidLoD(const pten::LoD& lod) { | |||
return out; | |||
} | |||
|
|||
pten::LoD TransToPtenLoD(const paddle::framework::LoD& lod) { | |||
pten::LoD TransToPtenLoD(const pten::LoD& lod) { |
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.
同上
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.
done, thx
paddle/pten/core/kernel_factory.h
Outdated
#include "paddle/pten/core/convert_utils.h" | ||
#include "paddle/pten/core/kernel_def.h" | ||
#include "paddle/pten/core/compat/convert_utils.h" | ||
#include "paddle/pten/core/type_defs.h" | ||
|
||
// See Note [ Why still include the fluid headers? ] |
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.
这行注释可以删除了
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.
done, thx
paddle/pten/core/storage.h
Outdated
namespace pten { | ||
|
||
/// \brief The interface of contiguous storage used for the dense tensor. | ||
/// It should be used in conjunction with the intrusive pointer. We prohibit | ||
/// all default copy operations to ensure the integrity of the package. | ||
class Storage : public intrusive_ref_counter<Storage> { | ||
public: | ||
using Place = paddle::platform::Place; | ||
using Place = pten::Place; |
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是不是可以去掉?
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.
done, thx
paddle/pten/core/storage.h
Outdated
}; | ||
|
||
class TensorStorage : public Storage { | ||
public: | ||
using Place = paddle::platform::Place; | ||
using Place = pten::Place; |
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.
同上
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.
done, thx
paddle/pten/core/tensor_base.h
Outdated
using DDim = pten::framework::DDim; | ||
using Place = paddle::platform::Place; | ||
using Place = pten::Place; |
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.
同上
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.
done, thx
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
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 for op_benchmark
PR types
New features
PR changes
Others
Describe
[PTen] Open pten core headers for custom kernel
pten中的头文件,都是面向API的设计,将来会作为api开发给外部用户进行二次开发,相比fluid来讲,需要更加严谨、规范,且需要时常整理。
剩余还无法移除依赖的头文件包括
自定义kernel PR:#38848
安装paddle之后,
#include "paddle/pten/include/core.h"
,即可在外部使用pten/core的组件目前pten和fluid的源码拆分工作还在进行中,如上所述,pten还有一些基础组件依赖fluid,预计会在推全之前拆分完成,但由于需要兼容fluid的原因,也做不到完全隔离,比如
#include "paddle/fluid/memory/malloc.h"
在较长时间内都会依赖,可能需要自定义Kernel封装对应的宏,以隔离相应头文件,例如