llvm-project/mlir/tools
Stella Laurenzo 2ceedc3a20 [mlir][linalg] Add symbolic type conversion to linalg named ops.
This enables this kind of construct in the DSL to generate a named op that is polymorphic over numeric type variables `T` and `U`, generating the correct arithmetic casts at construction time:

```
@tc_def_op
def polymorphic_matmul(A=TensorDef(T1, S.M, S.K),
                       B=TensorDef(T2, S.K, S.N),
                       C=TensorDef(U, S.M, S.N, output=True)):
  implements(ContractionOpInterface)
  C[D.m, D.n] += cast(U, A[D.m, D.k]) * cast(U, B[D.k, D.n])
```

Presently, this only supports type variables that are bound to the element type of one of the arguments, although a further extension that allows binding a type variable to an attribute would allow some more expressiveness and may be useful for some formulations. This is left to a future patch. In addition, this patch does not yet materialize the verifier support which ensures that types are bound correctly (for such simple examples, failing to do so will yield IR that fails verification, it just won't yet fail with a precise error).

Note that the full grid of extensions/truncation/int<->float conversions are supported, but many of them are lossy and higher level code needs to be mindful of numerics (it is not the job of this level).

As-is, this should be sufficient for most integer matmul scenarios we work with in typical quantization schemes.

Differential Revision: https://reviews.llvm.org/D97603
2021-02-27 15:52:35 -08:00
..
mlir-cpu-runner [mlir] Use dialect interfaces to translate OpenMP dialect to LLVM IR 2021-02-12 18:37:47 +01:00
mlir-cuda-runner [mlir] Specify cuda-runner pass pipeline as command line options. 2021-02-24 14:36:52 +01:00
mlir-linalg-ods-gen [mlir][linalg] Add symbolic type conversion to linalg named ops. 2021-02-27 15:52:35 -08:00
mlir-opt [mlir] Add math polynomial approximation pass 2021-02-19 12:43:36 -08:00
mlir-reduce [mlir] avoid exposing mutable DialectRegistry from MLIRContext 2021-02-10 12:07:34 +01:00
mlir-rocm-runner [mlir] Simplify ModuleTranslation for LLVM IR 2021-02-16 18:42:52 +01:00
mlir-shlib [MLIR] Reapply: Adjust libMLIR building to more closely follow libClang 2020-05-04 20:47:57 -07:00
mlir-spirv-cpu-runner [mlir] Simplify ModuleTranslation for LLVM IR 2021-02-16 18:42:52 +01:00
mlir-tblgen [mlir] Simplify various pieces of code now that Identifier has access to the Context/Dialect 2021-02-26 18:00:05 -08:00
mlir-translate Revert "[RFC] Factor out repetitive cmake patterns for llvm-style projects" 2020-10-04 15:17:34 -07:00
mlir-vulkan-runner [mlir] Export CUDA and Vulkan runtime wrappers on Windows 2021-02-21 22:58:55 -08:00
CMakeLists.txt [mlir] Fix cross-compilation (Linalg ODS gen) 2021-01-18 11:57:55 +01:00