Skip to content

Conversation

@david-pl
Copy link
Collaborator

Closes #164

Note: still need to test it, blocked by the issue I have (similar to the one in #183 )

@github-actions
Copy link
Contributor

github-actions bot commented Apr 23, 2025

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
6222 5285 85% 0% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
src/bloqade/noise/native/stmts.py 82% 🟢
TOTAL 82% 🟢

updated for commit: f3cac3e by action🐍

@codecov
Copy link

codecov bot commented Apr 23, 2025

Codecov Report

Attention: Patch coverage is 66.66667% with 9 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/bloqade/noise/native/stmts.py 66.66% 9 Missing ⚠️

📢 Thoughts on this report? Let us know!

@david-pl david-pl force-pushed the david/164-pauli-probs branch from 3937433 to 32af32c Compare April 23, 2025 13:29
@david-pl david-pl requested a review from weinbe58 April 23, 2025 13:31
@david-pl
Copy link
Collaborator Author

After discussion with @weinbe58:
I added a test marked with xfail that expects an ir.ValidationError to trigger. The cause is that the overridden check methods are actually not called during verification. We'll wait for an update in kirin for that.

Copy link
Member

@weinbe58 weinbe58 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you create a shared implementation of the check put it outside the method? That would make testing a bit easier as well since you can check the implementation even if the statements do not run the verify.

@david-pl david-pl force-pushed the david/164-pauli-probs branch from 32af32c to f3cac3e Compare April 25, 2025 08:03
@david-pl
Copy link
Collaborator Author

@weinbe58 I refactored things so now all the statements share the check. However, I still can't get the error to trigger in the CI, even after updating to kirin v0.17.2, even though I explicitly call .verify() on the kernel. What's also odd is that now I can't even trigger the error when overriding the verify method directly.

@Roger-luo here's a kirin MWE on v0.17.2 that also never triggers the error raised in check. Is that a bug?

from kirin import ir, lowering
from kirin.decl import statement
from kirin.prelude import basic_no_opt

dialect = ir.Dialect("foo")


@statement(dialect=dialect)
class InvalidStmt(ir.Statement):
    traits = frozenset({lowering.FromPythonCall()})

    def check(self):
        raise ValueError("Never triggers")


@ir.dialect_group(basic_no_opt.add(dialect))
def foo(self):
    def run_pass(mt):
        pass

    return run_pass


@foo
def test():
    InvalidStmt()


test.verify()

Copy link
Member

@weinbe58 weinbe58 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just address the comments but LGTM.

@weinbe58 weinbe58 merged commit d044d1b into main Apr 25, 2025
3 checks passed
@david-pl david-pl deleted the david/164-pauli-probs branch April 26, 2025 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Assertion error if Pauli channel probabilities are not properly normalized

4 participants