Skip to content
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

[SYCL][RTC] Hide user-facing RTC kernel ids #17356

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

Conversation

PietroGhg
Copy link
Contributor

The SYCL spec mandates that kernel IDs for kernels generated through RTC shouldn't be accessible from the user application. This PR makes it so we filter out the output of get_kernel_ids so that we behave according to the spec.
Removes tests that were relying on kernel_ids being accessible from the user application.

@PietroGhg PietroGhg requested a review from a team as a code owner March 7, 2025 15:37
@@ -775,6 +775,11 @@ class kernel_bundle_impl {
const std::vector<device> &get_devices() const noexcept { return MDevices; }

std::vector<kernel_id> get_kernel_ids() const {
// RTC kernel bundles shouldn't have user-facing kernel ids, return an
// empty vector when the bundles contains RTC kernels.
if (MLanguage == ext::oneapi::experimental::source_language::sycl_jit) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (MLanguage == ext::oneapi::experimental::source_language::sycl_jit) {
if (MLanguage == syclex::source_language::sycl_jit) {

// for '$' should be enough.
ids.erase(std::remove_if(ids.begin(), ids.end(),
[](kernel_id id) {
return strchr(id.get_name(), '$') != nullptr;
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: IMHO string_view::find would be a bit more idiomatic here.

@@ -76,15 +76,10 @@ int test_persistent_cache() {
// CHECK: [kernel_compiler Persistent Cache]: cache miss: [[KEY1:.*]]
// CHECK: [kernel_compiler Persistent Cache]: storing device code IR: {{.*}}/[[KEY1]]
exe_kb kbExe1a = syclex::build(kbSrc1);
dumpKernelIDs();
Copy link
Contributor

Choose a reason for hiding this comment

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

Also delete the function, please.

@@ -775,6 +775,11 @@ class kernel_bundle_impl {
const std::vector<device> &get_devices() const noexcept { return MDevices; }

std::vector<kernel_id> get_kernel_ids() const {
// RTC kernel bundles shouldn't have user-facing kernel ids, return an
// empty vector when the bundles contains RTC kernels.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// empty vector when the bundles contains RTC kernels.
// empty vector when the bundle was compiled from source.

if (!ok) {
return 0;
}
std::string build_log;
Copy link
Contributor

Choose a reason for hiding this comment

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

You can drop the build log to make the test even more compact.

@jopperm jopperm requested a review from cperkinsintel March 9, 2025 21:42
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.

2 participants