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

Fix a leak in pi_unified_runtime.cpp. #12589

Merged
merged 1 commit into from
Feb 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions sycl/plugins/unified_runtime/pi_unified_runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1349,6 +1349,7 @@ __SYCL_EXPORT pi_result piPluginInit(pi_plugin *PluginInit) {
}

HANDLE_ERRORS(urLoaderInit(0, LoaderConfig));
HANDLE_ERRORS(urLoaderConfigRelease(LoaderConfig));
Copy link
Contributor

@ldrumm ldrumm Feb 2, 2024

Choose a reason for hiding this comment

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

This is an improvement, but if urLoaderConfigEnableLayer or urLoaderInit fail I think we still leak. Do we need to fix this RAII-style instead?

Copy link
Contributor

Choose a reason for hiding this comment

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

I did recently add RAII wrappers to the UR CTS, there's deffo a case for making those first class citizens so they can be reused where needed.

Copy link
Contributor Author

@yingcong-wu yingcong-wu Feb 4, 2024

Choose a reason for hiding this comment

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

I will look into the RAII wrappers. Hi @kbenzie , do you have some links to some documents/commit that I can start with? Thanks.

Maybe I misunderstand your comment. Is there RAII wrapper for LoaderConfig type? Or do you mean you plan to add them later?

Copy link
Contributor Author

@yingcong-wu yingcong-wu Feb 7, 2024

Choose a reason for hiding this comment

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

Hi @kbenzie , did UR already provide such RAII wrappers or did you mean that you plan to add such wrappers to UR?

Copy link
Contributor

Choose a reason for hiding this comment

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

We do not currently provide public RAII wrappers, I've created oneapi-src/unified-runtime#1334 to address this.

I don't think this should block this PR.


uint32_t NumAdapters;
HANDLE_ERRORS(urAdapterGet(0, nullptr, &NumAdapters));
Expand Down
Loading