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

[Prim] [NewIR]Automatic code generation for vjp rules #56512

Merged

Conversation

Charles-hit
Copy link
Contributor

@Charles-hit Charles-hit commented Aug 21, 2023

PR types

New features

PR changes

Others

Description

Pcard-66975
背景:

本PR在PR55647基础上完成后续组合算子在新IR下适配的工作。

本PR完成的工作:

  • 完成vjp所需要的组件自动生成工作
  • 支持vjp接口和backend组件手写功能

接下来要完成的工作

  • vjp组件自动生成去掉白名单,批量生成全量算子
  • vjp适配可变attribute

@paddle-bot
Copy link

paddle-bot bot commented Aug 21, 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.

@Charles-hit Charles-hit force-pushed the support_prim_vjp_code_gen branch 2 times, most recently from 6f3ea1c to 7c87d93 Compare August 21, 2023 11:34
@Charles-hit Charles-hit force-pushed the support_prim_vjp_code_gen branch 2 times, most recently from 8974188 to deb37b5 Compare August 22, 2023 03:26
Copy link
Contributor

@cxxly cxxly left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -1,10 +1,17 @@
set(eager_backend_files
${PADDLE_SOURCE_DIR}/paddle/fluid/primitive/backend/generated/generated_eager_backend.cc
Copy link
Contributor

Choose a reason for hiding this comment

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

这里其实用 CMAKE_CURRENT_SOURCE_DIR更好一些

Copy link
Contributor Author

Choose a reason for hiding this comment

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

好的 为了不影响后续工作,会在下一个pr统一修改

DEPS final_dygraph_function eager_utils phi)
endif()
set(static_backend_files
${PADDLE_SOURCE_DIR}/paddle/fluid/primitive/backend/generated/generated_static_backend.cc
${PADDLE_SOURCE_DIR}/paddle/fluid/primitive/backend/manual/manual_static_backend.cc
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.

好的 为了不影响后续工作,会在下一个pr统一修改

@@ -0,0 +1,33 @@
set(fwd_path
"${PADDLE_SOURCE_DIR}/paddle/fluid/operators/generator/parsed_ops/ops.parsed.yaml"
Copy link
Contributor

Choose a reason for hiding this comment

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

这里可以把 ${PADDLE_SOURCE_DIR}/paddle/fluid/operators/generator/parsed_ops单独定义一个目录变量,这样后面的set 就简短很多,也比较好维护

Copy link
Contributor Author

Choose a reason for hiding this comment

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

好的 下个pr会修改

Copy link
Contributor

@XiaoguangHu01 XiaoguangHu01 left a comment

Choose a reason for hiding this comment

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

LGTM

@Charles-hit Charles-hit merged commit 14b81d5 into PaddlePaddle:develop Aug 22, 2023
@Charles-hit Charles-hit deleted the support_prim_vjp_code_gen branch August 22, 2023 11:09
BeingGod pushed a commit to BeingGod/Paddle that referenced this pull request Sep 9, 2023
…6512)

* support ir api form prim

* support ir api for prim

* support vjp prim mode in new ir

* remove useless code

* remove useless code

* auto code generator for primitive vjp methods

* add vjp and backend manual and fix segment fault

---------

Co-authored-by: cyber-pioneer <chenzhuo@tju.edu.cn>
Co-authored-by: cxxly <chenxx_id@163.com>
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.

6 participants