-
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]Change Copy from Kernel to basic component utils #43622
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
auto kernel = phi::KernelFactory::Instance().SelectKernelOrThrowError( | ||
"copy", kernel_key); | ||
VLOG(6) << "copy API kernel: " << kernel; | ||
VLOG(6) << "start copy. "; |
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.
log用start copy
的话感觉还需要一个finish copy
来对应
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
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
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
…3622) * perfect copy * deal with conflict * deal with conflict * fix compile bugs * fix unittest bugs * change code format * deal with conflict * modify code by review * fix ce bugs * fix ce bugs * add lo * perfect code format * deal with conflicts
PR types
Others
PR changes
Others
Describe
当前的CopyKernel存在一些局限性:
1,推理需要kernel里不使用单例,而当前的CopyKernel里存在使用单例的情况且在Kernel里不太好去除。
2,Kernel的形式只能传递一个dev_context参数,而实际的Copy功能有传递俩个dev_context参数的需求。
3,根据datatype,layout,backend等不同可以来区分不同kernel,而copy在算子库中应该是一个工具类的存在,datatype,backend等的不同得出不同的copy是不太合理的。
该PR主要功能将Copy由Kernel变为基础组件工具:
1,去掉原来的copy_kernel(包括文件,kernel注册),取而代之得是tensor_utils.h中的Copy工具函数
2,将所有使用copy_kernel的地方修改为使用tensor_utils.h下的Copy函数。
后续TODO:
1,优化Copy功能实现,拓展俩个dev_context实现接口。
2,去除掉copy里边的单例使用。