@@ -488,6 +488,7 @@ def run_python_compiler(self, mlir_module):
488
488
import xdsl
489
489
from xdsl .context import Context
490
490
from xdsl .dialects import arith , builtin , func , scf , tensor , transform
491
+ from .python_compiler import quantum
491
492
generic_assembly_format = mlir_module .operation .get_asm (binary = False , print_generic_op_form = True , assume_verified = True )
492
493
ctx = Context (allow_unregistered = True )
493
494
ctx .load_dialect (arith .Arith )
@@ -496,6 +497,7 @@ def run_python_compiler(self, mlir_module):
496
497
ctx .load_dialect (scf .Scf )
497
498
ctx .load_dialect (tensor .Tensor )
498
499
ctx .load_dialect (transform .Transform )
500
+ ctx .load_dialect (quantum .QuantumDialect )
499
501
# TODO: In order of importance
500
502
# TODO: Load quantum
501
503
# TODO: Load gradient
@@ -504,7 +506,16 @@ def run_python_compiler(self, mlir_module):
504
506
# but it is likely worse than an unregistered dialect.
505
507
# TODO: Load Catalyst
506
508
# TODO: Load ion/ppm/mbqc/zne...
507
- m = xdsl .parser .Parser (ctx , generic_assembly_format ).parse_module ()
509
+ mlir = """
510
+ func.func @foo(%arg0 : i64) -> () {
511
+ %0 = quantum.alloc(4) : !quantum.reg
512
+ %1 = quantum.alloc(%arg0) : !quantum.reg
513
+ return
514
+ }
515
+ """
516
+ m = xdsl .parser .Parser (ctx , mlir ).parse_module ()
517
+ breakpoint ()
518
+ print (m )
508
519
# TODO: transform the program based on the transform dialect
509
520
510
521
@debug_logger
0 commit comments