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

[IR] Refine OP auto code gen #54186

Merged

Conversation

zhangbo9674
Copy link
Contributor

PR types

New features

PR changes

Others

Description

完善IR yaml 生成算op 自动代码生成逻辑,主要内容包括:

  • 添加基于 legacy_ops.yaml 自动生成算子定义;
  • 定义 GetOpInfoInterface,用于获取 yaml 中定义的算子输入、输出、属性信息;
    算子定义形式如下:
class SumOp : public ir::Op<SumOp> {
 public:
  using Op::Op;
  static const char *name() { return "pd.sum"; }
  static const char *attributes_name[3];
  static constexpr uint32_t attributes_num = 3;
  static std::tuple<std::vector<OpInputInfo>, std::vector<OpAttributeInfo>, std::vector<OpOutputInfo>> GetOpInfo();
  static void verify(const std::vector<ir::OpResult> &inputs, const std::vector<ir::Type> &outputs, const ir::AttributeMap &attributes);
  ir::OpOperand x() { return operation()->GetOperandByIndex(0); }
  ir::OpResult out() { return operation()->GetResultByIndex(0); }
};

Other

Pcard-67164

@paddle-bot
Copy link

paddle-bot bot commented May 29, 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.

@paddle-bot
Copy link

paddle-bot bot commented May 29, 2023

❌ The PR is not created using PR's template. You can refer to this Demo.
Please use PR's template, it helps save our maintainers' time so that more developers get helped.

Copy link
Contributor

@kangguangli kangguangli left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@winter-wang winter-wang left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@luotao1 luotao1 left a comment

Choose a reason for hiding this comment

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

LGTM for PADDLE_ENFORCE

@zhangbo9674 zhangbo9674 merged commit 14425c0 into PaddlePaddle:develop May 30, 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.

5 participants