-
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
【PIR OpTest Fix No.28】 fix test_fused_adam_op #62770
【PIR OpTest Fix No.28】 fix test_fused_adam_op #62770
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
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.
可以贴下修改前的报错吗?在paddle/fluid/pir/dialect/operator/ir/ops.yaml下的定义是复制自 paddle/phi/api/yaml/legacy_ops.yaml,前者是PIR算子的定义,后者是动态图算子的定义。我们的期望是前者要和后者保持一致,所以这里不能这样修改,需要先明确下是什么样的问题导致跑不通,这个问题可能并不是算子定义的不对。
如最新的更改我在ops.yaml和legacy_ops.yaml都新增新的fused_adam定义,但编译时报错: |
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.
这样改应该就行了。关于之前为什么会重定义,原因可能与legacy.yaml里同时定义了fused_adam和fused_adam_有关,但是这两个的名字也不冲突。一个猜测是fused_adam定义了inplace,于是生成的API名是fused_adam_导致冲突,具体这里麻烦 @zyfncg 帮忙解释下。
paddle/phi/api/yaml/op_compat.yaml
Outdated
@@ -1254,6 +1254,15 @@ | |||
data_type : float | |||
support_tensor : true | |||
|
|||
- op : fused_adam |
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.
- op : fused_adam | |
- op : fused_adam_(fused_adam) |
这样就会把旧IR的fused_adam算子映射到PIR的fused_adam_
paddle/phi/api/yaml/legacy_ops.yaml
Outdated
- op : fused_adam | ||
args : (Tensor[] params, Tensor[] grads, Tensor learning_rate, Tensor[] moments1, Tensor[] moments2, Tensor[] beta1_pows, Tensor[] beta2_pows, Tensor[] master_params, Tensor skip_update, Scalar beta1, Scalar beta2, Scalar epsilon, int chunk_size, float weight_decay, bool use_adamw, bool multi_precision, bool use_global_beta_pow) | ||
output : Tensor[](params_out){params.size()}, Tensor[](moments1_out){params.size()}, Tensor[](moments2_out){params.size()}, Tensor[](beta1_pows_out){params.size()}, Tensor[](beta2_pows_out){params.size()}, Tensor[](master_params_out){params.size()} |
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.
在legacy_ops.yaml里不要新增定义,这里面的定义是为动态图算子服务的
@@ -741,6 +741,17 @@ | |||
data_type : dtype | |||
interfaces : paddle::dialect::InferSymbolicShapeInterface | |||
|
|||
- op : fused_adam |
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.
- op : fused_adam | |
- op : fused_adam_ |
这里我们要和动态图算子保持一致,另外这个算子只有inplace版本,对PIR,所有下划线结尾的都是inplace算子
@@ -143,6 +143,7 @@ | |||
'dpsgd', | |||
'embedding_grad_sparse', | |||
'ftrl', | |||
'fused_adam', |
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.
'fused_adam', | |
'fused_adam_', |
感谢感谢!这里按您说的改完后又补充了optional的master_params_out就可以通过单侧了,学到很多,非常感谢您! |
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 API
PR types
Others
PR changes
Others
Description
PIR Op单测修复
修复单测
test_fused_adam_op
修复后打开
FLAGS_enable_pir_in_executor
单测是否通过:是保留inplace报编译时会报错,去掉后编译通过且单侧通过