Skip to content

Document Qrisp MLIR generation #48

@rainij

Description

@rainij

I Qrisp "frontend" assumes that the input IR we receive went roughly through the following process:

  • Generate mlir via Jaspr.to_mlir() (contains stablehlo)
  • Lower stablehlo to standard dialects - somehow.

An example for the first step is attached below. However, we never documented it and especially have no standard way for the second step. Options are:

We hope that this simplifies once eclipse-qrisp/Qrisp#528 hits the released version of Qrisp. But in the mean-time we need something that works. And in any case the first part needs some documenting.

The task

I propose to add a subfolder mlir/test/tools/qcc/qrisp/ were we put all tests starting from qrisp as "frontend". This folder should get a README.md documenting what needs to be done to produce MLIR from a given python program. Each test should always document the corresponding python script from which it was derived.

Appendix: Using to_mlir()

from qrisp import *
from qrisp.jasp import make_jaspr

def example():
    qv = QuantumVariable(2)
    h(qv[0])
    cx(qv[0], qv[1])
    return measure(qv)

jaspr = make_jaspr(example)()

mlir_stablehlo = jaspr.to_mlir()

print(mlir_stablehlo)

Metadata

Metadata

Labels

priority::highSomebody should work on this ASAPstatus::approvedTeam *explicitly* approved this

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions