Repository navigation
More comprehensive update for variable updates in static exprs - #3885
Stefan J. Wernli (swernli) wants to merge 6 commits into
Conversation
46291c8 to
d8ab545
Compare
1cb7c86 to
3f6cba3
Compare
3f6cba3 to
7c52be6
Compare
ce69690 to
1a8b836
Compare
b429f78 to
f02d33a
Compare
@EntryPoint(Adaptive)
operation Main() : Int {
use (q1, q2) = (Qubit(), Qubit());
mutable a = MResetZ(q1) == One ? 1 | 2;
mutable b = MResetZ(q2) == One ? 3 | 4;
mutable temporary = 0;
if true {
set temporary = a;
set a = b;
set b = temporary;
}
b
}This should return 2, but I'm getting 0. Copilot thinks it's because we're updating the map in hash order, rather than assignment order. (Since it's hash-based, it seems possible that you won't see it on your mac.) |
operation Main() : (Result, Result) {
use (a, b) = (Qubit(), Qubit());
X(b);
mutable x = a;
let snapshot = x;
set x = b;
let before = M(snapshot);
let after = M(x);
Reset(snapshot);
Reset(x);
(before, after)
}Expected: (0, 1) / Actual: (1, 1) It's measuring Copilot's guess: The new pre-sync in For mutable The synchronization helper in It therefore falls back to: |
f02d33a to
ba08192
Compare
ba08192 to
3db685e
Compare
Can you confirm if you are getting 0 for all the compatible profiles or just for Adaptive Profile? On my system, only Adaptive is returning 0, and that issue is fixed by the (current) top of the stack, #3941. The ordering could still be problem, but I tried artificially rotating the returned vector of updates and it had no effect on the behavior. |
This is fixed by fifth entry in the stack, #3901 |
988b357 to
190c437
Compare
This adds code that better propagates variable values (including known literal values) back and forth across the hybrid and classical maps when partial eval invokes the regular evaluator for static sub-expressions.
Fixes #3801
Stack created with GitHub Stacks CLI • Give Feedback 💬