Skip to content

Conversation

rafaelha
Copy link
Contributor

With this PR, when debug=True in EmitStimMain, output like this will now be emitted:

# v-- File "/Users/rafaelhaenel/Documents/quera/kirin-workspace/bloqade-circuit/test/stim/emit/test_stim_str.py", line 6, col 28
CX 0 1
# v-- File "/Users/rafaelhaenel/Documents/quera/kirin-workspace/bloqade-circuit/test/stim/emit/test_stim_str.py", line 6, col 28
CX 0 1
# v-- File "/Users/rafaelhaenel/Documents/quera/kirin-workspace/bloqade-circuit/test/stim/emit/test_stim_str.py", line 6, col 28
CX 0 1
# v-- File "/Users/rafaelhaenel/Documents/quera/kirin-workspace/bloqade-circuit/test/stim/emit/test_stim_str.py", line 6, col 28
I_ERROR[loss](0.10000000) 0

I'm not fully sure if the source info is actually correct -- or if that's the format that is required. Open to feedback.

@rafaelha rafaelha requested a review from kaihsin October 16, 2025 19:26
@codecov
Copy link

codecov bot commented Oct 16, 2025

Codecov Report

❌ Patch coverage is 91.66667% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/bloqade/stim/emit/stim_str.py 91.66% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@github-actions
Copy link
Contributor

github-actions bot commented Oct 16, 2025

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
9471 8365 88% 0% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
src/bloqade/stim/emit/stim_str.py 98% 🟢
TOTAL 98% 🟢

updated for commit: 20bfb74 by action🐍

@kaihsin
Copy link
Contributor

kaihsin commented Oct 21, 2025

That seems like the source information does not get propogate when rewrite Squin to Stim

@rafaelha
Copy link
Contributor Author

rafaelha commented Oct 21, 2025

That seems like the source information does not get propogate when rewrite Squin to Stim

Actually the problem is not the rewrite. Even when I write directly in stim, the following code

image

produces

# v-- File "/kirin-workspace/bloqade-circuit/test/stim/emit/test_stim_str.py", line 3, col 49
I_ERROR[loss](0.10000000) 0 1 3

So this is coming from kirin. Let me try to track it down.

@rafaelha
Copy link
Contributor Author

@kaihsin Please have a look at the latest commit. Now the source info is shown correctly for stim.main.

However, I'm not to happy with how I had to modify EmitStimMain to extract the offset and line number. A better solution would potentially involve changing kirin.

Additionally, source info is however lost in the SquinToStimPass. Fixing this requires making changes to kirin because the inline pass removes all source info.

If you agree, I will make a PR into kirin.

@kaihsin
Copy link
Contributor

kaihsin commented Oct 21, 2025

@Roger-luo

@Roger-luo
Copy link
Collaborator

Yes please create a PR on Kirin side - we wasn't being careful in handling these source info when creating the pass.

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.

3 participants