IKernelDescriptor
-
struct IKernelDescriptor
This interface is used to implement an abstract representation for a kernel. For example, one may implement a
MatrixMultiplyDescriptor
that represents a kernel for matrix multiplication. Thebuild
method should return theKernelBuilder
that be used to build the specific kernel.The interface is used in combination with
KernelRegistry
to look up if this kernel has already been compiled. The registry is essentially a hash table that mapsIKernelDescriptor
objects toKernelInstance
objects. This is why this descriptor class must implementequals
andhash
.Subclassed by kernel_launcher::PragmaKernel
Public Functions
-
virtual KernelBuilder build() const = 0
Should return the
KernelBuilder
that 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