Skip to content

[NFC][SYCL] Refactor code around device_image_impl::KernelIDs #19516

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

Open
wants to merge 1 commit into
base: sycl
Choose a base branch
from

Conversation

aelovikov-intel
Copy link
Contributor

@aelovikov-intel aelovikov-intel commented Jul 18, 2025

  • Clarify the reason for std::shared_ptr (performance,
    see Improve get_kernel_bundle performance #5496)
  • Clarify that get_kernel_ids is preferred over get_kernel_ids_ptr and
    update some of the existing uses of the latter to use the former
  • Change get_kernel_ids to return iterator_range instead of the
    reference to the underlying container. That way we can also return an
    empty range when shared_ptr isn't initialized, which was possible
    before but many ctors led to believe that is guaranteed to never happen.
  • Change those ctors to keep empty shared_ptr instead of creating
    empty vectors

@@ -2691,7 +2691,7 @@ ProgramManager::createDependencyImage(const context &Ctx, devices_range Devs,
assert(DepState == getBinImageState(DepImage) &&
"State mismatch between main image and its dependency");
DeviceImageImplPtr DepImpl =
device_image_impl::create(DepImage, Ctx, Devs, DepState, DepKernelIDs,
device_image_impl::create(DepImage, Ctx, Devs, DepState, std::move(DepKernelIDs),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An alternative to part of this change would be to initialize DepKernelIDs if it's nullptr here and add an assert in device_image_impl::create to make sure that device_image_impl::KernelIDs is always non-null. @steffenlarsen, what approach would you like better?

@aelovikov-intel aelovikov-intel changed the title [NFC][SYCL] Clarify intent of device_image_impl::get_kernel_ids_ptr [NFC][SYCL] Refactor code around device_image_impl::KernelIDs Jul 18, 2025
* Clarify the reason for `std::shared_ptr` (performance)
* Clarify that `get_kernel_ids` is preferred over `get_kernel_ids_ptr` and
  update some of the existing uses of the latter to use the former
* Change `get_kernel_ids` to return `iterator_range` instead of the
  reference to the underlying container. That way we can also return an
  empty range when `shared_ptr` isn't initialized, which was possible
  before but many ctors led to believe that is guaranteed to never happen.
* Change those ctors to keep empty `shared_ptr` instead of creating
  empty `vector`s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant