-
Notifications
You must be signed in to change notification settings - Fork 787
[SYCL] Fix hang in ProgramManager class #2274
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
[SYCL] Fix hang in ProgramManager class #2274
Conversation
Signed-off-by: Alexander Flegontov <[email protected]>
Signed-off-by: Alexander Flegontov <[email protected]>
Signed-off-by: Alexander Flegontov <[email protected]>
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.
Minor comment: all other lock_guards in ProgramManager class lock mutexes of std::mutex
type instead of mutex_class
, suggest to change MNativeProgramsMutex
's type to std::mutex
for consistency.
Signed-off-by: Alexander Flegontov <[email protected]>
@kbobrovs, Could you please review this PR? |
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
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
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
Due to change in LLVM IR in commit dea16eb.
This patch fixes sporadic hangs caused by data race in NativePrograms variable of the ProgramManager class.
The current mutex lock from the program cache is not thread-safe.
When multiple threads use their own queues then they use different contexts and then they use their own program caches.
And since multiple threads can queue own command of kernel execution in parallel,
then each thread will lock its own program cache mutex but the access into NativePrograms variable remains with a race between the threads.
Signed-off-by: Alexander Flegontov [email protected]