need to refine our design of OpKernelType
Created by: QiJune
An operator can have different kernel implementations. Fluid uses OpKernelType
to identify a unique Kernel. Currently, OpKernelType
is defined as follows:
https://github.com/PaddlePaddle/Paddle/blob/2d5ec16bc8a09fb8e0f62c89b116b0cd1d333907/paddle/framework/operator.h#L348-L374
It contains two keys, Place
and DataType
. However, these two keys are not enough. We need a more complete representation of OpKernelType
. There are four keys to determine a kernel type of an operator: Place
/Library
/DataType
/Layout
.
We often implement a kernel of an operator with some computing library in certain device. Please remind that computing library and device are not one-to-one corresponding. A device can have a lot of computing libraries and a computing library can also support several devices.
For example, Eigen library can support Nvidia GPU/AMD GPU/CPU. And MKLDNN library can support Intel CPU/Intel FPGA. So, both Place
and Library
should be a key of OpKernelType
.
Another two keys are DataType
and Layout
. It's obvious that different DataTypes, like fp64/fp32/int8 will have different kernels. And please refer to #6765 (closed) to get the details about Layout
.