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

[Infrt] add ir support for phi kernel batch_norm_infer. #40755

Merged
merged 1 commit into from
Mar 23, 2022

Conversation

winter-wang
Copy link
Contributor

@winter-wang winter-wang commented Mar 21, 2022

PR types

Others

PR changes

Others

Describe

  1. INFRT的 phi_op_convert_pass中添加对类似batch_norm、conv2d 这种推理和训练时kernel不一致算子的支持。
  2. phi dialect的生成脚本增加对StrAttr和I32ArrayAttr的支持。
  3. 修复infrt_build.sh脚本执行时,对phi_cpu_kernels.td和phi_gpu_kernels.td文件的路径错误,导致kernel注册错误的bug.
  4. 修复 tools/infrt/get_phi_kernel_info.py中对infermeta信息提取错误的bug。
  5. 修改kernel的注册形式同时添加对存在默认参数metaconfig的infermeta函数的支持。
    修改前的注册形式为:
registry->AddKernelWithAttrs("phi_cpu.matmul.float32.any",
    std::bind(&KernelLauncherFunc<decltype(&::phi::MatmulKernel<float, ::phi::CPUContext>),
                                  &::phi::MatmulKernel<float, ::phi::CPUContext>,
                                  decltype(&::phi::MatmulInferMeta),
                                  &::phi::MatmulInferMeta>,
              KernelLauncher<decltype(&::phi::MatmulKernel<float, ::phi::CPUContext>),
                                  &::phi::MatmulKernel<float, ::phi::CPUContext>,
                                  decltype(&::phi::MatmulInferMeta),
                                  &::phi::MatmulInferMeta>(),
              std::placeholders::_1),
    {"trans_x", "trans_y"});

修改后的注册形式为:

registry->AddKernelWithAttrs("phi_cpu.matmul.float32.any",
    &KernelLauncherFunc<decltype(&::phi::MatmulKernel<float, ::phi::CPUContext>),
                                  &::phi::MatmulKernel<float, ::phi::CPUContext>,
                                  decltype(&::phi::MatmulInferMeta),
                                  &::phi::MatmulInferMeta>,
    {"trans_x", "trans_y"});

@paddle-bot-old
Copy link

paddle-bot-old bot commented Mar 21, 2022

✅ This PR's description meets the template requirements!
Please wait for other CI results.

@paddle-bot-old
Copy link

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

Copy link
Contributor

@Superjomn Superjomn left a comment

Choose a reason for hiding this comment

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

LGTM

@winter-wang winter-wang merged commit c751e40 into PaddlePaddle:develop Mar 23, 2022
@winter-wang winter-wang changed the title [infrt] add ir support for phi kernel batch_norm_infer. [Infrt] add ir support for phi kernel batch_norm_infer. Mar 28, 2022
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