Skip to content
Draft
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
16 changes: 6 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -145,16 +145,12 @@ endif()
if(BUILD_MQT_CORE_MLIR)
add_subdirectory(mlir)

# copy generated MLIR documentation
add_custom_command(
TARGET mlir-doc
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_BINARY_DIR}/docs/
${CMAKE_CURRENT_SOURCE_DIR}/docs/mlir/
COMMAND ${CMAKE_COMMAND} -D DOCS_DIR:PATH=${CMAKE_CURRENT_SOURCE_DIR}/docs/mlir -P
${CMAKE_CURRENT_SOURCE_DIR}/cmake/CleanMLIRDocs.cmake
COMMENT "Copying and cleaning up generated MLIR documentation"
VERBATIM)
Comment on lines -149 to -157
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This currently makes the configuration fail. I don't exactly understand what's going on, but it looks like the mlir-doc target is also being created by jeff-mlir, leading to interference.

Another problem seems to be that calling mlir-doc also triggers the generation of the Jeff documentation in the _deps directory.

Maybe it's possible to add flags to jeff-mlir to toggle the documentation generation. 🤔

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't quite managed to work around this for now. Will have to reinvestigate at a later point.

# copy generated MLIR documentation add_custom_command( TARGET mlir-doc POST_BUILD COMMAND
# ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_BINARY_DIR}/docs/
# ${CMAKE_CURRENT_SOURCE_DIR}/docs/mlir/ COMMAND ${CMAKE_COMMAND} -D
# DOCS_DIR:PATH=${CMAKE_CURRENT_SOURCE_DIR}/docs/mlir -P
# ${CMAKE_CURRENT_SOURCE_DIR}/cmake/CleanMLIRDocs.cmake COMMENT "Copying and cleaning up generated
# MLIR documentation" VERBATIM)

endif()

Expand Down
15 changes: 15 additions & 0 deletions cmake/ExternalDependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,21 @@ if(BUILD_MQT_CORE_MLIR)
CACHE INTERNAL "Disable building Eigen tests")
FetchContent_Declare(Eigen URL ${Eigen_URL} FIND_PACKAGE_ARGS ${Eigen_VERSION})
list(APPEND FETCH_PACKAGES Eigen)

# Fetch jeff-mlir
FetchContent_Declare(
jeff_mlir
GIT_REPOSITORY https://github.com/PennyLaneAI/jeff-mlir.git
GIT_TAG main
GIT_SUBMODULES "" GIT_SUBMODULES_RECURSE FALSE)
FetchContent_MakeAvailable(jeff_mlir)

# Include jeff-mlir headers
include_directories(${jeff_mlir_SOURCE_DIR}/include)
include_directories(${jeff_mlir_BINARY_DIR}/include)

# Restore C++ standard changed by jeff-mlir
set(CMAKE_CXX_STANDARD 20)
endif()

set(JSON_VERSION
Expand Down
2 changes: 2 additions & 0 deletions mlir/include/mlir/Conversion/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#
# Licensed under the MIT License

add_subdirectory(JeffToQC)
add_subdirectory(QCOToQC)
add_subdirectory(QCToJeff)
add_subdirectory(QCToQCO)
add_subdirectory(QCToQIR)
13 changes: 13 additions & 0 deletions mlir/include/mlir/Conversion/JeffToQC/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright (c) 2023 - 2026 Chair for Design Automation, TUM
# Copyright (c) 2025 - 2026 Munich Quantum Software Company GmbH
# All rights reserved.
#
# SPDX-License-Identifier: MIT
#
# Licensed under the MIT License

set(LLVM_TARGET_DEFINITIONS JeffToQC.td)
mlir_tablegen(JeffToQC.h.inc -gen-pass-decls -name JeffToQC)
add_public_tablegen_target(JeffToQCIncGen)

add_mlir_doc(JeffToQC MLIRJeffToQC Conversions/ -gen-pass-doc)
21 changes: 21 additions & 0 deletions mlir/include/mlir/Conversion/JeffToQC/JeffToQC.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Copyright (c) 2023 - 2026 Chair for Design Automation, TUM
* Copyright (c) 2025 - 2026 Munich Quantum Software Company GmbH
* All rights reserved.
*
* SPDX-License-Identifier: MIT
*
* Licensed under the MIT License
*/

#pragma once

#include <mlir/Pass/Pass.h>

namespace mlir {
#define GEN_PASS_DECL_JEFFTOQC
#include "mlir/Conversion/JeffToQC/JeffToQC.h.inc"

#define GEN_PASS_REGISTRATION
#include "mlir/Conversion/JeffToQC/JeffToQC.h.inc"
} // namespace mlir
22 changes: 22 additions & 0 deletions mlir/include/mlir/Conversion/JeffToQC/JeffToQC.td
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright (c) 2023 - 2026 Chair for Design Automation, TUM
// Copyright (c) 2025 - 2026 Munich Quantum Software Company GmbH
// All rights reserved.
//
// SPDX-License-Identifier: MIT
//
// Licensed under the MIT License

include "mlir/Pass/PassBase.td"

def JeffToQC : Pass<"jeff-to-qc"> {
let summary = "Convert Jeff operations to QC operations";

let description = [{
TODO
}];

let dependentDialects = [
"jeff::JeffDialect",
"mlir::QCDialect",
];
}
13 changes: 13 additions & 0 deletions mlir/include/mlir/Conversion/QCToJeff/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright (c) 2023 - 2026 Chair for Design Automation, TUM
# Copyright (c) 2025 - 2026 Munich Quantum Software Company GmbH
# All rights reserved.
#
# SPDX-License-Identifier: MIT
#
# Licensed under the MIT License

set(LLVM_TARGET_DEFINITIONS QCToJeff.td)
mlir_tablegen(QCToJeff.h.inc -gen-pass-decls -name QCToJeff)
add_public_tablegen_target(QCToJeffIncGen)

add_mlir_doc(QCToJeff MLIRQCToJeff Conversions/ -gen-pass-doc)
21 changes: 21 additions & 0 deletions mlir/include/mlir/Conversion/QCToJeff/QCToJeff.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Copyright (c) 2023 - 2026 Chair for Design Automation, TUM
* Copyright (c) 2025 - 2026 Munich Quantum Software Company GmbH
* All rights reserved.
*
* SPDX-License-Identifier: MIT
*
* Licensed under the MIT License
*/

#pragma once

#include <mlir/Pass/Pass.h>

namespace mlir {
#define GEN_PASS_DECL_QCTOJEFF
#include "mlir/Conversion/QCToJeff/QCToJeff.h.inc"

#define GEN_PASS_REGISTRATION
#include "mlir/Conversion/QCToJeff/QCToJeff.h.inc"
} // namespace mlir
22 changes: 22 additions & 0 deletions mlir/include/mlir/Conversion/QCToJeff/QCToJeff.td
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright (c) 2023 - 2026 Chair for Design Automation, TUM
// Copyright (c) 2025 - 2026 Munich Quantum Software Company GmbH
// All rights reserved.
//
// SPDX-License-Identifier: MIT
//
// Licensed under the MIT License

include "mlir/Pass/PassBase.td"

def QCToJeff : Pass<"qc-to-jeff"> {
let summary = "Convert QC operations to Jeff operations";

let description = [{
TODO
}];

let dependentDialects = [
"jeff::JeffDialect",
"mlir::QCDialect",
];
}
2 changes: 2 additions & 0 deletions mlir/lib/Conversion/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#
# Licensed under the MIT License

add_subdirectory(JeffToQC)
add_subdirectory(QCOToQC)
add_subdirectory(QCToJeff)
add_subdirectory(QCToQCO)
add_subdirectory(QCToQIR)
20 changes: 20 additions & 0 deletions mlir/lib/Conversion/JeffToQC/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright (c) 2023 - 2026 Chair for Design Automation, TUM
# Copyright (c) 2025 - 2026 Munich Quantum Software Company GmbH
# All rights reserved.
#
# SPDX-License-Identifier: MIT
#
# Licensed under the MIT License

file(GLOB CONVERSION_SOURCES *.cpp)

add_mlir_library(
JeffToQC
${CONVERSION_SOURCES}
DEPENDS
JeffToQCIncGen
LINK_LIBS
MLIRJeff
MLIRQCDialect
MLIRTransforms
DISABLE_INSTALL)
Loading
Loading