Skip to content

Commit 7917096

Browse files
erick-xanadumudit2812PietropaoloFrisoni
authored
Add call to python compiler (#1715)
**Context:** Adds last piece of missing infrastructure for Catalyst to use the Python compiler. **Description of the Change:** Call the Python compiler. --------- Co-authored-by: Mudit Pandey <[email protected]> Co-authored-by: Pietropaolo Frisoni <[email protected]>
1 parent 02af052 commit 7917096

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

.dep-versions

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ enzyme=v0.0.149
88

99
# For a custom PL version, update the package version here and at
1010
# 'doc/requirements.txt
11-
pennylane=0.42.0-dev27
11+
pennylane=0.42.0-dev33
1212

1313
# For a custom LQ/LK version, update the package version here and at
1414
# 'doc/requirements.txt'

doc/releases/changelog-dev.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
<h3>New features since last release</h3>
44

5+
* Added integration with PennyLane's experimental python compiler based on xDSL.
6+
This allows developers and users to write xDSL transformations that can be used with Catalyst.
7+
[(#1715)](https://github.com/PennyLaneAI/catalyst/pull/1715)
8+
59
* A new compilation pass called :func:`~.passes.ppr_to_ppm` has been added to Catalyst
610
to decompose Pauli product rotations (PPRs), :math:`\exp(-iP_{\{x, y, z\}} \theta)`, into
711
Pauli product measurements (PPMs). Non-Clifford PPR (:math:`\theta = \tfrac{\pi}{8}`) requires

doc/requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,10 @@ mistune==0.8.4
2828
sphinxext-opengraph==0.9.0
2929
matplotlib==3.8.0
3030
lxml_html_clean
31+
xdsl
3132

3233
# Pre-install PL development wheels
3334
--extra-index-url https://test.pypi.org/simple/
3435
pennylane-lightning-kokkos==0.42.0-dev16
3536
pennylane-lightning==0.42.0-dev16
36-
pennylane==0.42.0-dev27
37+
pennylane==0.42.0-dev33

frontend/catalyst/compiler.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
from os import path
2929
from typing import List, Optional
3030

31+
from pennylane.compiler.python_compiler.impl import Compiler as PythonCompiler
32+
3133
from catalyst.logging import debug_logger, debug_logger_init
3234
from catalyst.pipelines import CompileOptions
3335
from catalyst.utils.exceptions import CompileError
@@ -506,7 +508,10 @@ def run(self, mlir_module, *args, **kwargs):
506508
(str): filename of shared object
507509
"""
508510

509-
self.is_using_python_compiler()
511+
if self.is_using_python_compiler():
512+
513+
compiler = PythonCompiler()
514+
mlir_module = compiler.run(mlir_module)
510515

511516
return self.run_from_ir(
512517
mlir_module.operation.get_asm(

0 commit comments

Comments
 (0)