Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

boschmitt
Copy link
Collaborator

@boschmitt boschmitt commented Apr 18, 2024

Description

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.

  1. 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.

@boschmitt boschmitt force-pushed the remove_qudit_management_from_execution_manager branch 3 times, most recently from 0c9bd69 to bb1acf2 Compare April 18, 2024 18:26
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 Apr 18, 2024
@boschmitt boschmitt force-pushed the remove_qudit_management_from_execution_manager branch from bb1acf2 to f04c511 Compare April 18, 2024 22:46
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 Apr 18, 2024
requestedAllocations.emplace_back(2, q.id);
}

void allocateQudits(const std::vector<cudaq::QuditInfo> &qudits) override {
Copy link
Collaborator

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

Copy link
Collaborator Author

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.

@boschmitt boschmitt force-pushed the remove_qudit_management_from_execution_manager branch from f04c511 to 5a6c996 Compare April 19, 2024 15:48
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 Apr 19, 2024
@boschmitt boschmitt force-pushed the remove_qudit_management_from_execution_manager branch from 5a6c996 to 130f5e9 Compare May 31, 2024 15:54
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 May 31, 2024
@boschmitt boschmitt force-pushed the remove_qudit_management_from_execution_manager branch from 130f5e9 to 70c802f Compare May 31, 2024 17:35
github-actions bot pushed a commit that referenced this pull request May 31, 2024
Copy link

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.
@boschmitt boschmitt force-pushed the remove_qudit_management_from_execution_manager branch from 70c802f to bd06fdb Compare June 3, 2024 13:13
github-actions bot pushed a commit that referenced this pull request Jun 3, 2024
Copy link

github-actions bot commented Jun 3, 2024

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

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.

2 participants