Skip to content
This repository has been archived by the owner on Dec 24, 2024. It is now read-only.

Freeing the commands and the command chain created during dispatch #29

Merged
merged 3 commits into from
Sep 21, 2024

Conversation

eddierichter-amd
Copy link
Collaborator

No description provided.

@makslevental
Copy link
Collaborator

I can't comment since it isn't a touched line but don't you need to free the cmds themselves too?

if (CreateCmd(cmd_size, &cmd_bo_handle, &cmd, fd))

also in this file is the ring_buf_ which is allocated but never freed (like in AqlQueue)

ring_buf_ = agent_.system_allocator()(queue_size_bytes_, 4096,

@eddierichter-amd
Copy link
Collaborator Author

I can't comment since it isn't a touched line but don't you need to free the cmds themselves too?

if (CreateCmd(cmd_size, &cmd_bo_handle, &cmd, fd))

also in this file is the ring_buf_ which is allocated but never freed (like in AqlQueue)

ring_buf_ = agent_.system_allocator()(queue_size_bytes_, 4096,

We go through all of the cmd_handles and free all of them here: https://github.com/nod-ai/ROCR-Runtime/pull/29/files#diff-d794c4f5b69c550f71f08837a96b68bb2dad1cd8750f1c41623a92d4dcef9a7eR444-R447. Are there some commands that we are missing? Good point on the queue will add that to this PR as well.

@makslevental
Copy link
Collaborator

sorry I should've been more specific - shouldn't the buffers themselves be munmaped? Like I did here in the other PR https://github.com/nod-ai/ROCR-Runtime/pull/28/files#diff-d794c4f5b69c550f71f08837a96b68bb2dad1cd8750f1c41623a92d4dcef9a7e

@eddierichter-amd
Copy link
Collaborator Author

sorry I should've been more specific - shouldn't the buffers themselves be munmaped? Like I did here in the other PR https://github.com/nod-ai/ROCR-Runtime/pull/28/files#diff-d794c4f5b69c550f71f08837a96b68bb2dad1cd8750f1c41623a92d4dcef9a7e

Wow you are good! Didn't realize you had a PR that had this :). Alright I am both unmapping and closing as that is consistent with how the XRT shim is dealing with cmds (unmapping: https://github.com/amd/xdna-driver/blob/867e2f9f5f21596ec642e9ca5321de7a0863c14d/src/shim/bo.cpp#L59-L62 and closing: https://github.com/amd/xdna-driver/blob/867e2f9f5f21596ec642e9ca5321de7a0863c14d/src/shim/bo.cpp#L23-L27) if we learn that this is redundant happy to remove closing or unmapping. Also added the queue ring buf deallocation via the system deallocator.

Copy link
Collaborator

@makslevental makslevental left a comment

Choose a reason for hiding this comment

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

LGTM - in my local testing of basically the same changes this made most (all?) of the kernel leaks go away.

@eddierichter-amd eddierichter-amd merged commit c046b70 into iree-aie Sep 21, 2024
3 checks passed
@eddierichter-amd eddierichter-amd deleted the cmd-chain-free branch September 21, 2024 19:41
eddierichter-amd added a commit that referenced this pull request Oct 22, 2024
* Freeing the commands and the command chain created during dispatch

* Unmaping and closing cmd BOs as well as freeing the queue ring buffer
eddierichter-amd added a commit that referenced this pull request Oct 22, 2024
* Freeing the commands and the command chain created during dispatch

* Unmaping and closing cmd BOs as well as freeing the queue ring buffer
eddierichter-amd added a commit that referenced this pull request Nov 19, 2024
* Freeing the commands and the command chain created during dispatch

* Unmaping and closing cmd BOs as well as freeing the queue ring buffer
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants