Skip to content

Commit 493825a

Browse files
authored
[PHI] Migrate elementwise_sub kernel (#48611)
* Add migrations * Fix build errors * Remove elementwise_mul from migration
1 parent e8edbb0 commit 493825a

File tree

3 files changed

+19
-27
lines changed

3 files changed

+19
-27
lines changed

paddle/fluid/operators/elementwise/mkldnn/elementwise_sub_mkldnn_op.cc

Lines changed: 0 additions & 27 deletions
This file was deleted.

paddle/phi/kernels/elementwise_kernel.cc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,15 @@ PD_REGISTER_KERNEL(elementwise_pow,
416416
#endif
417417

418418
#if defined PADDLE_WITH_MKLDNN
419+
PD_REGISTER_KERNEL(subtract,
420+
OneDNN,
421+
ONEDNN,
422+
phi::SubtractKernel,
423+
float,
424+
phi::dtype::bfloat16,
425+
int8_t,
426+
uint8_t) {}
427+
419428
PD_REGISTER_KERNEL(
420429
divide, OneDNN, ONEDNN, phi::DivideKernel, float, phi::dtype::bfloat16) {}
421430
#endif

paddle/phi/kernels/onednn/elementwise_kernel.cc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,20 @@ void ElementwiseKernel(const OneDNNContext& dev_ctx,
133133
ElementwiseKernel<T, algorithm>(dev_ctx, x, y, axis, out); \
134134
}
135135

136+
DEFINE_ONEDNN_ELEMENTWISE_KERNEL(Subtract, dnnl::algorithm::binary_sub)
136137
DEFINE_ONEDNN_ELEMENTWISE_KERNEL(Divide, dnnl::algorithm::binary_div)
137138

138139
} // namespace phi
139140

141+
PD_REGISTER_KERNEL(subtract_raw,
142+
OneDNN,
143+
ONEDNN,
144+
phi::SubtractRawKernel,
145+
float,
146+
phi::dtype::bfloat16,
147+
int8_t,
148+
uint8_t) {}
149+
140150
PD_REGISTER_KERNEL(divide_raw,
141151
OneDNN,
142152
ONEDNN,

0 commit comments

Comments
 (0)