I am exploring MLIR, and am looking at writing my own conversion pass for the Linalg dialect, replacing matmul calls with something else. I am still to add the implementation of the pass, however I would like to be sure that the pass works as a stub, before developing it further.
I am following how LinalgToSPIRV
appears to be doing it, however when I try and compile I get an error (see below). I’ve got all my changes as a single commit on the dev/external_pass
branch.
/app/llvm-project-public/mlir/lib/Conversion/LinalgToExternal/LinalgToExternal.cpp:75:27: error: use of undeclared identifier 'ConvertLinalgToExternalPass'; did you mean 'ConvertLinalgToExternalBase'?
return std::make_unique<ConvertLinalgToExternalPass>();
^~~~~~~~~~~~~~~~~~~~~~~~~~~
ConvertLinalgToExternalBase
tools/mlir/include/mlir/Conversion/Passes.h.inc:1012:7: note: 'ConvertLinalgToExternalBase' declared here
class ConvertLinalgToExternalBase : public ::mlir::OperationPass<ModuleOp> {
To me, this suggests that the code generation step in Passes.h is not registering my pass properly. Is there something I’m missing?
To explain a bit more of what I’ve done:
-
I have created a directory for my pass in lib, and added the directory to CMakeLists.txt, as well as having a basic C++ file. external_pass/mlir/lib/Conversion/LinalgToExternal
-
I have also added my pass to the
include
directory, adding the header tomlir/include/mlir/Conversion/Passes.h
, as well as to the tablegen filemlir/include/mlir/Conversion/Passes.td
. mlir/include/mlir/Conversion/LinalgToExternal
Is there anything else I need here? Is my intuition about there being an issue with the tablegen
for Passes.h
reasonable, or is it more likely to be something else?