openqasm / qe-compiler

An MLIR based compiler dynamic circuit compiler for real-time control systems supporting OpenQASM 3
Other
38 stars 12 forks source link

Add qasm3 generation error handling #306

Closed taalexander closed 3 months ago

taalexander commented 3 months ago

Closes #236. This PR adds support for returning diagnostics for OpenQASM3 generation errors. It also adds an extension to the MLIR diagnostics engine for returning qss-compiler diagnostics within any pass or context with better diagnostic handling through MLIR's builtin diagnostic handlers.

Returning a QSSC diagnostic from a pass should be as simple as

qssc::emitError(op, cat) << "Message";
taalexander commented 3 months ago

This is awesome! I'm wondering if the changes made in QUIRToStandard.cpp, QubitLocalization.cpp and QubitLocalization.h are related to error handling? If not, would it be better to move it to a separate PR?

These are related insofar as getting debug tests to pass. I do not want to move them to another PR. As this is general cleanup work to enable testing.

taalexander commented 3 months ago

Hi Soolu, thanks for finding this. I confirm I can reproduce it.

taalexander commented 3 months ago

I've fixed this in c1b2cb3.