Skip to content

Conversation

zeroRains
Copy link
Contributor

PR Category

Others

PR Types

Others

Description

move fake_quantize_abs_max op to phi

Copy link

paddle-bot bot commented Apr 17, 2024

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@paddle-bot paddle-bot bot added the contributor External developers label Apr 17, 2024
@yuanlehome
Copy link
Contributor

看起来fluid下的kernel/functor实现并没有给删去,是为什么?

@zeroRains
Copy link
Contributor Author

看起来fluid下的kernel/functor实现并没有给删去,是为什么?

疏忽了,正在本地删除,晚点本地测试通过后commit


#pragma once

#include "paddle/common/hostdevice.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个头文件需要?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已移除

#pragma once

#include "paddle/common/hostdevice.h"
#include "paddle/phi/kernels/funcs/fake_quantize_functor.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个头文件可以在.cc中包含吧?需要挪过去

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.cc文件和.cu文件都涉及到fake_quantize_functor.h里的functor,所以我觉得因为.cc和.cu都要引fake_quantize_abs_max_kernel.h,所以直接在头文件里定义可能会比较好

Comment on lines +17 to +23
#include "paddle/phi/backends/all_context.h"
#include "paddle/phi/common/scalar.h"
#include "paddle/phi/common/transform.h"
#include "paddle/phi/core/dense_tensor.h"
#include "paddle/phi/kernels/funcs/blas/blas.h"
#include "paddle/phi/kernels/funcs/eigen/common.h"
#include "paddle/phi/kernels/impl/clip_kernel_impl.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hostdevice.h应该包含在这个文件中吧

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已添加

@zeroRains
Copy link
Contributor Author

CI已通过,劳烦老师看一下,因为剩下其他算子在有本PR新增的paddle/phi/kernels/funcs/fake_quantize_functor.h文件后,迁移起来会方便一些。@yuanlehome

Copy link
Contributor

@YuanRisheng YuanRisheng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

phi下我们分配内存不使用mutable_data,需要改用为dev_ctx.template Alloc<T>(out);

@zeroRains
Copy link
Contributor Author

phi下我们分配内存不使用mutable_data,需要改用为dev_ctx.template Alloc<T>(out);

已修改

@yuanlehome
Copy link
Contributor

处理下冲突吧

@zeroRains
Copy link
Contributor Author

处理下冲突吧

Done

@@ -1099,8 +1099,11 @@
attrs : [int round_type = 1]

- op : fake_quantize_abs_max
extra :
attrs : [int round_type = 1]
Copy link
Contributor Author

@zeroRains zeroRains Apr 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

对了,这个部分的round_type的属性本身是放在extra里的,但是后面在phi的kernel实现里,没能找到对应获取的方法,所以直接设置成kernel的参数了,不知道是否可以?

@luotao1 luotao1 merged commit 2b8b2e9 into PaddlePaddle:develop Apr 22, 2024
@zeroRains zeroRains deleted the 54_1 branch April 22, 2024 03:36
@zeroRains zeroRains restored the 54_1 branch April 22, 2024 11:20
co63oc pushed a commit to co63oc/Paddle that referenced this pull request Apr 22, 2024
…dlePaddle#63610)

* move fake_quantize_abs_max op to phi

* fix the bug in include

* remove the impl in fluid

* change the include

* modify mutable_data to Alloc

* fix typo

* fix typo

* create a impl file

* fix the namespace

* merge all fake_quantize_kernel to a file
@zeroRains zeroRains deleted the 54_1 branch May 27, 2024 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants