IKernelDescriptor
-
struct IKernelDescriptor
This interface is used to implement an abstract representation for a kernel. For example, one may implement a
MatrixMultiplyDescriptorthat represents a kernel for matrix multiplication. Thebuildmethod should return theKernelBuilderthat be used to build the specific kernel.The interface is used in combination with
KernelRegistryto look up if this kernel has already been compiled. The registry is essentially a hash table that mapsIKernelDescriptorobjects toKernelInstanceobjects. This is why this descriptor class must implementequalsandhash.Subclassed by kernel_launcher::PragmaKernel
Public Functions
-
virtual KernelBuilder build() const = 0
Should return the
KernelBuilderthat can be used to build the kernel associated with this descriptor.
-
virtual bool equals(const IKernelDescriptor &that) const = 0
Check if this descriptor is equal to another descriptor.
-
inline virtual hash_t hash() const
Return a hash of this descriptor. This is used to test for equality of two descriptors:
Two descriptors that return the same hash MAY be identical.
Two descriptors that return different hashes MUST be different.
This method is optional; its default implementation just returns
0.
-
virtual KernelBuilder build() const = 0