This revision introduces a the TypeFn class that similar to the PrimFn class contains an extensible set of type conversion functions. Having the same mechanism for both type conversion functions and arithmetic functions improves code consistency. Additionally, having an explicit function class and function name is a prerequisite to specify a conversion or arithmetic function via attribute. In a follow up commits, we will introduce function attributes to make OpDSL operations more generic. In particular, the goal is to handle signed and unsigned computation in one operations. Today, there is a linalg.matmul and a linalg.matmul_unsigned.
The commit implements the following changes:
- Introduce the class of type conversion functions TypeFn
- Replace the hardwired cast and cast_unsigned ops by the TypeFn counterparts
- Adapt the python and C++ code generation paths to support the new cast operations
Example:
cast(U, A[D.m, D.k])
changes to
TypeFn.cast(U, A[D.m, D.k])
Depends On D115237