KEMBAR78
Correctly distinguish measurement result and boolean variable by khalatepradnya · Pull Request #1952 · NVIDIA/cuda-quantum · GitHub
Skip to content

Conversation

@khalatepradnya
Copy link
Collaborator

@khalatepradnya khalatepradnya commented Jul 17, 2024

  • If a boolean variable is not the result of measurement then treat it as regular variable.
  • Update the value of boolean if seen in outer scope.

@khalatepradnya khalatepradnya self-assigned this Jul 17, 2024
@khalatepradnya khalatepradnya added bug fix To be listed under Bug Fixes in the release notes python bridge Involves the python bridge to quake labels Jul 17, 2024
@khalatepradnya khalatepradnya marked this pull request as draft July 17, 2024 21:10
@github-actions
Copy link

CUDA Quantum Docs Bot: A preview of the documentation can be found here.

github-actions bot pushed a commit that referenced this pull request Jul 17, 2024
@khalatepradnya khalatepradnya force-pushed the fix-bool-scope branch 2 times, most recently from 997ca6c to 5fb5e4e Compare July 17, 2024 22:34
github-actions bot pushed a commit that referenced this pull request Jul 17, 2024
@github-actions
Copy link

CUDA Quantum Docs Bot: A preview of the documentation can be found here.

@khalatepradnya khalatepradnya linked an issue Jul 17, 2024 that may be closed by this pull request
4 tasks
@khalatepradnya khalatepradnya marked this pull request as ready for review July 17, 2024 23:45
Copy link
Collaborator

@bmhowe23 bmhowe23 left a comment

Choose a reason for hiding this comment

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

LGTM

@khalatepradnya khalatepradnya enabled auto-merge (squash) July 18, 2024 02:57
@khalatepradnya khalatepradnya merged commit 33c279b into NVIDIA:main Jul 18, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Jul 18, 2024
Comment on lines +59 to +60
# CHECK: %[[VAL_18:.*]] = cc.alloca !cc.stdvec<i1>
# CHECK: cc.store %[[VAL_17]], %[[VAL_18]] : !cc.ptr<!cc.stdvec<i1>>
Copy link
Collaborator

Choose a reason for hiding this comment

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

This code doesn't create a vector, doesn't create any storage to save a vector's data, doesn't copy the vector, does potentially create a memory leak on the stack, and in the end is a dead store to a memory location that will never be read.

@khalatepradnya khalatepradnya deleted the fix-bool-scope branch July 18, 2024 16:56
@khalatepradnya khalatepradnya added this to the release 0.8.0 milestone Jul 22, 2024
@bettinaheim bettinaheim changed the title [Python] [AST Bridge] Correctly distinguish measurement result and boolean variable Correctly distinguish measurement result and boolean variable Jul 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bug fix To be listed under Bug Fixes in the release notes python bridge Involves the python bridge to quake

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Scope of variables is inconsistent within cudaq.kernel

3 participants