Skip to content

Commit d774622

Browse files
[mlir][lsp] Register all extensions and TestDynDialect in main.
The main function of the LSP server needs to load the dialects and similar that the server should be able to understand. When extensions where introduced, the loading of the extensions was apparently not added to its main functions, so ops from extensions were previously not recognized by the server. This patch registers all extensions through the existing convenience function, and also registers the TestDynDialect, which `mlir-opt`s main function also registers. Reviewed By: springerm Differential Revision: https://reviews.llvm.org/D159091
1 parent f281543 commit d774622

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

mlir/tools/mlir-lsp-server/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ if(MLIR_INCLUDE_TESTS)
1717
MLIRSPIRVTestPasses
1818
MLIRTestAnalysis
1919
MLIRTestDialect
20+
MLIRTestDynDialect
2021
MLIRTestIR
2122
MLIRTestPass
2223
MLIRTestReducer
@@ -27,12 +28,15 @@ if(MLIR_INCLUDE_TESTS)
2728
endif()
2829

2930
set(LIBS
30-
${dialect_libs}
3131
${conversion_libs}
32+
${dialect_libs}
33+
${extension_libs}
3234
${test_libs}
35+
3336
MLIRAffineAnalysis
3437
MLIRAnalysis
3538
MLIRDialect
39+
MLIRFuncAllExtensions
3640
MLIRLspServerLib
3741
MLIRParser
3842
MLIRPass

mlir/tools/mlir-lsp-server/mlir-lsp-server.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,28 @@
99
#include "mlir/IR/Dialect.h"
1010
#include "mlir/IR/MLIRContext.h"
1111
#include "mlir/InitAllDialects.h"
12+
#include "mlir/InitAllExtensions.h"
1213
#include "mlir/Tools/mlir-lsp-server/MlirLspServerMain.h"
1314

1415
using namespace mlir;
1516

1617
#ifdef MLIR_INCLUDE_TESTS
1718
namespace test {
1819
void registerTestDialect(DialectRegistry &);
20+
void registerTestDynDialect(DialectRegistry &);
1921
void registerTestTransformDialectExtension(DialectRegistry &);
2022
} // namespace test
2123
#endif
2224

2325
int main(int argc, char **argv) {
2426
DialectRegistry registry;
2527
registerAllDialects(registry);
28+
registerAllExtensions(registry);
29+
2630
#ifdef MLIR_INCLUDE_TESTS
2731
::test::registerTestDialect(registry);
2832
::test::registerTestTransformDialectExtension(registry);
33+
::test::registerTestDynDialect(registry);
2934
#endif
3035
return failed(MlirLspServerMain(argc, argv, registry));
3136
}

0 commit comments

Comments
 (0)