Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,17 @@ lit build/dev/mlir/test/ -v --filter "convert"

---

## Language server

If you use VSCode and would like to enable the custom MLIR LSP server including quantum dialects, add this line to your
settings:

```
"mlir.server_path": "build/dev/bin/qcc-lsp-server"
```

---

## License headers

The license headers in this repository are managed using the [`license-eye`](https://github.com/apache/skywalking-eyes) tool.
Expand Down
2 changes: 1 addition & 1 deletion mlir/test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
configure_lit_site_cfg(${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py
MAIN_CONFIG ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py)

set(MLIR_COMPILER_TEST_DEPENDS FileCheck count not qcc-opt qcc)
set(MLIR_COMPILER_TEST_DEPENDS FileCheck count not qcc-opt qcc qcc-lsp-server)
Comment thread
rainij marked this conversation as resolved.

add_lit_testsuite(test-qcc-project "Run the QCC project tests" ${CMAKE_CURRENT_BINARY_DIR} DEPENDS
${MLIR_COMPILER_TEST_DEPENDS})
Expand Down
1 change: 1 addition & 0 deletions mlir/tools/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
add_subdirectory(qcc)
add_subdirectory(qcc-opt)
add_subdirectory(qcc-lsp-server)
15 changes: 15 additions & 0 deletions mlir/tools/qcc-lsp-server/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
add_mlir_tool(qcc-lsp-server qcc-lsp-server.cpp)

target_link_libraries(
qcc-lsp-server
PRIVATE MLIRLspServerLib
MLIRRegisterAllDialects
MLIRRegisterAllExtensions
MLIRRegisterAllPasses
# Dialect libraries used by our project
QCCJaspDialect
QCCAuxDialect
MLIRQCDialect)

llvm_update_compile_flags(qcc-lsp-server)
mlir_check_all_link_libraries(qcc-lsp-server)
28 changes: 28 additions & 0 deletions mlir/tools/qcc-lsp-server/qcc-lsp-server.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//===- qcc-lsp-server.cpp - QCC custom MLIR LSP server -------------------===//
//
// Part of the FullStaQD Project, under the Apache License v2.0 with LLVM
// Exceptions.
// See <repo-root>/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "qcc/Dialect/Aux_/IR/Aux_.h"
#include "qcc/Dialect/Jasp/IR/Jasp.h"

#include "mlir/Dialect/QC/IR/QCDialect.h"
#include "mlir/IR/DialectRegistry.h"
#include "mlir/InitAllDialects.h"
#include "mlir/Tools/mlir-lsp-server/MlirLspServerMain.h"

int main(int argc, char** argv) {
mlir::DialectRegistry registry;

// Register all builtin dialects and their extensions/interfaces.
mlir::registerAllDialects(registry);

// Register our custom project dialects.
registry.insert<jasp::JaspDialect, mlir::qc::QCDialect, qcc::aux::AuxDialect>();

return mlir::succeeded(mlir::MlirLspServerMain(argc, argv, registry)) ? 0 : 1;
}
Loading