[Mlir-commits] [mlir] d774622 - [mlir][lsp] Register all extensions and TestDynDialect in main.

Ingo Müller llvmlistbot at llvm.org
Thu Aug 31 00:54:42 PDT 2023


Author: Ingo Müller
Date: 2023-08-31T07:54:37Z
New Revision: d7746220b10c7617cf2f53170af29e5c648c37db

URL: https://github.com/llvm/llvm-project/commit/d7746220b10c7617cf2f53170af29e5c648c37db
DIFF: https://github.com/llvm/llvm-project/commit/d7746220b10c7617cf2f53170af29e5c648c37db.diff

LOG: [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

Added: 
    

Modified: 
    mlir/tools/mlir-lsp-server/CMakeLists.txt
    mlir/tools/mlir-lsp-server/mlir-lsp-server.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/tools/mlir-lsp-server/CMakeLists.txt b/mlir/tools/mlir-lsp-server/CMakeLists.txt
index d1c1ea99bc0009..e90ccf17af17f5 100644
--- a/mlir/tools/mlir-lsp-server/CMakeLists.txt
+++ b/mlir/tools/mlir-lsp-server/CMakeLists.txt
@@ -17,6 +17,7 @@ if(MLIR_INCLUDE_TESTS)
     MLIRSPIRVTestPasses
     MLIRTestAnalysis
     MLIRTestDialect
+    MLIRTestDynDialect
     MLIRTestIR
     MLIRTestPass
     MLIRTestReducer
@@ -27,12 +28,15 @@ if(MLIR_INCLUDE_TESTS)
 endif()
 
 set(LIBS
-  ${dialect_libs}
   ${conversion_libs}
+  ${dialect_libs}
+  ${extension_libs}
   ${test_libs}
+
   MLIRAffineAnalysis
   MLIRAnalysis
   MLIRDialect
+  MLIRFuncAllExtensions
   MLIRLspServerLib
   MLIRParser
   MLIRPass

diff  --git a/mlir/tools/mlir-lsp-server/mlir-lsp-server.cpp b/mlir/tools/mlir-lsp-server/mlir-lsp-server.cpp
index ac62de0b4ab177..f0ecc5adc68b36 100644
--- a/mlir/tools/mlir-lsp-server/mlir-lsp-server.cpp
+++ b/mlir/tools/mlir-lsp-server/mlir-lsp-server.cpp
@@ -9,6 +9,7 @@
 #include "mlir/IR/Dialect.h"
 #include "mlir/IR/MLIRContext.h"
 #include "mlir/InitAllDialects.h"
+#include "mlir/InitAllExtensions.h"
 #include "mlir/Tools/mlir-lsp-server/MlirLspServerMain.h"
 
 using namespace mlir;
@@ -16,6 +17,7 @@ using namespace mlir;
 #ifdef MLIR_INCLUDE_TESTS
 namespace test {
 void registerTestDialect(DialectRegistry &);
+void registerTestDynDialect(DialectRegistry &);
 void registerTestTransformDialectExtension(DialectRegistry &);
 } // namespace test
 #endif
@@ -23,9 +25,12 @@ void registerTestTransformDialectExtension(DialectRegistry &);
 int main(int argc, char **argv) {
   DialectRegistry registry;
   registerAllDialects(registry);
+  registerAllExtensions(registry);
+
 #ifdef MLIR_INCLUDE_TESTS
   ::test::registerTestDialect(registry);
   ::test::registerTestTransformDialectExtension(registry);
+  ::test::registerTestDynDialect(registry);
 #endif
   return failed(MlirLspServerMain(argc, argv, registry));
 }


        


More information about the Mlir-commits mailing list