Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
2 changes: 1 addition & 1 deletion .dep-versions
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ enzyme=v0.0.203

# For a custom PL version, update the package version here and at
# 'doc/requirements.txt'
pennylane=0.44.0-dev44
pennylane=0.44.0-dev48

# For a custom LQ/LK version, update the package version here and at
# 'doc/requirements.txt'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.

"""Unit tests for the xDSL Quantum dialect."""

import pytest

# pylint: disable=wrong-import-position
Expand All @@ -30,7 +29,7 @@
i1,
)
from xdsl.dialects.test import TestOp
from xdsl.ir import AttributeCovT, OpResult
from xdsl.ir import AttributeCovT, Block, Operation, OpResult, Region

from catalyst.python_interface.dialects import Quantum
from catalyst.python_interface.dialects.quantum import (
Expand Down Expand Up @@ -115,7 +114,10 @@ def create_ssa_value(t: AttributeCovT) -> OpResult[AttributeCovT]:
state = create_ssa_value(TensorType(ComplexType(Float64Type()), shape=(16,)))

expected_ops_init_kwargs = {
"AdjointOp": {"qreg": qreg, "region": (CustomOp(gate_name="CNOT", in_qubits=(q0, q1)),)},
"AdjointOp": {
"qreg": qreg,
"region": Region(Block((CustomOp(gate_name="CNOT", in_qubits=(q0, q1)),))),
},
"AllocOp": {"nqubits": 3},
"AllocQubitOp": {},
"ComputationalBasisOp": {"operands": (q0, None), "result_types": (obs,)},
Expand Down Expand Up @@ -203,7 +205,10 @@ def test_only_existing_operations_are_expected():
@pytest.mark.parametrize("op", all_ops)
def test_operation_construction(op):
"""Test the constructors of operations in the Quantum dialect."""
kwargs = expected_ops_init_kwargs[op.__name__]
kwargs = {
k: v.clone() if isinstance(v, (Operation, Region)) else v
for k, v in expected_ops_init_kwargs[op.__name__].items()
}
_ = op(**kwargs)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"""Unit test module for the MLIR graph generation in the Unified Compiler visualization module."""

from pathlib import Path
from subprocess import run

import pytest

Expand All @@ -22,6 +23,10 @@
xdsl = pytest.importorskip("xdsl")
graphviz = pytest.importorskip("graphviz")

if run(["which", "dot"], check=False).returncode != 0:

Check notice on line 26 in frontend/test/pytest/python_interface/inspection/test_mlir_graph.py

View check run for this annotation

codefactor.io / CodeFactor

frontend/test/pytest/python_interface/inspection/test_mlir_graph.py#L26

Starting a process with a partial executable path (B607)
pytest.skip(reason="Graphviz isn't installed.")


import pennylane as qml

from catalyst.passes.xdsl_plugin import getXDSLPluginAbsolutePath
Expand Down
Loading