Skip to content

Commit fd40aba

Browse files
committed
Add initial infrastructure for Jeff conversions
1 parent 68cacb1 commit fd40aba

File tree

25 files changed

+703
-37
lines changed

25 files changed

+703
-37
lines changed

.license-tools-config.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
"uv\\.lock",
3636
"py\\.typed",
3737
".*build.*",
38-
"core_patterns.txt"
38+
"core_patterns.txt",
39+
"mlir/include/mlir/Dialect/Jeff/.*",
40+
"mlir/lib/Dialect/Jeff/.*"
3941
]
4042
}

CMakeLists.txt

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -145,16 +145,12 @@ endif()
145145
if(BUILD_MQT_CORE_MLIR)
146146
add_subdirectory(mlir)
147147

148-
# copy generated MLIR documentation
149-
add_custom_command(
150-
TARGET mlir-doc
151-
POST_BUILD
152-
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_BINARY_DIR}/docs/
153-
${CMAKE_CURRENT_SOURCE_DIR}/docs/mlir/
154-
COMMAND ${CMAKE_COMMAND} -D DOCS_DIR:PATH=${CMAKE_CURRENT_SOURCE_DIR}/docs/mlir -P
155-
${CMAKE_CURRENT_SOURCE_DIR}/cmake/CleanMLIRDocs.cmake
156-
COMMENT "Copying and cleaning up generated MLIR documentation"
157-
VERBATIM)
148+
# copy generated MLIR documentation add_custom_command( TARGET mlir-doc POST_BUILD COMMAND
149+
# ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_BINARY_DIR}/docs/
150+
# ${CMAKE_CURRENT_SOURCE_DIR}/docs/mlir/ COMMAND ${CMAKE_COMMAND} -D
151+
# DOCS_DIR:PATH=${CMAKE_CURRENT_SOURCE_DIR}/docs/mlir -P
152+
# ${CMAKE_CURRENT_SOURCE_DIR}/cmake/CleanMLIRDocs.cmake COMMENT "Copying and cleaning up generated
153+
# MLIR documentation" VERBATIM)
158154

159155
endif()
160156

cmake/ExternalDependencies.cmake

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,21 @@ if(BUILD_MQT_CORE_MLIR)
3333
CACHE INTERNAL "Disable building Eigen tests")
3434
FetchContent_Declare(Eigen URL ${Eigen_URL} FIND_PACKAGE_ARGS ${Eigen_VERSION})
3535
list(APPEND FETCH_PACKAGES Eigen)
36+
37+
# Fetch jeff-mlir
38+
FetchContent_Declare(
39+
jeff_mlir
40+
GIT_REPOSITORY https://github.com/PennyLaneAI/jeff-mlir.git
41+
GIT_TAG main
42+
GIT_SUBMODULES "" GIT_SUBMODULES_RECURSE FALSE)
43+
FetchContent_MakeAvailable(jeff_mlir)
44+
45+
# Include jeff-mlir headers
46+
include_directories(${jeff_mlir_SOURCE_DIR}/include)
47+
include_directories(${jeff_mlir_BINARY_DIR}/include)
48+
49+
# Restore C++ standard changed by jeff-mlir
50+
set(CMAKE_CXX_STANDARD 20)
3651
endif()
3752

3853
set(JSON_VERSION

mlir/include/mlir/Conversion/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
#
77
# Licensed under the MIT License
88

9+
add_subdirectory(JeffToQC)
910
add_subdirectory(QCOToQC)
11+
add_subdirectory(QCToJeff)
1012
add_subdirectory(QCToQCO)
1113
add_subdirectory(QCToQIR)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Copyright (c) 2023 - 2026 Chair for Design Automation, TUM
2+
# Copyright (c) 2025 - 2026 Munich Quantum Software Company GmbH
3+
# All rights reserved.
4+
#
5+
# SPDX-License-Identifier: MIT
6+
#
7+
# Licensed under the MIT License
8+
9+
set(LLVM_TARGET_DEFINITIONS JeffToQC.td)
10+
mlir_tablegen(JeffToQC.h.inc -gen-pass-decls -name JeffToQC)
11+
add_public_tablegen_target(JeffToQCIncGen)
12+
13+
add_mlir_doc(JeffToQC MLIRJeffToQC Conversions/ -gen-pass-doc)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
* Copyright (c) 2023 - 2026 Chair for Design Automation, TUM
3+
* Copyright (c) 2025 - 2026 Munich Quantum Software Company GmbH
4+
* All rights reserved.
5+
*
6+
* SPDX-License-Identifier: MIT
7+
*
8+
* Licensed under the MIT License
9+
*/
10+
11+
#pragma once
12+
13+
#include <mlir/Pass/Pass.h>
14+
15+
namespace mlir {
16+
#define GEN_PASS_DECL_JEFFTOQC
17+
#include "mlir/Conversion/JeffToQC/JeffToQC.h.inc"
18+
19+
#define GEN_PASS_REGISTRATION
20+
#include "mlir/Conversion/JeffToQC/JeffToQC.h.inc"
21+
} // namespace mlir
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Copyright (c) 2023 - 2026 Chair for Design Automation, TUM
2+
// Copyright (c) 2025 - 2026 Munich Quantum Software Company GmbH
3+
// All rights reserved.
4+
//
5+
// SPDX-License-Identifier: MIT
6+
//
7+
// Licensed under the MIT License
8+
9+
include "mlir/Pass/PassBase.td"
10+
11+
def JeffToQC : Pass<"jeff-to-qc"> {
12+
let summary = "TODO";
13+
14+
let description = [{
15+
TODO
16+
}];
17+
18+
let dependentDialects = [
19+
"jeff::JeffDialect",
20+
"mlir::QCDialect",
21+
];
22+
}

mlir/include/mlir/Conversion/QCOToQC/QCOToQC.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
#pragma once
1212

13-
#include <mlir/Pass/Pass.h> // from @llvm-project
13+
#include <mlir/Pass/Pass.h>
1414

1515
namespace mlir {
1616
#define GEN_PASS_DECL_QCOTOQC
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Copyright (c) 2023 - 2026 Chair for Design Automation, TUM
2+
# Copyright (c) 2025 - 2026 Munich Quantum Software Company GmbH
3+
# All rights reserved.
4+
#
5+
# SPDX-License-Identifier: MIT
6+
#
7+
# Licensed under the MIT License
8+
9+
set(LLVM_TARGET_DEFINITIONS QCToJeff.td)
10+
mlir_tablegen(QCToJeff.h.inc -gen-pass-decls -name QCToJeff)
11+
add_public_tablegen_target(QCToJeffIncGen)
12+
13+
add_mlir_doc(QCToJeff MLIRQCToJeff Conversions/ -gen-pass-doc)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
* Copyright (c) 2023 - 2026 Chair for Design Automation, TUM
3+
* Copyright (c) 2025 - 2026 Munich Quantum Software Company GmbH
4+
* All rights reserved.
5+
*
6+
* SPDX-License-Identifier: MIT
7+
*
8+
* Licensed under the MIT License
9+
*/
10+
11+
#pragma once
12+
13+
#include <mlir/Pass/Pass.h>
14+
15+
namespace mlir {
16+
#define GEN_PASS_DECL_QCTOJEFF
17+
#include "mlir/Conversion/QCToJeff/QCToJeff.h.inc"
18+
19+
#define GEN_PASS_REGISTRATION
20+
#include "mlir/Conversion/QCToJeff/QCToJeff.h.inc"
21+
} // namespace mlir

0 commit comments

Comments
 (0)