Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
270 commits
Select commit Hold shift + click to select a range
ac684de
🎨 Restructure architecture
ystade Jan 31, 2025
14569d1
🔥 Delete source files that cannot be used due to templates
ystade Jan 31, 2025
8763722
🎨 Fix architecture
ystade Jan 31, 2025
b50d2fc
🐛 Fix bugs in architecture, replace whole preprocessing
ystade Jan 31, 2025
00fd128
🎨 Add error handling to architecture's load function
ystade Jan 31, 2025
2462205
🐛 Fix load function
ystade Jan 31, 2025
95fc7b2
✅ Test architecture
ystade Jan 31, 2025
75a7fab
🐛 Fix bug in max Matching
ystade Feb 1, 2025
2c6a14d
🐛 Fix minWeightFullBipartiteMatching
ystade Feb 2, 2025
2eda282
✅ Add another test
ystade Feb 2, 2025
b538c0c
🎨 Get it to compile
ystade Feb 5, 2025
d2e1bf1
✅ Succeed test to load settings
ystade Feb 6, 2025
5cc6302
🎨 Add constexpr string
ystade Feb 6, 2025
cde6ebf
🎨 Get it compile
ystade Feb 7, 2025
fbacdea
🎨 Enforce CamelCases
ystade Feb 7, 2025
41b9a9f
🎨 Get everything to not throw an exception
ystade Feb 7, 2025
ae489b8
🐛 Fix several bugs
ystade Feb 8, 2025
618f107
🎨 Adopt NASP to new NAComputation
ystade Feb 10, 2025
6ead743
🐛 Fix bug in minWeightFullMatching
ystade Feb 10, 2025
3967aec
🐛 Fix another bug in minWeightFullMatching
ystade Feb 11, 2025
5b61605
🎨 Isolate nalac
ystade Feb 11, 2025
7f36267
🐛 Fix bug with 1Q Gates
ystade Feb 11, 2025
3d16be3
🔥 Remove azac
ystade Feb 12, 2025
115d8ea
🎨 Remove yaml in solver
ystade Mar 3, 2025
7808a94
🐛 Adopt new NA computation in entire project
ystade Mar 3, 2025
72e7ee9
🎨 Add missing link target
ystade Mar 3, 2025
e19f8a1
🐛 Use mqt-core branch
ystade Mar 3, 2025
999b88b
🎨 Fix python bindings
ystade Mar 3, 2025
78ae2c9
🎨 Adopt NASP
ystade Feb 8, 2025
927ce84
Revert "🔥 Remove azac"
ystade Feb 12, 2025
fab1457
⚡️ Copy over draft of A star search
ystade Mar 3, 2025
2212dd3
✨ Implement heap that supports updating the priority
ystade Mar 5, 2025
a84b104
📝 Add docu
ystade Mar 5, 2025
f18cafb
🎨 Use const refs
ystade Mar 5, 2025
c8ce67a
🎨 Incorporate A* search
ystade Mar 6, 2025
94169b8
🎨 Finalize the qubit placement
ystade Mar 6, 2025
c228039
🚧 Work in progress on gate placement
ystade Mar 6, 2025
2d579f8
🎨 Get everything compile with new placer and new NAComputation
ystade Mar 7, 2025
cc8c3fb
⚡️ Get rid of the list of sites in ascending order by their distance,…
ystade Mar 7, 2025
7e6e37f
⬆️ Cmake dependency
ystade Mar 7, 2025
93acbeb
✅ Make architecture tests more performant
ystade Mar 7, 2025
95f2e22
🎨 Extract and Clean-up ReuseAnalyser
ystade Mar 8, 2025
bd7a458
🎨 Refactor analyser code
ystade Mar 8, 2025
5c06482
🎨 Clean-up scheduler
ystade Mar 8, 2025
fce2a60
🎨 Clean Up CodeGenerator
ystade Mar 8, 2025
76d2edf
🎨 Clean-up router
ystade Mar 9, 2025
c8969e8
🎨 WIP on Placer
ystade Mar 10, 2025
6129b74
🎨 Fully clean-up AStarPlacer
ystade Mar 10, 2025
c7578d7
🎨 Enforce namespace
ystade Mar 10, 2025
1ac51ec
🎨 Improve debug output
ystade Mar 10, 2025
ca85361
🎨 Refactor VMPlacer
ystade Mar 11, 2025
faa2cd8
🩹 Get everything to compile
ystade Mar 11, 2025
a14e1e9
🎨 Consider distances of both atoms in gate placement
ystade Mar 12, 2025
8030d97
✅ Test reuse analyzer
ystade Mar 12, 2025
b3f1d57
🐛 Fix VMReuseAnalyzer config test
ystade Mar 12, 2025
59f26ee
🎨 Simplify reuse tests
ystade Mar 12, 2025
db8e4dd
🎨 Simplify reuse tests
ystade Mar 12, 2025
8942ede
🐛 Fix a couple of issues
ystade Mar 12, 2025
933ff08
🐛 Replace pass-by-value by pass-by-reference and use array<SLM, 2> in…
ystade Mar 12, 2025
f39e867
✅ Enable modular testing
ystade Mar 12, 2025
50bf54c
✅ Components Scheduler, ReuseAnalyzer, Architecture running
ystade Mar 12, 2025
99ab680
🎨 Get rid of istringstream
ystade Mar 12, 2025
158e84b
🎨 Get rid of EXPECT_NO_THROW
ystade Mar 12, 2025
64ee1f2
🎨 Delete default constructor for Architecture
ystade Mar 12, 2025
7e8a50d
🐛 Fix bug in reuse tests
ystade Mar 12, 2025
978dbca
🎨 First Placer tests
ystade Mar 12, 2025
d4a81bc
🐛 Fix vm_placer
ystade Mar 13, 2025
67e564e
✅ Add tests for vm_placer
ystade Mar 13, 2025
32a1565
✅ Add more tests for vm_placer
ystade Mar 13, 2025
ae23b88
🐛 Fix bugs in AStarPlacer
ystade Mar 13, 2025
41c45fc
🐛 Fix a lot in AStarPlacer
ystade Mar 13, 2025
d243e88
🐛 Fix bug while extracting solution
ystade Mar 13, 2025
458060f
✅ Add tests for router
ystade Mar 15, 2025
3c002cd
✅ Add tests for code generator
ystade Mar 15, 2025
3eaf590
✅ Write End-to-end tests
ystade Mar 15, 2025
9698e97
🚸 Fix tiny bug and make output colurful
ystade Mar 15, 2025
9c62a17
🎨 Merge horizontal and vertical compatibility check into one group
ystade Mar 17, 2025
cb10ec4
🐛 Fix placer tests
ystade Mar 17, 2025
c9c579c
🎨 Adjust Test name
ystade Mar 17, 2025
e67c04a
🎨 Improve heuristic with StdDEV
ystade Mar 17, 2025
0893346
✅ Add test file
ystade Mar 17, 2025
025fd2c
✅ Work on tests
ystade Mar 17, 2025
e72f7d3
🎨 Add missing header
ystade Mar 17, 2025
8015887
🐛 Fix discretization function
ystade Mar 17, 2025
1060da0
🎨 Introduce scale factors and fix smaller bugs
ystade Mar 18, 2025
a09de3f
🎨 Add deepening factor
ystade Mar 18, 2025
ac37a11
🎨 Make it work
ystade Mar 18, 2025
a2ff665
🐛 Fix bug with occupiedEntagnlementSites
ystade Mar 18, 2025
5033ca8
✨ Dynamic window expansion
ystade Mar 18, 2025
035d30d
✅ Adjust config test
ystade Mar 18, 2025
e1fcdf7
Merge remote-tracking branch 'origin/main' into wip-azac
ystade Mar 18, 2025
844f8b6
🐛 Fixes related to python interface
ystade Mar 18, 2025
f1fa455
🐛 Add azac as link library
ystade Mar 18, 2025
c69c1e4
🐛 Condition NASP on Z3
ystade Mar 18, 2025
f33d05f
🐛 Fix namespace
ystade Mar 18, 2025
ae36b30
🎨 Add fidelities to architecture
ystade Mar 18, 2025
cc9b032
🎨 Replace is_number_float by is_number
ystade Mar 18, 2025
7421250
💚 Solve one clang tidy warning
ystade Mar 19, 2025
f5fbbb1
🎨 Improve error msg
ystade Mar 19, 2025
5243506
🎨 Enable processing of U3, U2, U1 gates
ystade Mar 19, 2025
75cbb7f
✨ Add lookahead factor in settings
ystade Mar 19, 2025
0416a77
🎨 Set extent of zones
ystade Mar 19, 2025
b006f52
🎨 Drop debug message
ystade Mar 19, 2025
a537f81
🐛 Fix bug in reuse analyser
ystade Mar 19, 2025
12b1ffa
🐛 Fix follow-up bug
ystade Mar 19, 2025
f47171d
🚸 Add more informative output
ystade Mar 19, 2025
29aa7e2
🎨 Change to linear influence on unplaced atoms
ystade Mar 19, 2025
2ff9f41
✨ Implement idea of atom sorting
ystade Mar 19, 2025
0cfbb51
🐛 Fix outout of architecture
ystade Mar 19, 2025
ae2eda2
🐛 Fix Architecture test
ystade Mar 19, 2025
b759c2e
⚡️ Make AZAC scale better
ystade Mar 20, 2025
3546343
🐛 Fix window expansion
ystade Mar 20, 2025
481b474
🎨 Some name changes
ystade Mar 20, 2025
2e0ce0b
⚡️ Add lookahead for gate placement
ystade Mar 21, 2025
e1f0327
🐛 Fix impact of lokkaheadFactor_
ystade Mar 21, 2025
0830f03
⚡️ Add lookahead for atom placement
ystade Mar 21, 2025
aadcb69
⚡️ Make reuse an option
ystade Mar 21, 2025
8b5b348
🐛 Fix bugs
ystade Mar 21, 2025
5a7b0ec
🐛 Fix bug with lookaheadFactor_ scaling in the rest
ystade Mar 21, 2025
c916095
⚡️ Take mean lookahead for heuristic instead of min to accelarate search
ystade Mar 21, 2025
4b63428
📝 Refine documentation
ystade Mar 26, 2025
2da97e5
🚸 Add first python bindings
ystade Mar 27, 2025
45a7cee
Merge remote-tracking branch 'origin/main' into wip-azac
ystade Mar 27, 2025
81b3c66
⬆️ Some version setup for the Python bindings
ystade Mar 27, 2025
e4e2aa0
♿️ Handle all types of 1q gates
ystade Apr 5, 2025
b54e505
Merge remote-tracking branch 'origin/main' into wip-azac
ystade Apr 5, 2025
eafe45d
⬆️ Adapt to new core version
ystade Apr 5, 2025
a782fe5
📝 Improve arch's docs
ystade Apr 5, 2025
a0f5607
♿️ Expose stats to python
ystade Apr 5, 2025
1fb979e
🎨 pre-commit fixes
pre-commit-ci[bot] Apr 5, 2025
cd6fadb
💚 Fix bug on ubuntu
ystade Apr 5, 2025
3cacfc0
🎨 Introduce more comprehensible types
ystade Apr 5, 2025
60c7d37
💚 Fix bugs
ystade Apr 6, 2025
f6d3f2e
🐛 Fix include
ystade Apr 6, 2025
d31a7d0
🎨 Add option to suppres unsup. gates warning
ystade Apr 8, 2025
c259782
🐛 Fix reuse analysis
ystade Apr 8, 2025
aeb7e0d
🐛 Fix bug in architecture and reuse analyzer
ystade Apr 8, 2025
64931a6
🎨 Remove additional stats from reuse analyzer
ystade Apr 8, 2025
af28f1e
🎨 Prettify string
ystade Apr 8, 2025
e41d5ec
🐛 Fix arch
ystade Apr 10, 2025
e0cb54b
💚 Do not shadow variable
ystade Apr 14, 2025
bb82fbd
🐛 Fix duration casts
ystade Apr 14, 2025
6238424
🎨 Skip barriers
ystade Apr 14, 2025
18cde24
🐛 Fix missing file
ystade Apr 14, 2025
3bbd4ce
💚 Add some asserts to catch null-pointer derefs
ystade Apr 14, 2025
1d02eef
💚 Document function
ystade Apr 15, 2025
adbef39
💚 Remove unused variables
ystade Apr 15, 2025
01961be
✅ Add tests for scheduler
ystade Apr 15, 2025
19d759e
✅ Add tests fro code generator
ystade Apr 15, 2025
77511fd
✅ Add test for architecture
ystade Apr 15, 2025
0758792
✅ Add tests for Code Generator
ystade Apr 16, 2025
8438262
🚸 Consider barriers in scheduler
ystade Apr 16, 2025
98c2fab
✏️ Fix Architecture tests
ystade Apr 16, 2025
e6ad2a1
🐛 Fix eq op
ystade Apr 16, 2025
2744a48
✅ Add tests for VMPlacer
ystade Apr 16, 2025
69110bd
🐛 Fix architecture tests
ystade Apr 17, 2025
6e7cac5
✅ Add tests for architecture
ystade Apr 17, 2025
5986665
🚸 Limit search space and fix tests
ystade Apr 17, 2025
132fa1b
💚 Cover more lines in AStarPlacer
ystade Apr 17, 2025
ace3c06
✅ Increase test coverage for AStarPlacer
ystade Apr 17, 2025
bbf6df9
Merge branch 'main' into wip-azac
ystade Apr 17, 2025
eca208d
🔥 Remove superfluous file
ystade Apr 17, 2025
803e988
📝 Add docs for AZAC
ystade Apr 18, 2025
db5f84e
Merge remote-tracking branch 'origin/main' into wip-azac
ystade Apr 24, 2025
458f724
🎨 Replace 'one-qubit' by 'single-qubit'
ystade Apr 30, 2025
32483d9
🎨 Rename '1qGate' to '1q_gate'
ystade Apr 30, 2025
ac32a3f
🐛 Fix leftover json key
ystade Apr 30, 2025
3402bd7
🚚 Rename AZACArchitecture to ZonedNeutralAtomArchitecture
ystade May 13, 2025
c0b5f84
🚚 Rename everythin with AZAC to MQT QMAP's Zoned Neutral Atom Compiler
ystade May 13, 2025
eca4bab
Merge remote-tracking branch 'origin/main' into wip-azac
ystade May 13, 2025
0c72951
🔥 Remove 'arch_range'
ystade May 13, 2025
83c8fde
📝 Improve docs
ystade May 13, 2025
aa6b415
🚸 Add constructor to compiler w/o settings
ystade May 13, 2025
5e2cbce
🎨 Fix missing arch_range
ystade May 13, 2025
6d9e7e1
🐛 Fix output message
ystade May 14, 2025
8af4ce8
🎨 Streamline keys in arch spec
ystade May 14, 2025
d3d5b13
🎨 Refactor Arch to have factory methods
ystade May 16, 2025
50d4c4d
🐛 Fix bugs
ystade May 16, 2025
b96515d
🎨 Put configs in a struct
ystade May 16, 2025
92d249a
🐛 Fix tests
ystade May 16, 2025
75c348b
🚧 WIP where imports work
ystade May 16, 2025
594ef5c
🐛 Fix tests
ystade May 16, 2025
a2d2fcc
🔥 Remove files generated during test
ystade May 16, 2025
d88ef7d
🐛 Fix mypy
ystade May 16, 2025
0a6c300
🏗️ Restructure for cleaner Python interface
ystade May 16, 2025
72a61db
🚸 Complete python interface
ystade May 16, 2025
7e003b3
🎨 Change json_fwd.h to json.h
ystade May 16, 2025
1fc2c91
🩹 Fix docstring
ystade May 16, 2025
7819ffc
🔥 Remove individual test targets
ystade May 16, 2025
09e757c
🩹 Fix path
ystade May 16, 2025
b5ccf07
🎨 Use SELF for consistency
ystade May 16, 2025
7e340d1
🚸 Make interface more pythonic
ystade May 17, 2025
8d35ec7
🔥 Remove superfluous header
ystade May 17, 2025
a19c732
✏️ Fix tests
ystade May 17, 2025
1560d45
📝 Add rationale to test circuits
ystade May 19, 2025
39a897a
🎨 Replace all std::cout printing by spdlog
ystade May 19, 2025
e723824
🎨 Use spdlog macros
ystade May 19, 2025
0332f10
🎨 Adapt default logging level to build type
ystade May 19, 2025
4a1dc10
🎨 Make log level configurable
ystade May 19, 2025
2e4fc20
🎨 Expose log level via python
ystade May 19, 2025
4d4f836
🎨 Make some output debug level
ystade May 19, 2025
65e55c0
🎨 Simplify declarations of maps
ystade May 19, 2025
f021ab7
✏️ Fix typo
ystade May 19, 2025
90bd7ac
📝 Fix typo and improve docs
ystade May 19, 2025
248932a
📝 Improve docs
ystade May 19, 2025
b6f079a
🩹 Fix docs
ystade May 19, 2025
e243b2a
✏️ Enforce uppercase SLM
ystade May 19, 2025
84ca4c2
🩹 Fix incosistency
ystade May 19, 2025
5eb7702
🎨 Streamline doxygen comments
ystade May 19, 2025
d93d135
🎨 Make VM and IS more expressive
ystade May 19, 2025
65ca471
🩹 Fix typo
ystade May 19, 2025
9e82550
🎨 Clean-up includes
ystade May 22, 2025
a27b080
🎨 Execute code for debug info only when needed
ystade May 22, 2025
1f53d9d
🐛 Fix handling of barriers
ystade May 22, 2025
84dc646
🎨 Fix barrier test
ystade May 22, 2025
cebccc4
🐛 Fix include
ystade May 22, 2025
01428b1
📝 Add docstring
ystade May 22, 2025
6f9a1fc
📝 Imrpove docs
ystade May 22, 2025
da3630d
📝 Improve docs
ystade May 22, 2025
a6aae23
📝 Improve docs
ystade May 22, 2025
73007f8
🎨 Improve docs and make subdir structure
ystade May 22, 2025
328742f
🏗️ Provide ABC classes
ystade May 22, 2025
146d03d
🐛 Remove duplicate adl_serializer
ystade May 22, 2025
360d3c5
🩹 Fix includes
ystade May 22, 2025
6101480
🐛 Fix tests
ystade May 22, 2025
bf36a72
Merge remote-tracking branch 'origin/main' into wip-azac
ystade May 22, 2025
48ff344
🐛 Fix docs
ystade May 22, 2025
fb428de
🐛 Fix path to bindings and python package
ystade May 22, 2025
9bcde3c
🩹 Fix picture
ystade May 22, 2025
a1ae7b0
🩹 Fix clang-tidy warnings in bindings
ystade May 22, 2025
7a5a6c6
✨ Try new lint workflow
ystade May 23, 2025
0799adb
💩 Quick hack for python bindings on linux
ystade May 23, 2025
366f2f3
♻️ Try different fix for spdlog
ystade May 23, 2025
ac32fcf
🐛 Fix includes in bindings
ystade May 23, 2025
80450d1
📝 Move docs into .pyi file for na stuff
ystade May 23, 2025
c9437d9
🎨 Incoporate some feedback
ystade May 23, 2025
129b275
🎨 Add function to add binding library
ystade May 23, 2025
f815946
🎨 Use new function also for pyqmap (bindings.cpp)
ystade May 23, 2025
219ae8f
🎨 Adapt to new workflow
ystade May 23, 2025
58490ca
📝 Add docstring to workflow
ystade May 23, 2025
fc3302b
⬆️ Change version tag of workflow
ystade May 23, 2025
8b4e4ed
📝 Add CHANGELOG and UPGRADING entries
ystade May 23, 2025
95ae77b
Update python/mqt/qmap/na/__init__.py
ystade May 24, 2025
6944bd9
Update UPGRADING.md
ystade May 24, 2025
7389a7d
⏪️ Revert reordering in python files
ystade May 26, 2025
d4c7f15
Merge branch 'main' into wip-azac
ystade May 26, 2025
9e62caa
🎨 pre-commit fixes
pre-commit-ci[bot] May 26, 2025
0d4f5a0
🐛 Fix ruff config
ystade May 26, 2025
f29d886
📝 Add dcos to compiler
ystade May 26, 2025
f4c9550
🎨 pre-commit fixes
pre-commit-ci[bot] May 26, 2025
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
6 changes: 5 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,18 @@ jobs:
contents: read
id-token: write

# to properly link python bindings, the target must be enabled and pybind11 must be installed
cpp-linter:
name: 🇨‌ Lint
needs: change-detection
if: fromJSON(needs.change-detection.outputs.run-cpp-linter)
uses: munich-quantum-toolkit/workflows/.github/workflows/reusable-cpp-linter.yml@v1.9
uses: munich-quantum-toolkit/workflows/.github/workflows/reusable-cpp-linter.yml@v1.10
with:
setup-z3: true
clang-version: 20
setup-python: true
install-pkgs: "pybind11==2.13.6"
cmake-args: "-DBUILD_MQT_QMAP_BINDINGS=ON"

# run extensive Python tests whenever this is on a PR and the PR has the `extensive-python-ci` label
python-tests:
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ _skbuild/

# Any build dirs in the tests
test/**/build/
/src/mqt/**/_version.py
_version.py

# Common editor files
*~
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ This project adheres to [Semantic Versioning], with the exception that minor rel

## [Unreleased]

### Added

- ✨ Add new compilers for zoned neutral atom architectures (a routing-agnostic and routing-aware compiler) ([#624]) ([**@ystade**])
- ✨ Add a new CMake function `add_mqt_qmap_binding` to add a Python binding library ([#624]) ([**@ystade**])

### Changed

- ♻️ Move the C++ code for the Python bindings to the top-level `bindings` directory ([#624]) ([**@ystade**])
- ♻️ Move all Python code (no tests) to the top-level `python` directory ([#624]) ([**@ystade**])
- ♻️ Restructure the Python bindings for neutral atom tools into separate modules ([#624]) ([**@ystade**])

## [3.0.0] - 2025-05-08

_If you are upgrading: please see [`UPGRADING.md`](UPGRADING.md#300)._
Expand Down
31 changes: 30 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,25 @@ project(
# Add path for custom modules
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

# set the logging level
set(MQT_QMAP_LOG_LEVEL
DEBUG
CACHE
STRING
"Set the active log level for spdlog (possible values: TRACE, DEBUG, INFO, WARN, ERROR, CRITICAL, OFF)"
)
set_property(
CACHE MQT_QMAP_LOG_LEVEL
PROPERTY STRINGS
TRACE
DEBUG
INFO
WARN
ERROR
CRITICAL
OFF)
add_compile_definitions(SPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_${MQT_QMAP_LOG_LEVEL})

option(BUILD_MQT_QMAP_BINDINGS "Build the MQT QMAP Python bindings" OFF)
if(BUILD_MQT_QMAP_BINDINGS)
# ensure that the BINDINGS option is set
Expand Down Expand Up @@ -55,14 +74,24 @@ endif()

option(BUILD_MQT_QMAP_TESTS "Also build tests for the MQT QMAP project" ${MQT_QMAP_MASTER_PROJECT})

include(cmake/ExternalDependencies.cmake)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(ExternalDependencies)
include(AddMQTQMAPBinding)

# set the include directory for the build tree
set(MQT_QMAP_INCLUDE_BUILD_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include")

# set prefix for all MQT QMAP targets
set(MQT_QMAP_TARGET_NAME mqt-qmap)

# add main library code
add_subdirectory(src)

# add bindings code if enabled
if(BUILD_MQT_QMAP_BINDINGS)
add_subdirectory(bindings)
endif()

# add test code
if(BUILD_MQT_QMAP_TESTS)
enable_testing()
Expand Down
4 changes: 4 additions & 0 deletions UPGRADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ This document describes breaking changes and how to upgrade. For a complete list

## [Unreleased]

This minor release initiates the efforts to re-structure the Python bindings and make them more modular.
Even tough this is not a breaking change, it is worth mentioning to developers of MQT QMAP that all Python code (except tests) has been moved to the top-level `python` directory.
Furthermore, the C++ code for the Python bindings has been moved to the top-level `bindings` directory.

## [3.0.0]

This major release introduces several breaking changes, including the removal of deprecated features.
Expand Down
36 changes: 13 additions & 23 deletions src/python/CMakeLists.txt → bindings/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,29 +25,19 @@ list(
${BASEPOINT}/../../core/lib
${BASEPOINT}/../../core/lib64)

pybind11_add_module(
add_mqt_qmap_binding(
pyqmap
# Prefer thin LTO if available
THIN_LTO
# Optimize the bindings for size
OPT_SIZE
# Source code goes here
bindings.cpp)
bindings.cpp
LINK_LIBS
MQT::QMapSCExact
MQT::QMapSCHeuristic
MQT::QMapCliffordSynthesis
MQT::QMapHybrid
MQT::NASP
MQT::QMapNAZoned
MQT::CoreQASM
pybind11_json)
target_compile_definitions(pyqmap PRIVATE Z3_FOUND)
target_link_libraries(
pyqmap
PRIVATE MQT::QMapSCExact
MQT::QMapSCHeuristic
MQT::QMapCliffordSynthesis
MQT::QMapHybrid
MQT::NASP
MQT::CoreQASM
MQT::ProjectOptions
MQT::ProjectWarnings
pybind11_json)

# Install directive for scikit-build-core
install(
TARGETS pyqmap
DESTINATION .
COMPONENT mqt-qmap_Python)
# add all modules
add_subdirectory(na)
180 changes: 11 additions & 169 deletions src/python/bindings.cpp → bindings/bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,7 @@
#include "hybridmap/NeutralAtomArchitecture.hpp"
#include "hybridmap/NeutralAtomScheduler.hpp"
#include "hybridmap/NeutralAtomUtils.hpp"
#include "ir/Definitions.hpp"
#include "ir/QuantumComputation.hpp"
#include "ir/operations/OpType.hpp"
#include "na/NAComputation.hpp"
#include "na/nasp/CodeGenerator.hpp"
#include "na/nasp/Solver.hpp"
#include "qasm3/Importer.hpp"
#include "sc/Architecture.hpp"
#include "sc/Mapper.hpp"
Expand All @@ -42,22 +37,28 @@
#include "sc/heuristic/HeuristicMapper.hpp"
#include "sc/utils.hpp"

#include <algorithm>
#include <cstddef>
#include <cstdint>
#include <exception>
#include <memory>
#include <nlohmann/json.hpp>
#include <plog/Severity.h>
#include <pybind11/attr.h>
#include <pybind11/cast.h>
#include <pybind11/detail/common.h>
#include <pybind11/pybind11.h>
#include <pybind11/pytypes.h>
// NOLINTNEXTLINE(misc-include-cleaner)
#include <pybind11/stl.h>
#include <pybind11_json/pybind11_json.hpp>
#include <sstream>
#include <stdexcept>
#include <string>
#include <utility>

namespace py = pybind11;
using namespace pybind11::literals;

namespace {
// c++ binding function
std::pair<qc::QuantumComputation, MappingResults>
map(const qc::QuantumComputation& circ, Architecture& arch,
Expand All @@ -69,15 +70,15 @@ map(const qc::QuantumComputation& circ, Architecture& arch,
} else if (config.method == Method::Exact) {
mapper = std::make_unique<ExactMapper>(circ, arch);
}
} catch (std::exception const& e) {
} catch (const std::exception& e) {
std::stringstream ss{};
ss << "Could not construct mapper: " << e.what();
throw std::invalid_argument(ss.str());
}

try {
mapper->map(config);
} catch (std::exception const& e) {
} catch (const std::exception& e) {
std::stringstream ss{};
ss << "Error during mapping: " << e.what();
throw std::invalid_argument(ss.str());
Expand All @@ -88,6 +89,7 @@ map(const qc::QuantumComputation& circ, Architecture& arch,

return {std::move(qcMapped), results};
}
} // namespace

PYBIND11_MODULE(pyqmap, m, py::mod_gil_not_used()) {
m.doc() = "pybind11 for the MQT QMAP quantum circuit mapping tool";
Expand Down Expand Up @@ -874,164 +876,4 @@ PYBIND11_MODULE(pyqmap, m, py::mod_gil_not_used()) {
"Returns the animation csv string")
.def("save_animation_csv", &na::NeutralAtomMapper::saveAnimationCsv,
"Saves the animation csv string to a file", "filename"_a);

// Neutral Atom State Preparation
py::class_<na::NASolver>(m, "NAStatePreparationSolver", R"(
The neutral atom state preparation solver generates an optimal sequence of
neutral atom operations for a given state preparation circuit.
)")
.def(py::init<uint16_t, uint16_t, uint16_t, uint16_t, uint16_t, uint16_t,
uint16_t, uint16_t, uint16_t, uint16_t>(),
"max_x"_a, "max_y"_a, "max_c"_a, "max_r"_a, "max_h_offset"_a,
"max_v_offset"_a, "max_h_dist"_a, "max_v_dist"_a,
"min_entangling_y"_a, "max_entangling_y"_a, R"(
Create a solver instance for the neutral atom state preparation problem.

The solver is based on a 2D grid abstraction of the neutral atom quantum
computer. The 2D plane is divided into interaction sites. Each interaction site
is denoted by abstract x- and y-coordinates. The parameter `max_x` specifies the
maximum x-coordinate, and `max_y` specifies the maximum y-coordinate. In the
center of an interaction site, sits an SLM trap. Around that trap there are
several possible discrete AOD positions arranged as a grid. The specific
position of an atom within an interaction site is determined by the x- and
y-offset from the SLM trap, i.e., those can be positive and negative. The
maximum absolute value of the x- and y-offset is specified by `max_h_offset` and
`max_v_offset`, respectively. Then, the parameter `max_c` specifies the maximum
number of AOD columns, and `max_r` specifies the maximum number of AOD rows.
Finally, in order to interact during a Rydberg stage, atoms must be located
within a certain distance. The maximum horizontal and vertical distance between
two atoms is specified by `max_h_dist` and `max_v_dist`, respectively. The
parameter `min_entangling_y` specifies the minimum y-coordinate for entangling
operations, and `max_entangling_y` specifies the maximum y-coordinate for
entangling operations. Hence, y-coordinates outside of this range are located in
the storage zone.

.. note::
The solver can only handle a single storage zone below the entangling zone,
i.e., in this case `min_entangling_y` must be zero and `max_entangling_y`
must be less than `max_y`.

:param max_x: is the maximum discrete x-coordinate of the interaction sites
:param max_y: is the maximum discrete y-coordinate of the interaction sites
:param max_c: is the maximum number of AOD columns
:param max_r: is the maximum number of AOD rows
:param max_h_offset: is the maximum horizontal offset of the atoms
:param max_v_offset: is the maximum vertical offset of the atoms
:param max_h_dist: is the maximum horizontal distance between two atoms
:param max_v_dist: is the maximum vertical distance between two atoms
:param min_entangling_y: is the minimum y-coordinate for entangling operations
:param max_entangling_y: is the maximum y-coordinate for entangling operations
:raises ValueError: if one of the parameters is invalid, e.g., is a negative
value
)")
.def("solve", &na::NASolver::solve, "ops"_a, "num_qubits"_a,
"num_stages"_a, "num_transfers"_a, "mind_ops_order"_a,
"shield_idle_qubits"_a, R"(
Solve the neutral atom state preparation problem.

The solver generates an optimal sequence of neutral atom operations for a given
state preparation circuit. The circuit is given as a list of operations, where
each operation is a pair of qubits. The sequence is divided into stages. Each
stage is either a Rydberg stage or a transfer stage. In a Rydberg stage,
adjacent qubits in the entangling zone undergo an entangling gate. In a transfer
stage, atoms can be stored from AOD into SLM traps and loaded from SLM traps
into AOD. At the end of each stage, the atoms are shuttled to their next
position. The number of stages is specified by `num_stages`. The number of
transfers is fixed by `num_transfers` if give. If this parameter is not
specified, then the solver will determine the optimal number of transfers. The
parameter `mind_ops_order` specifies whether the order of the operations in the
circuit should be preserved. The parameter `shield_idle_qubits` specifies
whether idle qubits should be shielded from the entangling operations.

.. note::
To retrieve the list of qubit pairs from a quantum circuit, use the function
:func:`get_ops_for_solver`.

.. note::
The returned solver's result can either directly exported to the JSON format
by calling the method :func:`json` on the result object or the result object
can be passed to the function :func:`generate_code` to generate code
consisting of neutral atom operations.

:param ops: is the list of operations in the circuit
:param num_qubits: is the number of qubits in the circuit
:param num_stages: is the number of stages in the sequence
:param num_transfers: (optional) is the number of transfers in the sequence
:param mind_ops_order: is True if the order of the operations should be
preserved
:param shield_idle_qubits: is True if idle qubits should be shielded
:returns: the result of the solver
:raises ValueError: if one of the numeral parameters is invalid, e.g., is a
negative value
)");

py::class_<na::NASolver::Result>(
m, "NAStatePreparationSolver.Result",
"Neutral Atom State Preparation Solver Result")
.def(py::init<>(), "Create a result object")
.def(
"json",
[](const na::NASolver::Result& result) { return result.json(); }, R"(
Returns the result as a JSON string.

:returns: the result as a JSON string
)");

m.def(
"generate_code",
[](const qc::QuantumComputation& qc, const na::NASolver::Result& result,
const uint16_t minAtomDist, const uint16_t noInteractionRadius,
const uint16_t zoneDist) {
return na::CodeGenerator::generate(qc, result, minAtomDist,
noInteractionRadius, zoneDist)
.toString();
},
"qc"_a, "result"_a, "min_atom_dist"_a = 1, "no_interaction_radius"_a = 10,
"zone_dist"_a = 24, R"(
Generate code for the given circuit using the solver's result. Some parameters
of the abstraction from the 2D grid used for the solver must be provided again.

:param qc: is the quantum circuit
:param result: is the result of the solver
:param min_atom_dist: is the minimum distance between atoms
:param no_interaction_radius: is the radius around an atom where no other atom
can be placed during an entangling operation that should not interact with the
atom
:param zone_dist: is the distance between zones, i.e., the minimal distance
between two atoms in different zones
:raises ValueError: if one of the numeral parameters is invalid, e.g., is a
negative value)");

m.def(
"get_ops_for_solver",
[](const qc::QuantumComputation& qc, const std::string& operationType,
const uint64_t numControls, const bool quiet) {
auto opTypeLowerStr = operationType;
std::transform(opTypeLowerStr.begin(), opTypeLowerStr.end(),
opTypeLowerStr.begin(),
[](unsigned char c) { return std::tolower(c); });
return na::NASolver::getOpsForSolver(
qc, qc::opTypeFromString(operationType), numControls, quiet);
},
"qc"_a, "operation_type"_a = "Z", "num_operands"_a = 1, "quiet"_a = true,
R"(
Extract entangling operations as list of qubit pairs from the circuit.

.. warning::
This function can only extract qubit pairs of two-qubit operations.
I.e., the operands of the operation plus the controls must be equal to two.

:param qc: is the quantum circuit
:param operation_type: is the type of operation to extract, e.g., "z" for CZ
gates
:param num_controls: is the number of controls the operation acts on, e.g., 1
for CZ gates
:param quiet: if True, suppresses warning when the circuit contains operations
other than the specified operation type
:return: list of qubit pairs
:raises ValueError: if the circuit contains operations other than the specified
operation type and quiet is False
:raises ValueError: if the operation has more than two operands including
controls
)");
}
Loading