Skip to content
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

[NewIR]Codegen templete of Op vjp interface #56196

Merged
merged 3 commits into from
Aug 14, 2023

Conversation

xiaoguoguo626807
Copy link
Contributor

PR types

Others

PR changes

Others

Description

paddle.dialect 下op定义生成vjp调用接口模版
TODO 解析模版参数生成有效内容
image

pcard-67164

@paddle-bot
Copy link

paddle-bot bot commented Aug 11, 2023

你的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.

@Aurelius84 Aurelius84 changed the title 【new ir】codegen templete of Op vjp interface [NewIR]Codegen templete of Op vjp interface Aug 14, 2023
Aurelius84
Aurelius84 previously approved these changes Aug 14, 2023
Copy link
Contributor

@Aurelius84 Aurelius84 left a comment

Choose a reason for hiding this comment

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

LGTM

paddle/fluid/ir/dialect/op_generator/op_gen.py Outdated Show resolved Hide resolved
"""

OP_VJP_DEFINE_TEMPLATE = """
std::vector<std::vector<ir::OpResult>> {op_class_name}::Vjp(
Copy link
Contributor

Choose a reason for hiding this comment

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

这里的签名是 vector of vector,意味着这一层接口之外是不需要再考虑 combine 和 slice了,所有的pack和unpack都在 vjp 函数里默认做了?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

是的

Co-authored-by: Aurelius84 <[email protected]>
@@ -22,6 +22,86 @@
}}
"""

OP_VJP_FORWARD_INPUT_OR_OUTPUT_TEMPLATE = """
{input_type} {input_name}(std::make_shared<primitive::experimental::DescTensor>(op_obj.{input_name}()));
Copy link
Contributor

Choose a reason for hiding this comment

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

这份代码将生成在 paddle::dialect namespace 下吧?primitive::experimental 是不是需要加上 paddle namespace?

@xiaoguoguo626807 xiaoguoguo626807 merged commit e6b2639 into PaddlePaddle:develop Aug 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants