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

Handle compute packets that are split between the ends of two command buffers #2476

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

kalaposfos13
Copy link
Contributor

@kalaposfos13 kalaposfos13 commented Feb 18, 2025

For some reason P.T. submits compute command buffers that are not aligned at instruction ends, so some instructions end up having data in two buffers. This PR fixes the issue, by doing the following:

  • If an instruction is longer than the remaining buffer size, we copy the incomplete part out to a buffer
  • When the next instrucion buffer arrives, we check if there were any "leftovers" from the previous one, and if so, do the following:
  • Check that if we took the appropriate amount of commands from the start of the buffer, the next data is a valid instruction
  • If so, we finish setting up the command by copying the remaining data to the end of the previous one, then execute this command
  • We then finish handling this new buffer, starting from the appropriate offset.

If any of these fail, we proceed to handle the new buffer as normal.

@kalaposfos13 kalaposfos13 force-pushed the bridge-split-cmd-buffers branch 2 times, most recently from 5299816 to 28162db Compare February 18, 2025 17:22
@raphaelthegreat
Copy link
Collaborator

I dont really like this approach too much, it feels very hacky

@kalaposfos13
Copy link
Contributor Author

Any ideas as to how else could it be done? I agree that it's a bit too hacky, that's why I initially didn't release it

@raphaelthegreat
Copy link
Collaborator

It depends on the details of the problem. So first submit ends at the middle of a PM4 packet and next one starts right after the previous? Is there some padding in-between? If you could give a real example with addresses would be helpful

@kalaposfos13 kalaposfos13 force-pushed the bridge-split-cmd-buffers branch from ea23163 to bc34d5c Compare February 19, 2025 08:33
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