Skip to content

Commit af0ebcf

Browse files
authored
Reapply "Add call to python compiler (#1715)" (#1760) (#1761)
This reverts commit a2e4742.
1 parent f0a8e02 commit af0ebcf

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-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-dev29
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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ lxml_html_clean
3333
--extra-index-url https://test.pypi.org/simple/
3434
pennylane-lightning-kokkos==0.42.0-dev16
3535
pennylane-lightning==0.42.0-dev16
36-
pennylane==0.42.0-dev29
36+
pennylane==0.42.0-dev33

frontend/catalyst/compiler.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,14 @@ def run(self, mlir_module, *args, **kwargs):
506506
(str): filename of shared object
507507
"""
508508

509-
self.is_using_python_compiler()
509+
if self.is_using_python_compiler():
510+
# We keep this module here to keep xDSL requirement optional
511+
# Only move this is it has been decided that xDSL is no longer optional.
512+
# pylint: disable-next=import-outside-toplevel
513+
from pennylane.compiler.python_compiler.impl import Compiler as PythonCompiler
514+
515+
compiler = PythonCompiler()
516+
mlir_module = compiler.run(mlir_module)
510517

511518
return self.run_from_ir(
512519
mlir_module.operation.get_asm(

0 commit comments

Comments
 (0)