Skip to content

Conversation

@johnzl-777
Copy link
Contributor

This was pretty straightforward but the scf tests I had to rework a bit.

There was a test where I use squin.broadcast.measure in one branch of an scf.IfElse but the problem is that the passes/combination of passes I know to get qalloc to cough up an IList with concrete length inevitably eliminate the scf.IfElse altogether.

My workaround is to just use the 1Q measure which, funny enough, works but only because it immediately creates an IList with a concrete length the measure_id analysis can consume 😅

@johnzl-777 johnzl-777 requested a review from david-pl October 28, 2025 15:58
@johnzl-777 johnzl-777 linked an issue Oct 28, 2025 that may be closed by this pull request
@johnzl-777 johnzl-777 marked this pull request as draft October 28, 2025 19:36
@codecov
Copy link

codecov bot commented Oct 29, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@github-actions
Copy link
Contributor

github-actions bot commented Oct 29, 2025

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
9508 8398 88% 0% 🟢

New Files

No new covered files...

Modified Files

No covered modified files...

updated for commit: c781216 by action🐍

@david-pl
Copy link
Collaborator

There was a test where I use squin.broadcast.measure in one branch of an scf.IfElse but the problem is that the passes/combination of passes I know to get qalloc to cough up an IList with concrete length inevitably eliminate the scf.IfElse altogether.

@johnzl-777 that shouldn't happen, since broadcast.measure(q) and measure(q[0]) have different side effects: the first one is changing the state for all qubits, where the latter only affects the first one. So, if that IfElse gets eliminated it might be a bug.
I saw that you changed the number of qubits in the test though. So maybe this elimination only happened when using a single qubit, in which case the statements are equivalent?

Also, there was a test failing on Python 3.10, because somehow CSE didn't eliminate a line which threw off the line number of the results. I "fixed" that, by getting the results based on the variable names rather than the line number.

@johnzl-777 johnzl-777 marked this pull request as ready for review October 29, 2025 12:43
@johnzl-777
Copy link
Contributor Author

Also, there was a test failing on Python 3.10, because somehow CSE didn't eliminate a line which threw off the line number of the results. I "fixed" that, by getting the results based on the variable names rather than the line number.

Thank you so much for the fix! I guess I should have let CI run its course before going to bed last night ):

As for the broadcast vs 1q measure I think the elimination problem was from the fact I was using a concrete boolean. The way around this is to just have a variable as a condition. And now that I've revisited this I realize that I CAN use Flatten now and get concrete info (: so I'll revise the test 👍

@johnzl-777 johnzl-777 merged commit db67b8b into main Oct 29, 2025
11 checks passed
@johnzl-777 johnzl-777 deleted the john/fix-measure-id-tests branch October 29, 2025 13:13
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.

Failing tests in Measurement ID analysis.

3 participants