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

Conversation

yingcong-wu
Copy link
Contributor

LoaderConfig is created and stored in a local pointer and never released when done using, causing it to be leaked.
This patch releases the LoaderConfig when finished using it.

@yingcong-wu yingcong-wu requested a review from a team as a code owner February 2, 2024 01:44
@@ -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.

@KseniyaTikhomirova
Copy link
Contributor

KseniyaTikhomirova commented Feb 14, 2024

@ldrumm could you please review the answers & approve if no objections? Would be great to get this fix merged since it causes failures of 9 SYCL tests.

@yingcong-wu
Copy link
Contributor Author

Hi @kbenzie, if the RAII wrapper does not block this PR, could you please help land this patch? Thank you.

@kbenzie
Copy link
Contributor

kbenzie commented Feb 19, 2024

@intel/llvm-gatekeepers please merge

@steffenlarsen steffenlarsen merged commit d697024 into intel:sycl Feb 19, 2024
11 checks passed
@yingcong-wu yingcong-wu deleted the yc/0202-fix-a-leak branch June 20, 2024 03:03
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.

5 participants