Paddle icon indicating copy to clipboard operation
Paddle copied to clipboard

Migrate oneDNN operators to under PHI

Open yaomichael opened this issue 3 years ago • 4 comments

需求描述 Feature Description

design doc: https://github.com/PaddlePaddle/docs/blob/develop/docs/design/phi/design_en.md

with Op name (op_type) as the unit, MKLDNN currently has a total of 100 OpKernels, which we divide into three categories:

  1. Migrate first: a total of 53 (42 to be migrated, 11 have been migrated by YuanRisheng). The parameters required by this type of Kernel are consistent with the CPU&GPU Kernel. Currently, the migration is non-blocking. In order to verify the mechanism, we have migrated 11 of them;
  2. Migrate later: 23 in total. This kind of Kernel has the problem of Extra parameters in OpMaker that we mentioned before. It requires more parameters than CPU&GPU Kernel, so this part of Kernel is recommended to be migrated after we complete the extra parameter cleaning. The specific time will be tell you later (expectedly in mid to late September);
  3. No need to migrate: 24 in total. This type of Kernel mainly includes two types of operators, one is the historical operators that have been abandoned, such as reshape, flatten, etc, these abandoned operators will be gradually removed from the framework, so they will no need to be migrated; the other is framework function related operators. For example, related to fusion or quantize, such operators may not be migrated to PHI in the future, and may continue to be maintained in the main framework.

替代实现 Alternatives

No response

yaomichael avatar Aug 22 '22 10:08 yaomichael

您好,我们已经收到了您的问题,会安排技术人员尽快解答您的问题,请耐心等待。请您再次检查是否提供了清晰的问题描述、复现代码、环境&版本、报错信息等。同时,您也可以通过查看官网API文档常见问题历史IssueAI社区来寻求解答。祝您生活愉快~

Hi! We've received your issue and please be patient to get responded. We will arrange technicians to answer your questions as soon as possible. Please make sure that you have posted enough message to demo your request. You may also check out the APIFAQGithub Issue and AI community to get the answer.Have a nice day!

paddle-bot[bot] avatar Aug 22 '22 10:08 paddle-bot[bot]

@chenwhql @jiangjiajun @jczaja @wozna

yaomichael avatar Aug 22 '22 10:08 yaomichael

Merged

  • [x] abs, abs_grad, relu6 https://github.com/PaddlePaddle/Paddle/pull/45397
  • [x] gaussian_random https://github.com/PaddlePaddle/Paddle/pull/45481
  • [x] Moving fluid/mkldnn_reuse.h to phi/onednn_reuse.h https://github.com/PaddlePaddle/Paddle/pull/45626
  • [x] scale https://github.com/PaddlePaddle/Paddle/pull/45537
  • [x] reduce_sum, reduce_sum_grad, reduce_mean, reduce_mean_grad, reduce_min, reduce_max https://github.com/PaddlePaddle/Paddle/pull/45536
  • [x] cast, clip, clip_grad https://github.com/PaddlePaddle/Paddle/pull/45775
  • [x] shape https://github.com/PaddlePaddle/Paddle/pull/46051
  • [x] softmax_grad https://github.com/PaddlePaddle/Paddle/pull/46257
  • [x] slice, slice_grad, split, pad2d, pad3d https://github.com/PaddlePaddle/Paddle/pull/46101
  • [x] concat, concat_grad, expand_v2, expand_v2_grad, fill_constant, nearest_interp_v2, bilinear_interp_v2 https://github.com/PaddlePaddle/Paddle/pull/45863
  • [x] revert pool2d, pool2d_grad https://github.com/PaddlePaddle/Paddle/pull/45989
  • [x] gelu, gelu_grad https://github.com/PaddlePaddle/Paddle/pull/45596
  • [x] sgd, stack https://github.com/PaddlePaddle/Paddle/pull/46374
  • [x] sum https://github.com/PaddlePaddle/Paddle/pull/46239
  • [x] relu6_grad https://github.com/PaddlePaddle/Paddle/pull/46501
  • [x] hard_swish_grad unit test https://github.com/PaddlePaddle/Paddle/pull/46621
  • [x] fix accuracy drop in gaussian_random https://github.com/PaddlePaddle/Paddle/pull/46747
  • [x] transpose2_grad https://github.com/PaddlePaddle/Paddle/pull/46139

Cherry-picks to release/2.4 branch

  • [x] shape https://github.com/PaddlePaddle/Paddle/pull/46724
  • [x] softmax_grad https://github.com/PaddlePaddle/Paddle/pull/46725
  • [x] slice, slice_grad, split, pad2d, pad3d https://github.com/PaddlePaddle/Paddle/pull/46726
  • [x] concat, concat_grad, expand_v2, expand_v2_grad, fill_constant, nearest_interp_v2, bilinear_interp_v2 https://github.com/PaddlePaddle/Paddle/pull/46727
  • [x] revert pool2d, pool2d_grad https://github.com/PaddlePaddle/Paddle/pull/46860
  • [x] gelu, gelu_grad https://github.com/PaddlePaddle/Paddle/pull/46862
  • [x] sgd, stack https://github.com/PaddlePaddle/Paddle/pull/46729
  • [x] sum https://github.com/PaddlePaddle/Paddle/pull/46730
  • [x] relu6_grad https://github.com/PaddlePaddle/Paddle/pull/46862
  • [x] hard_swish_grad unit test https://github.com/PaddlePaddle/Paddle/pull/46857
  • [x] fix accuracy drop in gaussian_random https://github.com/PaddlePaddle/Paddle/pull/46858
  • [x] transpose2_grad https://github.com/PaddlePaddle/Paddle/pull/46873

Silv3S avatar Sep 02 '22 07:09 Silv3S

@Silv3S @piotrekobi Our kernel migration work will be released in Paddle v2.4, and the release/2.4 branch bas been created at 9.9, so the PRs merged into develop after 9.9 need to be cherry-pick to release/2.4, remind attention it, thanks.

https://github.com/PaddlePaddle/Paddle/tree/release/2.4

chenwhql avatar Sep 16 '22 01:09 chenwhql

Part II

Merged

  • [x] conv2d, conv2d_grad https://github.com/PaddlePaddle/Paddle/pull/46342
  • [x] softmax https://github.com/PaddlePaddle/Paddle/pull/47339
  • [x] softplus https://github.com/PaddlePaddle/Paddle/pull/47406
  • [x] pool2d, pool2d_grad https://github.com/PaddlePaddle/Paddle/pull/47423
  • [x] depthwise_conv2d, conv3d https://github.com/PaddlePaddle/Paddle/pull/47658
  • [x] depthwise_conv2d_grad, conv3d_grad https://github.com/PaddlePaddle/Paddle/pull/47686
  • [x] batch_norm https://github.com/PaddlePaddle/Paddle/pull/47652
  • [x] prelu, prelu_grad https://github.com/PaddlePaddle/Paddle/pull/47422
  • [x] Remove redundant FLUID files https://github.com/PaddlePaddle/Paddle/pull/47779
  • [x] conv2d_transpose https://github.com/PaddlePaddle/Paddle/pull/48119
  • [x] matmul_v2_grad https://github.com/PaddlePaddle/Paddle/pull/48023
  • [x] mul_grad https://github.com/PaddlePaddle/Paddle/pull/48061
  • [x] elementwise_add_grad, elementwise_sub_grad, elementwise_mul_grad, elementwise_div_grad, elementwise_div https://github.com/PaddlePaddle/Paddle/pull/48210
  • [x] batch_norm_grad https://github.com/PaddlePaddle/Paddle/pull/48288
  • [x] Remove redundant FLUID files https://github.com/PaddlePaddle/Paddle/pull/48352
  • [x] matmul_v2 https://github.com/PaddlePaddle/Paddle/pull/48162
  • [x] transpose2 https://github.com/PaddlePaddle/Paddle/pull/47748
  • [x] elementwise_sub https://github.com/PaddlePaddle/Paddle/pull/48611
  • [x] mul https://github.com/PaddlePaddle/Paddle/pull/48299
  • [x] elementwise_add, elementwise_mul https://github.com/PaddlePaddle/Paddle/pull/48625
  • [x] squeeze2, squeeze2_grad https://github.com/PaddlePaddle/Paddle/pull/48634
  • [x] reshape2 https://github.com/PaddlePaddle/Paddle/pull/48749
  • [x] Copy method https://github.com/PaddlePaddle/Paddle/pull/48539

Silv3S avatar Sep 26 '22 15:09 Silv3S