-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[OpenMP][OMPT] Fix device identifier collision during callbacks #65595
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
Conversation
Fixes: llvm#65104 When a user assigns devices to target regions it may happen that different identifiers will map onto the same id within different plugins. This will lead to situations where callbacks will become much harder to read, as ambiguous identifiers are reported. We fix this by collecting the index-offset upon general RTL initialization. Which in turn, allows to calculate the unique, user-observable device id.
This might not be the optimal solution, but somehow we have to propagate the offset value during RTL init. |
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.
Only question about the comment. Functionality LGTM.
Won't approve as of now so others can have a look.
/// Offset which when added to a DeviceId will yield a unique, user-observable | ||
/// device identifier. |
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.
Should this be reworded in the sense that makes it clear that this is (mainly/only?) in scenarios with multiple different supported devices?
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.
Valid point, I'm not pushing that naming or description.
Could also be name the corresponding variable PluginDeviceStartIndex (or similar); "global" was my go-to as a globally / unique DeviceId we wanted to determine.
Or was your initial thought that a clarification in the comment would suffice?
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.
Valid point, I'm not pushing that naming or description.
Could also be name the corresponding variable PluginDeviceStartIndex (or similar); "global" was my go-to as a globally / unique DeviceId we wanted to determine. Or was your initial thought that a clarification in the comment would suffice?
I like PluginDeviceStartIndex because that partially corresponds to the variable name where it originates from (libomptarget rtl.cpp).
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.
Since we are in the GenericPluginTy
namespace, I'll drop the Plugin prefix and suggest: DeviceIdStartIndex
.
Also go with a more verbose description as JP suggested -- so it should be more clear when this is actually useful.
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.
Looks good.
…#65595) Fixes: llvm#65104 When a user assigns devices to target regions it may happen that different identifiers will map onto the same id within different plugins. This will lead to situations where callbacks will become much harder to read, as ambiguous identifiers are reported. We fix this by collecting the index-offset upon general RTL initialization. Which in turn, allows to calculate the unique, user-observable device id.
Fixes: #65104
When a user assigns devices to target regions it may happen that different identifiers will map onto the same id within different plugins. This will lead to situations where callbacks will become much harder to read, as ambiguous identifiers are reported.
We fix this by collecting the index-offset upon general RTL initialization. Which in turn, allows to calculate the unique, user-observable device id.