diff --git a/.github/workflows/build-wheel-linux-x86_64.yaml b/.github/workflows/build-wheel-linux-x86_64.yaml index c703aa5970..418854ce2f 100644 --- a/.github/workflows/build-wheel-linux-x86_64.yaml +++ b/.github/workflows/build-wheel-linux-x86_64.yaml @@ -492,7 +492,7 @@ jobs: python${{ matrix.python_version }} -m pytest frontend/test/pytest -n auto python${{ matrix.python_version }} -m pytest frontend/test/pytest --backend="lightning.kokkos" -n auto python${{ matrix.python_version }} -m pytest frontend/test/async_tests - # python${{ matrix.python_version }} -m pytest frontend/test/pytest --runbraket=LOCAL -n auto + python${{ matrix.python_version }} -m pytest frontend/test/pytest --runbraket=LOCAL -n auto python${{ matrix.python_version }} -m pytest frontend/test/test_oqc/oqc -n auto - name: Run Standalone Plugin Tests diff --git a/.github/workflows/build-wheel-macos-arm64.yaml b/.github/workflows/build-wheel-macos-arm64.yaml index 153b3b816c..b6a79be800 100644 --- a/.github/workflows/build-wheel-macos-arm64.yaml +++ b/.github/workflows/build-wheel-macos-arm64.yaml @@ -477,7 +477,7 @@ jobs: python${{ matrix.python_version }} -m pytest frontend/test/pytest -n auto python${{ matrix.python_version }} -m pytest frontend/test/pytest --backend="lightning.kokkos" -n auto python${{ matrix.python_version }} -m pytest frontend/test/async_tests - # python${{ matrix.python_version }} -m pytest frontend/test/pytest --runbraket=LOCAL -n auto + python${{ matrix.python_version }} -m pytest frontend/test/pytest --runbraket=LOCAL -n auto python${{ matrix.python_version }} -m pytest frontend/test/test_oqc/oqc -n auto - name: Run Standalone Plugin Tests diff --git a/.github/workflows/build-wheel-macos-x86_64.yaml b/.github/workflows/build-wheel-macos-x86_64.yaml index b51bf58b6e..9e99f3b6c3 100644 --- a/.github/workflows/build-wheel-macos-x86_64.yaml +++ b/.github/workflows/build-wheel-macos-x86_64.yaml @@ -445,7 +445,7 @@ jobs: # TODO: Uncomment after fixing https://github.com/PennyLaneAI/pennylane-lightning/issues/552 # python${{ matrix.python_version }} -m pytest frontend/test/pytest --backend="lightning.kokkos" -n auto python${{ matrix.python_version }} -m pytest frontend/test/async_tests - # python${{ matrix.python_version }} -m pytest frontend/test/pytest --runbraket=LOCAL -n auto + python${{ matrix.python_version }} -m pytest frontend/test/pytest --runbraket=LOCAL -n auto python${{ matrix.python_version }} -m pytest frontend/test/test_oqc/oqc -n auto - name: Run Standalone Plugin Tests diff --git a/.github/workflows/check-catalyst.yaml b/.github/workflows/check-catalyst.yaml index 396eea19e6..07c2c0120f 100644 --- a/.github/workflows/check-catalyst.yaml +++ b/.github/workflows/check-catalyst.yaml @@ -565,62 +565,62 @@ jobs: run: | make pytest TEST_BACKEND="lightning.kokkos" SKIP_OQD="true" -# frontend-tests-openqasm-device: -# name: Frontend Tests (backend="openqasm3") -# needs: [constants, llvm, runtime, quantum, determine_runner] -# runs-on: ${{ needs.determine_runner.outputs.runner_group }} -# strategy: -# matrix: -# compiler: ${{ fromJson(needs.constants.outputs.compilers) }} -# -# steps: -# - name: Checkout Catalyst repo -# uses: actions/checkout@v4 -# -# - name: Install device dependencies (OpenQasm device) -# run: | -# pip install amazon-braket-pennylane-plugin -# echo "AWS_DEFAULT_REGION=us-east-1" >> $GITHUB_ENV -# -# - name: Install Deps -# run: | -# sudo apt-get update -# sudo apt-get install -y python3 python3-pip libomp-dev libasan6 make ninja-build -# python3 --version | grep ${{ needs.constants.outputs.primary_python_version }} -# python3 -m pip install -r requirements.txt -# make frontend -# -# - name: Get Cached LLVM Build -# id: cache-llvm-build -# uses: actions/cache@v4 -# with: -# path: llvm-build -# key: ${{ runner.os }}-llvm-${{ needs.constants.outputs.llvm_version }}-default-build-${{ matrix.compiler }} -# fail-on-cache-miss: true -# -# - name: Download Quantum Build Artifact -# uses: actions/download-artifact@v4 -# with: -# name: quantum-build-${{ matrix.compiler }} -# path: quantum-build -# -# - name: Download Catalyst-Runtime Artifact -# uses: actions/download-artifact@v4 -# with: -# name: runtime-build-${{ matrix.compiler }} -# path: runtime-build/lib -# -# - name: Add Frontend Dependencies to PATH -# run: | -# echo "PYTHONPATH=$PYTHONPATH:$(pwd)/quantum-build/python_packages/quantum" >> $GITHUB_ENV -# echo "RUNTIME_LIB_DIR=$(pwd)/runtime-build/lib" >> $GITHUB_ENV -# echo "MLIR_LIB_DIR=$(pwd)/llvm-build/lib" >> $GITHUB_ENV -# echo "CATALYST_BIN_DIR=$(pwd)/quantum-build/bin" >> $GITHUB_ENV -# chmod +x $(pwd)/quantum-build/bin/catalyst-cli # artifact upload does not preserve permissions -# -# - name: Run Python Pytest Tests -# run: | -# make pytest TEST_BRAKET=LOCAL + frontend-tests-openqasm-device: + name: Frontend Tests (backend="openqasm3") + needs: [constants, llvm, runtime, quantum, determine_runner] + runs-on: ${{ needs.determine_runner.outputs.runner_group }} + strategy: + matrix: + compiler: ${{ fromJson(needs.constants.outputs.compilers) }} + + steps: + - name: Checkout Catalyst repo + uses: actions/checkout@v4 + + - name: Install device dependencies (OpenQasm device) + run: | + pip install amazon-braket-pennylane-plugin + echo "AWS_DEFAULT_REGION=us-east-1" >> $GITHUB_ENV + + - name: Install Deps + run: | + sudo apt-get update + sudo apt-get install -y python3 python3-pip libomp-dev libasan6 make ninja-build + python3 --version | grep ${{ needs.constants.outputs.primary_python_version }} + python3 -m pip install -r requirements.txt + make frontend + + - name: Get Cached LLVM Build + id: cache-llvm-build + uses: actions/cache@v4 + with: + path: llvm-build + key: ${{ runner.os }}-llvm-${{ needs.constants.outputs.llvm_version }}-default-build-${{ matrix.compiler }} + fail-on-cache-miss: true + + - name: Download Quantum Build Artifact + uses: actions/download-artifact@v4 + with: + name: quantum-build-${{ matrix.compiler }} + path: quantum-build + + - name: Download Catalyst-Runtime Artifact + uses: actions/download-artifact@v4 + with: + name: runtime-build-${{ matrix.compiler }} + path: runtime-build/lib + + - name: Add Frontend Dependencies to PATH + run: | + echo "PYTHONPATH=$PYTHONPATH:$(pwd)/quantum-build/python_packages/quantum" >> $GITHUB_ENV + echo "RUNTIME_LIB_DIR=$(pwd)/runtime-build/lib" >> $GITHUB_ENV + echo "MLIR_LIB_DIR=$(pwd)/llvm-build/lib" >> $GITHUB_ENV + echo "CATALYST_BIN_DIR=$(pwd)/quantum-build/bin" >> $GITHUB_ENV + chmod +x $(pwd)/quantum-build/bin/catalyst-cli # artifact upload does not preserve permissions + + - name: Run Python Pytest Tests + run: | + make pytest TEST_BRAKET=LOCAL runtime-device-tests: name: Runtime Tests (Linux) diff --git a/.github/workflows/check-pl-compat.yaml b/.github/workflows/check-pl-compat.yaml index 50476f0620..39d5d50f4f 100644 --- a/.github/workflows/check-pl-compat.yaml +++ b/.github/workflows/check-pl-compat.yaml @@ -171,9 +171,9 @@ jobs: run: | make pytest TEST_BACKEND="lightning.kokkos" - # - name: Run Frontend Tests (Braket) - # run: | - # make pytest TEST_BRAKET=LOCAL + - name: Run Frontend Tests (Braket) + run: | + make pytest TEST_BRAKET=LOCAL - name: Run Demos run: | # Do not run demos in parallel, seems to cause package issues with numpy. diff --git a/.github/workflows/scripts/linux_arm64/rh8/test_wheels.sh b/.github/workflows/scripts/linux_arm64/rh8/test_wheels.sh index f8f6ab13fc..531dbcce1e 100644 --- a/.github/workflows/scripts/linux_arm64/rh8/test_wheels.sh +++ b/.github/workflows/scripts/linux_arm64/rh8/test_wheels.sh @@ -45,5 +45,5 @@ export PATH=/catalyst/llvm-build/bin:/opt/_internal/cpython-${PYTHON_MAJOR_MINOR /usr/bin/python3 -m pytest -v /catalyst/frontend/test/pytest -n auto /usr/bin/python3 -m pytest -v /catalyst/frontend/test/pytest --backend="lightning.kokkos" -n auto /usr/bin/python3 -m pytest /catalyst/frontend/test/async_tests -# /usr/bin/python3 -m pytest -v /catalyst/frontend/test/pytest --runbraket=LOCAL -n auto +/usr/bin/python3 -m pytest -v /catalyst/frontend/test/pytest --runbraket=LOCAL -n auto /usr/bin/python3 -m pytest /catalyst/frontend/test/test_oqc/oqc -n auto diff --git a/frontend/test/lit/test_multi_qubit_gates.py b/frontend/test/lit/test_multi_qubit_gates.py index eae80ae881..95f4212b10 100644 --- a/frontend/test/lit/test_multi_qubit_gates.py +++ b/frontend/test/lit/test_multi_qubit_gates.py @@ -69,19 +69,21 @@ def circuit(): # We should replace instead create a custom device that has support for ISWAP # and PSWAP (which I think are unsupported in lightning.qubit and hence why they # would be decomposed. -# COM: CHECK-LABEL: public @jit_circuit +""" + + +# CHECK-LABEL: public @jit_circuit @qjit(target="mlir") @qml.qnode(qml.device("braket.local.qubit", wires=2, shots=100)) def circuit(x: float): - # COM: CHECK: {{%.+}} = quantum.custom "ISWAP"() {{.+}} : !quantum.bit, !quantum.bit + # CHECK: {{%.+}} = quantum.custom "ISWAP"() {{.+}} : !quantum.bit, !quantum.bit qml.ISWAP(wires=[0, 1]) - # COM: CHECK: {{%.+}} = quantum.custom "PSWAP"({{%.+}}) {{.+}} : !quantum.bit, !quantum.bit + # CHECK: {{%.+}} = quantum.custom "PSWAP"({{%.+}}) {{.+}} : !quantum.bit, !quantum.bit qml.PSWAP(x, wires=[0, 1]) return qml.probs() print(circuit.mlir) -""" # CHECK-LABEL: public @jit_isingZZ_circuit diff --git a/frontend/test/pytest/test_braket_local_devices.py b/frontend/test/pytest/test_braket_local_devices.py index c8c999d5e5..8dd4ddd154 100644 --- a/frontend/test/pytest/test_braket_local_devices.py +++ b/frontend/test/pytest/test_braket_local_devices.py @@ -23,9 +23,9 @@ try: qml.device("braket.local.qubit", backend="default", wires=1) -except (qml.DeviceError, ImportError): +except qml.DeviceError: pytest.skip( - "skipping Braket local tests because ``amazon-braket-pennylane-plugin`` is not installed or could not be imported", + "skipping Braket local tests because ``amazon-braket-pennylane-plugin`` is not installed", allow_module_level=True, )