Skip to content

Conversation

@sergey-semenov
Copy link
Contributor

@sergey-semenov sergey-semenov commented Oct 8, 2025

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.

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).
Comment on lines +244 to +246
return MOwnsDeviceKernelInfo
? MDeviceKernelInfo
: ProgramManager::getInstance().getDeviceKernelInfo(
Copy link
Contributor

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?

Copy link
Contributor Author

@sergey-semenov sergey-semenov Oct 20, 2025

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.

@sergey-semenov
Copy link
Contributor Author

Timed Out Tests (1):
  SYCL :: HostInteropTask/host-task-failure.cpp

is known and unrelated.

@sergey-semenov
Copy link
Contributor Author

@intel/sycl-graphs-reviewers (@mmichel11), @intel/llvm-reviewers-runtime (@cperkinsintel) Could you please have a look?

Copy link
Contributor

@mmichel11 mmichel11 left a 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

@sergey-semenov
Copy link
Contributor Author

@cperkinsintel gentle ping

Comment on lines +1743 to +1745
CompileTimeKernelInfoTy DefaultCompileTimeInfo{std::string_view(name)};
m_DeviceKernelInfoMap.try_emplace(std::string_view(name),
DefaultCompileTimeInfo);
Copy link
Contributor

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?

Copy link
Contributor Author

@sergey-semenov sergey-semenov Dec 15, 2025

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
Copy link
Contributor

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?

Copy link
Contributor Author

@sergey-semenov sergey-semenov Dec 15, 2025

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.

Copy link
Contributor

@uditagarwal97 uditagarwal97 left a comment

Choose a reason for hiding this comment

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

LGTM overall

@github-actions
Copy link
Contributor

@intel/llvm-gatekeepers please consider merging

@sergey-semenov sergey-semenov merged commit 29dfd03 into intel:sycl Dec 15, 2025
11 of 12 checks passed
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.

4 participants