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

Add pass to process input and output alias hint info #1273

Merged
merged 1 commit into from
Jan 10, 2024

Conversation

eedalong
Copy link
Collaborator

@eedalong eedalong commented Dec 25, 2023

In this pr, we provide a mechanism to do memory buffer reuse optimization between module inputs and outputs. Frontend of DISC needs to provide information as module attribute in the form of input_output_alias_params and input_output_alias_outputs. For example, if you want to reuse the 3rd output tensor and 14th input tensor, 4th output tensor and 2nd input tensor of main module function, you need to provide these two attributes like:

  input_output_alias_params="14,2"
  input_output_alias_outputs="3,4"

DISC will parse this information and try to do buffer reuse.

It should be noted that DISC's handling of input_output_alias information adopts a try-best strategy, which means that it does not guarantee the successful execution of all input-output aliases, but this does not affect the correctness of end-to-end execution. And this pr has no side-effect for other passes.

@eedalong eedalong force-pushed the support_input_output_alias branch 7 times, most recently from c1f44bb to df62261 Compare December 28, 2023 03:46
@eedalong eedalong changed the title [WIP] Add pass to process input and output alias info Add pass to process input and output alias info Dec 28, 2023
@eedalong eedalong force-pushed the support_input_output_alias branch 4 times, most recently from 1a7294b to d967f6d Compare December 28, 2023 07:58
@eedalong eedalong self-assigned this Dec 28, 2023
@eedalong eedalong force-pushed the support_input_output_alias branch 5 times, most recently from 2bb882f to ba0e392 Compare January 4, 2024 07:02
":pass_details",
":placement_utils",
":rng_uniform_custom_call",
":topk_custom_call",
Copy link
Collaborator

Choose a reason for hiding this comment

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

please polish the dependencies, this target do not need qconv_custom_call at least.

Copy link
Collaborator Author

@eedalong eedalong Jan 5, 2024

Choose a reason for hiding this comment

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

Fixed.

@eedalong eedalong force-pushed the support_input_output_alias branch 2 times, most recently from 0ca06f4 to 7560544 Compare January 9, 2024 03:28
@eedalong eedalong changed the title Add pass to process input and output alias info Add pass to process input and output alias hint info Jan 9, 2024
@eedalong eedalong force-pushed the support_input_output_alias branch 5 times, most recently from d95d788 to c534ad5 Compare January 10, 2024 06:35
Copy link
Collaborator

@Yancey1989 Yancey1989 left a comment

Choose a reason for hiding this comment

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

LGTM

@eedalong eedalong merged commit ddcc491 into alibaba:main Jan 10, 2024
11 checks passed
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