-
Notifications
You must be signed in to change notification settings - Fork 801
[SYCL] Get rid of device kernel info duplication #20319
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
47f5f86 to
d70616d
Compare
d70616d to
b85a646
Compare
With the introduction of DeviceKernelInfo, assert usage and implicit local argument information is now duplicated in program manager. This patch removes the duplicate maps and makes it so that device kernel info map is filled out during image registration, with the compile time information added when it's available (during the first submission of the kernel).
b85a646 to
3f0ce59
Compare
| return MOwnsDeviceKernelInfo | ||
| ? MDeviceKernelInfo | ||
| : ProgramManager::getInstance().getDeviceKernelInfo( |
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.
Can we just have a reference/pointer as the member (potentially pointing to the owning smart pointer member) instead of doing those lookups?
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.
Yes, we should. I was planning that as a follow-up change since the lookup is already there right now.
is known and unrelated. |
|
@intel/sycl-graphs-reviewers (@mmichel11), @intel/llvm-reviewers-runtime (@cperkinsintel) Could you please have a look? |
mmichel11
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.
Changes to CommandGraph tests LGTM
|
@cperkinsintel gentle ping |
| CompileTimeKernelInfoTy DefaultCompileTimeInfo{std::string_view(name)}; | ||
| m_DeviceKernelInfoMap.try_emplace(std::string_view(name), | ||
| DefaultCompileTimeInfo); |
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.
IIUC, name is a local variable and we are using its string_view as key to m_DeviceKernelInfoMap. Could this lead to dangling pointers in the map when local variable goes out of scope?
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.
name is a const char* taken from the device image here, so there won't be any problems unless the entry outlives the module that contains that image.
Now, there is a more general issue here if we, say, add images A and B coming from different libraries and containing the same kernel name, and then drop just the image we took the string_view from. But that's not introduced by this PR and I'm planning to address that soon.
| bool kernel_impl::checkOwnsDeviceKernelInfo() { | ||
| // If the image originates from something other than standard offline | ||
| // compilation, this kernel needs to own its info structure. | ||
| // We could also have a mixed origin image, in which case the device kernel |
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.
Sorry, could you please elaborate on how can we have a mixed origin image?
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.
For example, if 2 images with different origins are explicitly linked, or an image has a dependency on a devicelib image.
uditagarwal97
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 overall
|
@intel/llvm-gatekeepers please consider merging |
With the introduction of DeviceKernelInfo, implicit local argument information is now duplicated in program manager. This patch removes the duplicate map and makes it so that device kernel info map is filled out during image registration, with the compile time information added when it's available (during the first submission of the kernel).
Additinally, this patch ensures that device kernel info instances are added to the program manager only during image registration, and gets rid of entries from other sources that polluted the map.