-
Notifications
You must be signed in to change notification settings - Fork 175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[rt] Remove ExecutionManager's qudit tracker. #1541
base: main
Are you sure you want to change the base?
[rt] Remove ExecutionManager's qudit tracker. #1541
Conversation
0c9bd69
to
bb1acf2
Compare
CUDA Quantum Docs Bot: A preview of the documentation can be found here. |
bb1acf2
to
f04c511
Compare
CUDA Quantum Docs Bot: A preview of the documentation can be found here. |
requestedAllocations.emplace_back(2, q.id); | ||
} | ||
|
||
void allocateQudits(const std::vector<cudaq::QuditInfo> &qudits) override { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was useful from a performance perspective to observe (in some way) that we were really allocating a qvector, and to queue them up and request the allocation all at once (means we can create the correct GPU pointer once, and not once + N-1 changes to the data on device). Is this type of functionality retained somewhere else? maybe i'll see it further down
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not present anywhere else. I can implement it on the CircuitSimulator
layer, so that JITed kernels would also benefit from it.
f04c511
to
5a6c996
Compare
CUDA Quantum Docs Bot: A preview of the documentation can be found here. |
5a6c996
to
130f5e9
Compare
CUDA Quantum Docs Bot: A preview of the documentation can be found here. |
130f5e9
to
70c802f
Compare
CUDA Quantum Docs Bot: A preview of the documentation can be found here. |
This commit achieves two goals: 1. Deduplicate the qudit tracking functionality, which is present in both the `ExecutionManager` and the `CircuitSimulator. The `ExecutionManager` does not need to keep track of qudit's allocation and deallocation, it just needs to forward requests. Indeed, it is the simulators' job to manage the qudits and the quantum state representation. Note: We should even consider moving qudit tracking from the `CircuitSimulator` base class to the subtypes since each simulator might want to handle memory differently. For example: eager deallocation of qudits might be desired when this deallocation can be done with a simple resize of the state vector. This deallocation would improve the performance of applying gates but requires specific information from the simulators themselves. 2. Completely moves the `Tracer` to the `CircuitSimulator`. Before this commit, the `Tracer` implementation was divided between the `ExecutionManager` and the `CircuitSimulator`. Note: This move required adding another level of indirection for qudit reset within the simulators. Before, this indirection was handled by the `ExecutionManager` alone. We probably had an unknown bug since the execution of JITed kernels bypass the `ExecutionManager`, and thus it is quite likely the execution of JITed kernels in the `tracer` execution context would have exploded in the presence of qudit resets.
70c802f
to
bd06fdb
Compare
CUDA Quantum Docs Bot: A preview of the documentation can be found here. |
Description
This commit achieves two goals:
ExecutionManager
and theCircuitSimulator
.The
ExecutionManager
does not need to keep track of qudit's allocation and deallocation, it just needs to forward requests. Indeed, it is the simulators' job to manage the qudits and the quantum state representation.Note: We should even consider moving qudit tracking from the
CircuitSimulator
base class to the subtypes since each simulator might want to handle memory differently. For example: eager deallocation of qudits might be desired when this deallocation can be done with a simple resize of the state vector. This deallocation would improve the performance of applying gates but requires specific information from the simulators themselves.Tracer
to theCircuitSimulator
. Before this commit, theTracer
implementation was divided between theExecutionManager
and theCircuitSimulator
.Note: This move required adding another level of indirection for qudit reset within the simulators. Before, this indirection was handled by the
ExecutionManager
alone. We probably had an unknown bug since the execution of JITed kernels bypass theExecutionManager
, and thus it is quite likely the execution of JITed kernels in thetracer
execution context would have exploded in the presence of qudit resets.