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

[XLA:MSA] Sync copy replacement #69730

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

copybara-service[bot]
Copy link

@copybara-service copybara-service bot commented Jun 13, 2024

[XLA:MSA] Sync copy replacement

This CL implements the sync copy replacement feature in MSA.

The feature is implemented by creating a closure of intervals for each buffer in sorted_buffer_intervals. Each closure has an entrance interval and all intervals of a closure are connected to the entrance interval through at least one sync copy instruction that we are trying to replace. The closure is then processed in a loop, and the allocation values for the closure are created. If all allocation values of the closure can be allocated successfully, and the sync copy instruction replacement correctness conditions are met, the sync copy will be replaced with an async copy instruction. If not, the sync copy instruction is kept as is, and will be ignored in replacement efforts of future closures. For a sync copy to be consider replaceable, beside not being in the ignored list because of the past failures, it must not change the layout between its input and output, it must not have a preassigned memory space for its operand or output, and its operand value must only show up in one position.

In order to replace a copy, we create segments from the AllocationValue to the uses of its copy uses that are considered for replacement.

This CL implements the sync copy replacement feature in MSA.

The feature is implemented by creating a closure of intervals for each buffer in sorted_buffer_intervals. Each closure has an entrance interval and all intervals of a closure are connected to the entrance interval through at least one sync copy instruction that we are trying to replace. The closure is then processed in a loop, and the allocation values for the closure are created. If all allocation values of the closure can be allocated successfully, and the sync copy instruction replacement correctness conditions are met, the sync copy will be replaced with an async copy instruction. If not, the sync copy instruction is kept as is, and will be ignored in replacement efforts of future closures. For a sync copy to be consider replaceable, beside not being in the ignored list because of the past failures, it must not change the layout between its input and output, it must not have a preassigned memory space for its operand or output, and its operand value must only show up in one position.

In order to replace a copy, we create segments from the AllocationValue to the uses of its copy uses that are considered for replacement.

PiperOrigin-RevId: 643097604
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.

None yet

1 participant