Skip to content

Commit

Permalink
⚡ dedicated unitary simulator DD package config
Browse files Browse the repository at this point in the history
Signed-off-by: burgholzer <[email protected]>
  • Loading branch information
burgholzer committed Sep 12, 2024
1 parent cd2e767 commit f128b60
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
23 changes: 23 additions & 0 deletions include/mqt-core/dd/DDpackageConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,27 @@ struct DensityMatrixSimulatorDDPackageConfig : public dd::DDPackageConfig {
static constexpr std::size_t CT_MAT_ADD_MAG_NBUCKET = 1U;
static constexpr std::size_t CT_VEC_CONJ_NBUCKET = 1U;
};

struct UnitarySimulatorDDPackageConfig : public dd::DDPackageConfig {
// unitary simulation requires more resources for matrices.
static constexpr std::size_t UT_MAT_NBUCKET = 65'536U;
static constexpr std::size_t CT_MAT_ADD_NBUCKET = 65'536U;
static constexpr std::size_t CT_MAT_MAT_MULT_NBUCKET = 65'536U;

// unitary simulation does not need any vector nodes
static constexpr std::size_t UT_VEC_NBUCKET = 1U;
static constexpr std::size_t UT_VEC_INITIAL_ALLOCATION_SIZE = 1U;

// unitary simulation needs no vector functionality
static constexpr std::size_t CT_VEC_ADD_NBUCKET = 1U;
static constexpr std::size_t CT_VEC_ADD_MAG_NBUCKET = 1U;
static constexpr std::size_t CT_MAT_ADD_MAG_NBUCKET = 1U;
static constexpr std::size_t CT_VEC_CONJ_NBUCKET = 1U;
static constexpr std::size_t CT_MAT_CONJ_TRANS_NBUCKET = 1U;
static constexpr std::size_t CT_MAT_VEC_MULT_NBUCKET = 1U;
static constexpr std::size_t CT_VEC_KRON_NBUCKET = 1U;
static constexpr std::size_t CT_MAT_KRON_NBUCKET = 1U;
static constexpr std::size_t CT_MAT_TRACE_NBUCKET = 1U;
static constexpr std::size_t CT_VEC_INNER_PROD_NBUCKET = 1U;
};
} // namespace dd
2 changes: 2 additions & 0 deletions include/mqt-core/dd/Package.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2801,4 +2801,6 @@ template <class Config> class Package {
}
};

using UnitarySimulatorDDPackage = Package<UnitarySimulatorDDPackageConfig>;

} // namespace dd
11 changes: 11 additions & 0 deletions src/dd/FunctionalityConstruction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ template MatrixDD
buildFunctionality(const qc::QuantumComputation* qc,
Package<dd::StochasticNoiseSimulatorDDPackageConfig>& dd);

template MatrixDD buildFunctionality(const qc::QuantumComputation* qc,
UnitarySimulatorDDPackage& dd);

template MatrixDD buildFunctionalityRecursive(const qc::QuantumComputation* qc,
Package<DDPackageConfig>& dd);
template bool buildFunctionalityRecursive(const qc::QuantumComputation* qc,
Expand All @@ -132,4 +135,12 @@ template bool buildFunctionalityRecursive(const qc::QuantumComputation* qc,
std::stack<MatrixDD>& s,
qc::Permutation& permutation,
Package<DDPackageConfig>& dd);
template MatrixDD buildFunctionalityRecursive(const qc::QuantumComputation* qc,
UnitarySimulatorDDPackage& dd);
template bool buildFunctionalityRecursive(const qc::QuantumComputation* qc,
const std::size_t depth,
const std::size_t opIdx,
std::stack<MatrixDD>& s,
qc::Permutation& permutation,
UnitarySimulatorDDPackage& dd);
} // namespace dd

0 comments on commit f128b60

Please sign in to comment.