-
Notifications
You must be signed in to change notification settings - Fork 124
Refactor L0 command-buffer cleanup. #1840
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
Refactor L0 command-buffer cleanup. #1840
Conversation
dec3f85 to
b621c75
Compare
|
E2E L0 failed, but it doesn't seem related: |
pbalcer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, but this is quite a lot of changes to handle a fairly trivial problem.
@igchor it may make sense to create a nothrow variant of the getQueue method that returns something like an std::optional if succesful. Thoughts?
647aa83 to
ce20a98
Compare
Sorry, I missed the notification. I think it would be best to just move all the logic from the destructor to a function like you did but not using If an exception from GetQueue is thrown, (.e.g from |
|
As for a nothrow variant of GetQueue - you would still need to handle nullopt and propagate the error somehow, I'm not sure if it would be easier. |
Coverity has reported that there is the possibility of the command-buffer destructor throwing an exception from its calls to `CleanupCompletedEvent`. This is from an underlying `throw` in [GetQueue](https://github.com/oneapi-src/unified-runtime/blob/main/source/adapters/level_zero/queue.hpp#L890) when a `dynamic_cast` doesn't behave as expected. I initially tried changing this to an assert but the V2 Level Zero adapter is triggering this case while in it's developmental state, so an assert brings down the whole test suite rather than just being reported as a fail (the UR loader catches exceptions and returns them as error codes). Therefore this PR addresses the issue by moving the calls to `CleanupCompletedEvent()` outside of the command-buffer destructor. This allows us us to report an error from command-buffer release by doing cleanup prior to calling the destructor, without the risk of throwing an exception.
ce20a98 to
a3d84be
Compare
|
Thanks for your reply @igchor, I've updated the PR with your suggestion. It is indeed only the possibility of an exception being thrown in a C++ object destructor that Coverity has detected. Avoiding leaks and returning a reliable error when things go wrong when freeing resources is over an above that, so can be considered out of scope for the purposes of this PR. |
Updates L0 adapter to UR PR oneapi-src/unified-runtime#1840
Coverity has reported that there is the possibility of the command-buffer destructor throwing an exception from its calls
to
CleanupCompletedEvent.This is from an underlying
throwin GetQueue when adynamic_castdoesn't behave as expected. I initially triedchanging this to an assert but the V2 Level Zero adapter is triggering this case while in it's developmental state, so an assert brings down the whole test suite rather than just being reported as a fail (the UR loader catches exceptions and returns them as error codes).
Therefore this PR addresses the Coverity report by moving the calls to
CleanupCompletedEvent()outside of the command-buffer destructor. This allows us to cleanup prior to calling the destructor, without the risk of throwing an exception.DPC++ PR intel/llvm#14503