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

【Hackathon 6th No.50】 support backward for pylayer op #63319

Merged
merged 19 commits into from
May 11, 2024

Conversation

MarioLulab
Copy link
Contributor

@MarioLulab MarioLulab commented Apr 8, 2024

PR Category

Others

PR Types

New features

Description

  1. Support pylayer op backward in PIR.
  2. Move pylayer op definition into new files manual_pylayer_op.cc and manual_pylayer_op.h
  3. Add some PIR testcases for testing pylayer op backward.
  4. Support dy2st for PyLayer in PIR mode

Pcard-80565

Copy link

paddle-bot bot commented Apr 8, 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.

@MarioLulab MarioLulab changed the title [PIR] support backward for pylayer op [WIP][PIR] support backward for pylayer op Apr 11, 2024
@MarioLulab MarioLulab marked this pull request as draft April 11, 2024 13:36
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.

Great work

paddle/fluid/pir/dialect/operator/ir/manual_pylayer_op.cc Outdated Show resolved Hide resolved
paddle/fluid/pir/dialect/operator/ir/manual_pylayer_op.cc Outdated Show resolved Hide resolved
paddle/fluid/pir/dialect/operator/ir/manual_pylayer_op.h Outdated Show resolved Hide resolved
for (size_t index = 0; index < num_operands(); ++index) {
input_values.push_back(operand_source(index));
}
return input_values;
Copy link
Contributor

Choose a reason for hiding this comment

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

Op是派生自OpBase,可以直接使用 return this->operation()->operands_source();

Copy link
Contributor Author

Choose a reason for hiding this comment

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

直接使用 operand_source() 效果应该是一样的?

paddle/fluid/pybind/control_flow_api.cc Outdated Show resolved Hide resolved
}

PythonCallableRegistrar &PythonCallableRegistrar::GetInstance() {
static PythonCallableRegistrar instance;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
static PythonCallableRegistrar instance;
thread_local static PythonCallableRegistrar instance;

python/paddle/autograd/backward_utils.py Show resolved Hide resolved
@MarioLulab MarioLulab changed the title [WIP][PIR] support backward for pylayer op 【Hackathon 6th No.50-part2】 support backward for pylayer op Apr 15, 2024
@MarioLulab MarioLulab changed the title 【Hackathon 6th No.50-part2】 support backward for pylayer op 【Hackathon 6th No.50】 support backward for pylayer op -part Apr 15, 2024
Copy link

paddle-ci-bot bot commented Apr 19, 2024

Sorry to inform you that 3e6eae1's CIs have passed for more than 7 days. To prevent PR conflicts, you need to re-run all CIs manually.

@MarioLulab MarioLulab marked this pull request as ready for review April 27, 2024 06:23
Copy link

paddle-ci-bot bot commented May 6, 2024

Sorry to inform you that a129b5f's CIs have passed for more than 7 days. To prevent PR conflicts, you need to re-run all CIs manually.

@luotao1
Copy link
Contributor

luotao1 commented May 10, 2024

@MarioLulab 需要解决下冲突

@luotao1 luotao1 changed the title 【Hackathon 6th No.50】 support backward for pylayer op -part 【Hackathon 6th No.50】 support backward for pylayer op May 11, 2024
@luotao1 luotao1 added the contributor External developers label May 11, 2024
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

@Aurelius84 Aurelius84 merged commit ac3ac4e into PaddlePaddle:develop May 11, 2024
30 of 31 checks passed
co63oc pushed a commit to co63oc/Paddle that referenced this pull request May 11, 2024
…3319)

* create manual_pylayer_op files and
add utility func

* add instance for py_callable,
add vjp handler in `call_vjp` interface

* add backward testcases and
fix bugs for segmentation error

* update testcases and fix bugs

* legacy_test/test_static_pylayer.py -> pir

* code polish

* pre-commit

* remove redundant combine op

* update dy2graph utils

* add dy2st support

* code polish

* phi::errors -> common::erros

* code polist

* pre-commit

* pre-commit
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.

3 participants