forked from OSchip/llvm-project
fa01679e7c
This CL uses a pattern proposed by aminim@ to add a base Linalg op that further dispatches to the proper op implementation. This CL adds a LinalgOp which implements isclassof for only a subset of the linalg ops: the ops that behave like a library call for the purpose of transformations like tiling. This uses a static dispatch mechanism based on the LinalgLibraryOps.td ops declarations to avoid switch or visitor patterns. This may later be replaced by Tablegen'd dispatch when it is available. As a consequence, the list of library like operations in Linalg may now grow without having to modify any of the dispatch or transformation support. More details in the concept-based dispatch, as explained by aminim@ ``` This is inspired by Sean Parent's: https://sean-parent.stlab.cc/papers-and-presentations/#value-semantics-and-concept-based-polymorphism A key difference is that the set of classes erased is statically known, which avoids to use dynamic memory allocation. We use a zero-sized templated class to emit the virtual table and generate a singleton object for each instantiation of this class. We pay the cost of initialization once on construction (find which class to dispatch to) and then a virtual dispatch on every call. ``` -- PiperOrigin-RevId: 248258921 |
||
---|---|---|
mlir |