diff --git a/CHANGELOG.md b/CHANGELOG.md index 4994358b81..7d5a2f89ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ releases may include breaking changes. ### Added +- ✨ Expose the optional QDMI device queue depth through the C++ and Python + FoMaC APIs ([#2010]) ([**@burgholzer**]) - ✨ Add PennyLane support for gate-based QDMI devices ([#2005]) ([**@burgholzer**]) - ✨ Integrate QDMI devices as MLIR compiler targets across C++, Python, and @@ -720,6 +722,7 @@ for previous changelogs._ +[#2010]: https://github.com/munich-quantum-toolkit/core/pull/2010 [#2007]: https://github.com/munich-quantum-toolkit/core/pull/2007 [#2006]: https://github.com/munich-quantum-toolkit/core/pull/2006 [#2005]: https://github.com/munich-quantum-toolkit/core/pull/2005 diff --git a/bindings/fomac/fomac.cpp b/bindings/fomac/fomac.cpp index bad0b9681c..0879e3f473 100644 --- a/bindings/fomac/fomac.cpp +++ b/bindings/fomac/fomac.cpp @@ -389,6 +389,9 @@ when the custom slot is unsupported.)pb"); device.def("needs_calibration", &fomac::Device::getNeedsCalibration, "Returns whether the device needs calibration."); + device.def("queue_depth", &fomac::Device::getQueueDepth, + "Returns the current queue depth, or None if unavailable."); + device.def("length_unit", &fomac::Device::getLengthUnit, "Returns the unit of length used by the device."); diff --git a/cmake/ExternalDependencies.cmake b/cmake/ExternalDependencies.cmake index c7f695d2b0..25a6b5bbb8 100644 --- a/cmake/ExternalDependencies.cmake +++ b/cmake/ExternalDependencies.cmake @@ -89,11 +89,11 @@ if(BUILD_MQT_CORE_TESTS) endif() # cmake-format: off -set(QDMI_MINIMUM_VERSION 1.3.2 +set(QDMI_MINIMUM_VERSION 1.3.3 CACHE STRING "Minimum QDMI version") -set(QDMI_VERSION 1.3.2 +set(QDMI_VERSION 1.3.3 CACHE STRING "QDMI version") -set(QDMI_REV "d05a0b418f42e54e9585d2e00af8ce23e745fd83" # v1.3.2 +set(QDMI_REV "684aae5a959d63e3affb9428df2c4a0187bdb624" # QDMI PR #486 CACHE STRING "QDMI identifier (tag, branch or commit hash)") set(QDMI_REPO_OWNER "Munich-Quantum-Software-Stack" CACHE STRING "QDMI repository owner (change when using a fork)") diff --git a/include/mqt-core/fomac/FoMaC.hpp b/include/mqt-core/fomac/FoMaC.hpp index 652fffca3e..6c9381bb3a 100644 --- a/include/mqt-core/fomac/FoMaC.hpp +++ b/include/mqt-core/fomac/FoMaC.hpp @@ -470,6 +470,9 @@ class Device { /// @see QDMI_DEVICE_PROPERTY_NEEDSCALIBRATION [[nodiscard]] std::optional getNeedsCalibration() const; + /// @see QDMI_DEVICE_PROPERTY_QUEUEDEPTH + [[nodiscard]] std::optional getQueueDepth() const; + /// @see QDMI_DEVICE_PROPERTY_LENGTHUNIT [[nodiscard]] std::optional getLengthUnit() const; diff --git a/include/mqt-core/qdmi/common/Common.hpp b/include/mqt-core/qdmi/common/Common.hpp index 0e21332eea..50d4ea4a6a 100644 --- a/include/mqt-core/qdmi/common/Common.hpp +++ b/include/mqt-core/qdmi/common/Common.hpp @@ -390,6 +390,8 @@ constexpr auto toString(const QDMI_Device_Property prop) -> const char* { return "SUPPORTED PROGRAM FORMATS"; case QDMI_DEVICE_PROPERTY_CHILDDEVICES: return "CHILD DEVICES"; + case QDMI_DEVICE_PROPERTY_QUEUEDEPTH: + return "QUEUE DEPTH"; case QDMI_DEVICE_PROPERTY_MAX: return "MAX"; case QDMI_DEVICE_PROPERTY_CUSTOM1: diff --git a/python/mqt/core/fomac.pyi b/python/mqt/core/fomac.pyi index b240309e9c..f819412a67 100644 --- a/python/mqt/core/fomac.pyi +++ b/python/mqt/core/fomac.pyi @@ -297,6 +297,9 @@ class Device: def needs_calibration(self) -> int | None: """Returns whether the device needs calibration.""" + def queue_depth(self) -> int | None: + """Returns the current queue depth, or None if unavailable.""" + def length_unit(self) -> str | None: """Returns the unit of length used by the device.""" diff --git a/src/fomac/FoMaC.cpp b/src/fomac/FoMaC.cpp index fb3e7156a6..f5c594114d 100644 --- a/src/fomac/FoMaC.cpp +++ b/src/fomac/FoMaC.cpp @@ -275,6 +275,10 @@ std::optional Device::getNeedsCalibration() const { QDMI_DEVICE_PROPERTY_NEEDSCALIBRATION); } +std::optional Device::getQueueDepth() const { + return queryProperty>(QDMI_DEVICE_PROPERTY_QUEUEDEPTH); +} + std::optional Device::getLengthUnit() const { return queryProperty>( QDMI_DEVICE_PROPERTY_LENGTHUNIT); diff --git a/test/fomac/test_fomac.cpp b/test/fomac/test_fomac.cpp index 07d16ef437..e2038c990b 100644 --- a/test/fomac/test_fomac.cpp +++ b/test/fomac/test_fomac.cpp @@ -348,6 +348,7 @@ TEST(FoMaCTest, DevicePropertyToString) { "SUPPORTED PROGRAM FORMATS"); EXPECT_STREQ(qdmi::toString(QDMI_DEVICE_PROPERTY_CHILDDEVICES), "CHILD DEVICES"); + EXPECT_STREQ(qdmi::toString(QDMI_DEVICE_PROPERTY_QUEUEDEPTH), "QUEUE DEPTH"); EXPECT_STREQ(qdmi::toString(QDMI_DEVICE_PROPERTY_MAX), "MAX"); EXPECT_STREQ(qdmi::toString(QDMI_DEVICE_PROPERTY_CUSTOM1), "CUSTOM1"); EXPECT_STREQ(qdmi::toString(QDMI_DEVICE_PROPERTY_CUSTOM2), "CUSTOM2"); @@ -423,6 +424,10 @@ TEST_P(DeviceTest, NeedsCalibration) { EXPECT_NO_THROW(std::ignore = device.getNeedsCalibration()); } +TEST_F(DDSimulatorDeviceTest, QueueDepthIsUnavailable) { + EXPECT_EQ(device.getQueueDepth(), std::nullopt); +} + TEST_P(DeviceTest, LengthUnit) { EXPECT_NO_THROW(std::ignore = device.getLengthUnit()); } diff --git a/test/python/fomac/test_fomac.py b/test/python/fomac/test_fomac.py index 631c3ab4c2..e7ca0650dc 100644 --- a/test/python/fomac/test_fomac.py +++ b/test/python/fomac/test_fomac.py @@ -169,6 +169,14 @@ def test_device_needs_calibration(device: Device) -> None: assert isinstance(needs_cal, int) +def test_device_queue_depth(device: Device) -> None: + """Test that the optional device queue depth is a non-negative integer.""" + queue_depth = device.queue_depth() + if queue_depth is not None: + assert isinstance(queue_depth, int) + assert queue_depth >= 0 + + def test_device_length_unit(device: Device) -> None: """Test that the device length unit is a non-empty string.""" lu = device.length_unit()