Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⬆️👽 update to latest MQT Core version #531

Merged
merged 3 commits into from
Jan 8, 2025
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
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ jobs:
needs: change-detection
if: fromJSON(needs.change-detection.outputs.run-python-tests)
uses: cda-tum/mqt-workflows/.github/workflows/[email protected]
with:
# Runs all Python tests in separate jobs to maximize parallelism
run-tests-individually: true

code-ql:
name: 📝 CodeQL
Expand Down
2 changes: 1 addition & 1 deletion cmake/ExternalDependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ endif()
# cmake-format: off
set(MQT_CORE_VERSION 2.7.1
CACHE STRING "MQT Core version")
set(MQT_CORE_REV "ee7482834c75c6ba7b5ce5fbd74829cb513e3c01"
set(MQT_CORE_REV "a7032324072fef82cc5edc8798ca8b72870fb8d2"
CACHE STRING "MQT Core identifier (tag, branch or commit hash)")
set(MQT_CORE_REPO_OWNER "cda-tum"
CACHE STRING "MQT Core repository owner (change when using a fork)")
Expand Down
21 changes: 14 additions & 7 deletions include/checker/dd/TaskManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
#include "ir/operations/OpType.hpp"
#include "ir/operations/Operation.hpp"

#include <cassert>
#include <cstddef>
#include <memory>
#include <utility>

namespace ec {
enum class Direction : bool { Left = true, Right = false };
Expand Down Expand Up @@ -53,10 +55,10 @@ template <class DDType, class Config = dd::DDPackageConfig> class TaskManager {
}

[[nodiscard]] qc::MatrixDD getDD() {
return dd::getDD((*iterator).get(), *package, permutation);
return dd::getDD(iterator->get(), *package, permutation);
}
[[nodiscard]] qc::MatrixDD getInverseDD() {
return dd::getInverseDD((*iterator).get(), *package, permutation);
return dd::getInverseDD(iterator->get(), *package, permutation);
}

[[nodiscard]] const qc::QuantumComputation* getCircuit() const noexcept {
Expand Down Expand Up @@ -85,17 +87,22 @@ template <class DDType, class Config = dd::DDPackageConfig> class TaskManager {
++iterator;
}

void applySwapOperations(DDType& state) {
while (!finished() && (*iterator)->getType() == qc::SWAP) {
applyGate(state);
void applySwapOperations() {
while (!finished() && (*iterator)->getType() == qc::SWAP &&
!(*iterator)->isControlled()) {
const auto& targets = (*iterator)->getTargets();
assert(targets.size() == 2);
const auto t1 = targets[0];
const auto t2 = targets[1];
std::swap(permutation.at(t1), permutation.at(t2));
++iterator;
}
}
void applySwapOperations() { applySwapOperations(internalState); }

void advance(DDType& state, const std::size_t steps) {
for (std::size_t i = 0U; i < steps && !finished(); ++i) {
applyGate(state);
applySwapOperations(state);
applySwapOperations();
}
}
void advance(DDType& state) { advance(state, 1U); }
Expand Down
4 changes: 2 additions & 2 deletions src/checker/dd/DDAlternatingChecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ void DDAlternatingChecker::initialize() {
void DDAlternatingChecker::execute() {
while (!taskManager1.finished() && !taskManager2.finished() && !isDone()) {
// skip over any SWAP operations
taskManager1.applySwapOperations(functionality);
taskManager2.applySwapOperations(functionality);
taskManager1.applySwapOperations();
taskManager2.applySwapOperations();

if (!taskManager1.finished() && !taskManager2.finished() && !isDone()) {
// whenever the current functionality resembles the identity, identical
Expand Down
1 change: 1 addition & 0 deletions src/checker/dd/DDSimulationChecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ EquivalenceCriterion DDSimulationChecker::checkEquivalence() {
// adjust reference counts to facilitate reuse of the simulation checker
taskManager1.decRef();
taskManager2.decRef();
dd->decRef(initialState);

return equivalence;
}
Expand Down
6 changes: 3 additions & 3 deletions src/checker/dd/simulation/StateGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,15 +143,15 @@ qc::VectorDD StateGenerator::generateRandomStabilizerState(
// circuit
auto stabilizer = simulate(&rcs, dd.makeZeroState(randomQubits), dd);

// decrease the ref count right after so that it stays correct later on
dd.decRef(stabilizer);

// add |0> edges for all the ancillary qubits
auto initial = stabilizer;
for (std::size_t p = randomQubits; p < totalQubits; ++p) {
initial = dd.makeDDNode(static_cast<dd::Qubit>(p),
std::array{initial, qc::VectorDD::zero()});
}
// properly set the reference count for the state
dd.incRef(initial);
dd.decRef(stabilizer);

// return the resulting decision diagram
return initial;
Expand Down
Loading