-
Notifications
You must be signed in to change notification settings - Fork 770
[SYCL] Move kernel_compiler related information #17380
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
This commit moves the kernel compiler related information from the kernel bundles to the device images. This separation allows the implementation to properly joining and (in the near future) linking of kernel bundles created from different paths. Signed-off-by: Larsen, Steffen <[email protected]>
Tag @jopperm @sommerlukas @cperkinsintel @0x12CC - I still need to fix the last couple of regressions and write some tests for |
Signed-off-by: Larsen, Steffen <[email protected]>
Signed-off-by: Larsen, Steffen <[email protected]>
Signed-off-by: Larsen, Steffen <[email protected]>
Signed-off-by: Larsen, Steffen <[email protected]>
Signed-off-by: Larsen, Steffen <[email protected]>
Signed-off-by: Larsen, Steffen <[email protected]>
Signed-off-by: Larsen, Steffen <[email protected]>
Signed-off-by: Larsen, Steffen <[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.
Besides moving things around and changing interfaces, there are quite a few new functions and methods introduced. Some for kernel_bundle_impl, some for device_image_impl. Are all of these exercised by the tests?
Since the primary changes in this patch is moving kernel compiler related logic from kernel bundle into the device images, the vast majority of this is fairly well covered by existing kernel compiler testing. The main complex new functionality is probably merging of RTC information, which the new test should at least cover at a basic level. I expect the testing we'll be doing for linking in the upcoming patch should improve that coverage significantly however. |
I will see if we can make the linking logic resolve these cases, but I am not convinced it will happen in the first iteration. Eventually I would like to drop the "images with dependencies" abstraction in favor of simply populating the bundles with the dependencies as images in the bundle. |
This commit moves the kernel compiler related information from the kernel bundles to the device images. This separation allows the implementation to properly join and (in the near future) link kernel bundles created from different paths. --------- Signed-off-by: Larsen, Steffen <[email protected]>
} | ||
} | ||
|
||
std::shared_ptr<context_impl> MContextImpl; |
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.
Do we need ownership on Context? I think std::shared_ptr
is required when you need to control the lifetime of the object. Otherwise, a raw pointer or reference to the object should be enough.
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.
Having a reference to the context be a shared pointer was indeed intentional here, though you could argue it is being overly careful. To properly unregister the device globals, the implementation needs the context to be alive, which would currently be guaranteed by the device_image_impl
, which owns the KernelCompilerBinaryInfo
object that in turn owns this object. However, we have no guarantees that the KernelCompilerBinaryInfo
or the shared_ptr
to this object could be copied somewhere else or even that the context member in device_image_impl
gets moved to after the KernelCompilerBinaryInfo
object (order of destruction could release context before KernelCompilerBinaryInfo
.)
In summary, we could use a raw pointer, but we risk some very hard-to-find bugs for unobvious changes.
You could argue that we wouldn't necessarily have to release the resources in the context explicitly, so what we could do is use a weak_ptr
here instead, then skip the resource release and let the context dtor take care of it. Note though that we would still create a shared_ptr
to the context during the dtor of this object when we lock the weak pointer, so at that point we've not saved the reference counting.
Changes in intel#17380 introduced some Coverity detected issues. This commit fixes the following issues: 1. Removes noexcept from get_bin_image_ref as it can now potentially throw through std::variant interfaces. 2. Adheres to rule-of-three in ManagedDeviceGlobalsRegistry and ManagedDeviceBinaries. Signed-off-by: Larsen, Steffen <[email protected]>
Changes in #17380 introduced some Coverity detected issues. This commit fixes the following issues: 1. Removes noexcept from get_bin_image_ref as it can now potentially throw through std::variant interfaces. 2. Adheres to rule-of-three in ManagedDeviceGlobalsRegistry and ManagedDeviceBinaries. Signed-off-by: Larsen, Steffen <[email protected]>
After the changes in intel#17380, kernels looked up from a kernel bundle could cause lifetime issues, as the lifetime of the returned objects had to be handled differently based on the path taken. These changes move back to only look up non-source-based kernels and use the stored kernel objects otherwise. Signed-off-by: Larsen, Steffen <[email protected]>
The current implementation of SYCL kernel launches prioritizes looking up kernels through the kernel bundles rather than using the set kernel. These changes instead prioritizes using the kernel, which not only saves the look-up overhead and fixes a kernel implementation lifetime issue caused by intel#17380. Signed-off-by: Larsen, Steffen <[email protected]>
The current implementation of SYCL kernel launches prioritizes looking up kernels through the kernel bundles rather than using the set kernel. These changes instead prioritizes using the kernel, which not only saves the look-up overhead and fixes a kernel implementation lifetime issue caused by intel#17380. Signed-off-by: Larsen, Steffen <[email protected]>
The current implementation of SYCL kernel launches prioritizes looking up kernels through the kernel bundles rather than using the set kernel. These changes instead prioritizes using the kernel, which not only saves the look-up overhead and fixes a kernel implementation lifetime issue caused by #17380. Signed-off-by: Larsen, Steffen <[email protected]>
This commit moves the kernel compiler related information from the kernel bundles to the device images. This separation allows the implementation to properly join and (in the near future) link kernel bundles created from different paths.