Overview
The KUPL matrix programming module exposes the concept of a tensor and a suite of operations based on tensor objects. This enables users to quickly leverage matrix computation capabilities on the Kunpeng hardware platform, accelerating matrix multiplication-related operators. Specific operations include overloaded operators such as indexing, addition, and scalar multiplication for tensor objects. Additionally, it provides KUPL MMA and Copy operations based on tensor objects. Among these, MMA implements a matrix multiplication kernel in the form of D = A*B + C, while Copy enables rapid transposition or prefetching between matrices across different memory layouts.
Key concepts of the KUPL matrix programming module are as follows:
- Int: An integer wrapper type used to pass compile-time integer constants.
- Ops: An enumeration wrapper type used to pass compile-time enumeration constants.
- Coord: Represents matrix indices, used for indexing operations on tensor objects.
- Shape: Represents matrix or computation dimensions.
- Stride: Represents the row or column stride of matrix elements.
- Layout: Represents the memory layout of a matrix.
- Tensor: Represents a matrix object comprising the source data and its layout.
To use the interfaces of the KUPL matrix programming module, HPCKit must be installed on a platform that supports matrix computation instructions.
The examples in the following programming interface specifications are all implemented based on the BiSheng version of the KUPL matrix programming interfaces; implementations under GCC may differ due to constraints in matrix computation instruction support.