Skip to content

Mapping between runtime and aot intermediate outputs #11624

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

Merged
merged 1 commit into from
Jun 13, 2025

Conversation

Juntian777
Copy link
Contributor

Summary:
This PR introduces a function map_runtime_aot_intermediate_outputs that maps runtime intermediate outputs to AOT intermediate outputs by identifying overlapping(between aot and runtime) debug handles and combining them into a single key that could handle below various mapping scenarios.

  1. No Overlaps: There are no overlapping debug handles between AOT and runtime outputs.
  2. 1-to-1 Mapping: A straightforward mapping where one AOT debug handle corresponds directly to one runtime debug handle.
  3. 1-to-N Mapping: A single AOT debug handle maps to multiple runtime debug handles.
  4. N-to-1 Mapping: Multiple AOT debug handles map to a single runtime debug handle.
  5. N-to-N Mapping: More intricate scenarios where multiple AOT and runtime debug handles form a chain of overlaps

In all cases where multiple debug handles are involved (N-to-1, 1-to-N, or N-to-N), the function merges these into a single combined debug handle and retains only the last intermediate output for each mapping.

In order to handle all cases, the code first does some pre-processing to the input, then constructs a graph of nodes representing debug handles and outputs, identifies connected components using DFS, and creates mappings for overlapping components, merging debug handles and retaining the last output.

This function will be used later in the Inspector Numerical Comparator class to create the mapping.

Differential Revision: D76442807

@Juntian777 Juntian777 requested a review from Gasoonjia as a code owner June 12, 2025 22:43
Copy link

pytorch-bot bot commented Jun 12, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/11624

Note: Links to docs will display an error until the docs builds have been completed.

✅ You can merge normally! (2 Unrelated Failures)

As of commit efcd4d1 with merge base a6e104c (image):

BROKEN TRUNK - The following jobs failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 12, 2025
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D76442807

@Juntian777
Copy link
Contributor Author

@pytorchbot label "release notes: none"

@pytorch-bot pytorch-bot bot added the release notes: none Do not include this in the release notes label Jun 12, 2025
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D76442807

Juntian777 added a commit to Juntian777/executorch that referenced this pull request Jun 12, 2025
Summary:
Pull Request resolved: pytorch#11624

This PR introduces a function map_runtime_aot_intermediate_outputs that maps runtime intermediate outputs to AOT intermediate outputs by identifying overlapping(between aot and runtime) debug handles and combining them into a single key that could handle below various mapping scenarios.

1. No Overlaps: There are no overlapping debug handles between AOT and runtime outputs.
2. 1-to-1 Mapping: A straightforward mapping where one AOT debug handle corresponds directly to one runtime debug handle.
3. 1-to-N Mapping: A single AOT debug handle maps to multiple runtime debug handles.
4. N-to-1 Mapping: Multiple AOT debug handles map to a single runtime debug handle.
5. N-to-N Mapping: More intricate scenarios where multiple AOT and runtime debug handles form a chain of overlaps

In all cases where multiple debug handles are involved (N-to-1, 1-to-N, or N-to-N), the function merges these into a single combined debug handle and retains only the last intermediate output for each mapping.

In order to handle all cases, the code first does some pre-processing to the input, then constructs a graph of nodes representing debug handles and outputs, identifies connected components using DFS, and creates mappings for overlapping components, merging debug handles and retaining the last output.

This function will be used later in the Inspector Numerical Comparator class to create the mapping.

Differential Revision: D76442807
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D76442807

Juntian777 added a commit to Juntian777/executorch that referenced this pull request Jun 12, 2025
Summary:
Pull Request resolved: pytorch#11624

This PR introduces a function map_runtime_aot_intermediate_outputs that maps runtime intermediate outputs to AOT intermediate outputs by identifying overlapping(between aot and runtime) debug handles and combining them into a single key that could handle below various mapping scenarios.

1. No Overlaps: There are no overlapping debug handles between AOT and runtime outputs.
2. 1-to-1 Mapping: A straightforward mapping where one AOT debug handle corresponds directly to one runtime debug handle.
3. 1-to-N Mapping: A single AOT debug handle maps to multiple runtime debug handles.
4. N-to-1 Mapping: Multiple AOT debug handles map to a single runtime debug handle.
5. N-to-N Mapping: More intricate scenarios where multiple AOT and runtime debug handles form a chain of overlaps

In all cases where multiple debug handles are involved (N-to-1, 1-to-N, or N-to-N), the function merges these into a single combined debug handle and retains only the last intermediate output for each mapping.

In order to handle all cases, the code first does some pre-processing to the input, then constructs a graph of nodes representing debug handles and outputs, identifies connected components using DFS, and creates mappings for overlapping components, merging debug handles and retaining the last output.

This function will be used later in the Inspector Numerical Comparator class to create the mapping.

Differential Revision: D76442807
Copy link
Contributor

@Gasoonjia Gasoonjia left a comment

Choose a reason for hiding this comment

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

LGTM

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D76442807

Juntian777 added a commit to Juntian777/executorch that referenced this pull request Jun 12, 2025
Summary:
Pull Request resolved: pytorch#11624

This PR introduces a function map_runtime_aot_intermediate_outputs that maps runtime intermediate outputs to AOT intermediate outputs by identifying overlapping(between aot and runtime) debug handles and combining them into a single key that could handle below various mapping scenarios.

1. No Overlaps: There are no overlapping debug handles between AOT and runtime outputs.
2. 1-to-1 Mapping: A straightforward mapping where one AOT debug handle corresponds directly to one runtime debug handle.
3. 1-to-N Mapping: A single AOT debug handle maps to multiple runtime debug handles.
4. N-to-1 Mapping: Multiple AOT debug handles map to a single runtime debug handle.
5. N-to-N Mapping: More intricate scenarios where multiple AOT and runtime debug handles form a chain of overlaps

In all cases where multiple debug handles are involved (N-to-1, 1-to-N, or N-to-N), the function merges these into a single combined debug handle and retains only the last intermediate output for each mapping.

In order to handle all cases, the code first does some pre-processing to the input, then constructs a graph of nodes representing debug handles and outputs, identifies connected components using DFS, and creates mappings for overlapping components, merging debug handles and retaining the last output.

This function will be used later in the Inspector Numerical Comparator class to create the mapping.

Reviewed By: Gasoonjia

Differential Revision: D76442807
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D76442807

Juntian777 added a commit to Juntian777/executorch that referenced this pull request Jun 12, 2025
Summary:
Pull Request resolved: pytorch#11624

This PR introduces a function map_runtime_aot_intermediate_outputs that maps runtime intermediate outputs to AOT intermediate outputs by identifying overlapping(between aot and runtime) debug handles and combining them into a single key that could handle below various mapping scenarios.

1. No Overlaps: There are no overlapping debug handles between AOT and runtime outputs.
2. 1-to-1 Mapping: A straightforward mapping where one AOT debug handle corresponds directly to one runtime debug handle.
3. 1-to-N Mapping: A single AOT debug handle maps to multiple runtime debug handles.
4. N-to-1 Mapping: Multiple AOT debug handles map to a single runtime debug handle.
5. N-to-N Mapping: More intricate scenarios where multiple AOT and runtime debug handles form a chain of overlaps

In all cases where multiple debug handles are involved (N-to-1, 1-to-N, or N-to-N), the function merges these into a single combined debug handle and retains only the last intermediate output for each mapping.

In order to handle all cases, the code first does some pre-processing to the input, then constructs a graph of nodes representing debug handles and outputs, identifies connected components using DFS, and creates mappings for overlapping components, merging debug handles and retaining the last output.

This function will be used later in the Inspector Numerical Comparator class to create the mapping.

Reviewed By: Gasoonjia

Differential Revision: D76442807
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D76442807

Juntian777 added a commit to Juntian777/executorch that referenced this pull request Jun 13, 2025
Summary:
Pull Request resolved: pytorch#11624

This PR introduces a function map_runtime_aot_intermediate_outputs that maps runtime intermediate outputs to AOT intermediate outputs by identifying overlapping(between aot and runtime) debug handles and combining them into a single key that could handle below various mapping scenarios.

1. No Overlaps: There are no overlapping debug handles between AOT and runtime outputs.
2. 1-to-1 Mapping: A straightforward mapping where one AOT debug handle corresponds directly to one runtime debug handle.
3. 1-to-N Mapping: A single AOT debug handle maps to multiple runtime debug handles.
4. N-to-1 Mapping: Multiple AOT debug handles map to a single runtime debug handle.
5. N-to-N Mapping: More intricate scenarios where multiple AOT and runtime debug handles form a chain of overlaps

In all cases where multiple debug handles are involved (N-to-1, 1-to-N, or N-to-N), the function merges these into a single combined debug handle and retains only the last intermediate output for each mapping.

In order to handle all cases, the code first does some pre-processing to the input, then constructs a graph of nodes representing debug handles and outputs, identifies connected components using DFS, and creates mappings for overlapping components, merging debug handles and retaining the last output.

This function will be used later in the Inspector Numerical Comparator class to create the mapping.

Reviewed By: Gasoonjia

Differential Revision: D76442807
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D76442807

Juntian777 added a commit to Juntian777/executorch that referenced this pull request Jun 13, 2025
Summary:
Pull Request resolved: pytorch#11624

This PR introduces a function map_runtime_aot_intermediate_outputs that maps runtime intermediate outputs to AOT intermediate outputs by identifying overlapping(between aot and runtime) debug handles and combining them into a single key that could handle below various mapping scenarios.

1. No Overlaps: There are no overlapping debug handles between AOT and runtime outputs.
2. 1-to-1 Mapping: A straightforward mapping where one AOT debug handle corresponds directly to one runtime debug handle.
3. 1-to-N Mapping: A single AOT debug handle maps to multiple runtime debug handles.
4. N-to-1 Mapping: Multiple AOT debug handles map to a single runtime debug handle.
5. N-to-N Mapping: More intricate scenarios where multiple AOT and runtime debug handles form a chain of overlaps

In all cases where multiple debug handles are involved (N-to-1, 1-to-N, or N-to-N), the function merges these into a single combined debug handle and retains only the last intermediate output for each mapping.

In order to handle all cases, the code first does some pre-processing to the input, then constructs a graph of nodes representing debug handles and outputs, identifies connected components using DFS, and creates mappings for overlapping components, merging debug handles and retaining the last output.

This function will be used later in the Inspector Numerical Comparator class to create the mapping.

Reviewed By: Gasoonjia

Differential Revision: D76442807
Summary:
Pull Request resolved: pytorch#11624

This PR introduces a function map_runtime_aot_intermediate_outputs that maps runtime intermediate outputs to AOT intermediate outputs by identifying overlapping(between aot and runtime) debug handles and combining them into a single key that could handle below various mapping scenarios.

1. No Overlaps: There are no overlapping debug handles between AOT and runtime outputs.
2. 1-to-1 Mapping: A straightforward mapping where one AOT debug handle corresponds directly to one runtime debug handle.
3. 1-to-N Mapping: A single AOT debug handle maps to multiple runtime debug handles.
4. N-to-1 Mapping: Multiple AOT debug handles map to a single runtime debug handle.
5. N-to-N Mapping: More intricate scenarios where multiple AOT and runtime debug handles form a chain of overlaps

In all cases where multiple debug handles are involved (N-to-1, 1-to-N, or N-to-N), the function merges these into a single combined debug handle and retains only the last intermediate output for each mapping.

In order to handle all cases, the code first does some pre-processing to the input, then constructs a graph of nodes representing debug handles and outputs, identifies connected components using DFS, and creates mappings for overlapping components, merging debug handles and retaining the last output.

This function will be used later in the Inspector Numerical Comparator class to create the mapping.

Reviewed By: Gasoonjia

Differential Revision: D76442807
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D76442807

@facebook-github-bot facebook-github-bot merged commit cf81301 into pytorch:main Jun 13, 2025
166 of 171 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported release notes: none Do not include this in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants