Skip to content

[KHR] sycl_khr_kernel_properties - #1078

Open
koparasy wants to merge 7 commits into
KhronosGroup:mainfrom
koparasy:me/khr-kernel-properties
Open

koparasy wants to merge 7 commits into
KhronosGroup:mainfrom
koparasy:me/khr-kernel-properties

Conversation

@koparasy

@koparasy koparasy commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@koparasy

koparasy commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

Some first thoughts on this. Depends on #980 . I will undraft this when I consider most of the components make sense.

@gmlueck

gmlueck commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

This looks good! I like the way the khr::property::tag::kernel type is used for both the tag to the get function and also as the classification tag in khr::is_property_for.

@koparasy

koparasy commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

This looks good! I like the way the khr::property::tag::kernel type is used for both the tag to the get function and also as the classification tag in khr::is_property_for.

Thnx! I will undraft once the properties lands, and I implement it in dpcpp. I would like to mentally digest this.

{endnote}

[[sec:khr-kernel-properties-properties]]
== Kernel properties

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This does not cover all attributes available in SYCL specification:

  • device_has() is missing
  • vec_type_hint is missing

Should not KHR be consistent with the spec?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

vec_type_hint is deprecated in the core spec, so I don't think we should provide an equivalent kernel property. In general, the WG doesn't add improvements for APIs that are already deprecated.

@koparasy asked me offline about device_has before he drafted this. I suggested that we omit it from the KHR. My reasoning was that this attribute seems not to be used. (At least I am not aware of anyone who uses it.) It's also more complicated than the others because it can also be applied to individual device functions (i.e. functions called within the call tree of a kernel). The mechanism proposed in this KHR with the get member function can not replace that usage pattern. Therefore, it seemed like it didn't make a lot of sense to spend a lot of WG discussion time on creating a property-based alternative to device_has because it would be high effort and low ROI. We can always add it later in a "version 2" if it becomes more important.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

vec_type_hint is deprecated in the core spec, so I don't think we should provide an equivalent kernel property.

I've missed the deprecation note. Thank you for pointing out. I agree that in such a case we don't need to add it to this KHR.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

My reasoning was that this attribute seems not to be used. (At least I am not aware of anyone who uses it.)

With the open source solution you can't be sure who uses or who does not use the feature. This one seems quite reasonable to have at least to me as it constrain the kernel to specific features and makes that explicit to the compiler which is always a good thing.

device_has <...>. I suggested that we omit it from the KHR. <...> We can always add it later in a "version 2" if it becomes more important.

I think it's fine to not implement this one in the first version of the KHR. However, since device_has is a valid SYCL kernel attribute, I believe that we must be reasonably sure that we will be able to extend KHR in the future to cover this attribute as well. If this won't be technically possible, then I afraid we have an issue which needs to be resolved before landing the KHR as resolving it might impact how KHR is designed. Are we sure we will be able to implement it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

IMO device_has should not be in this version. The design does not preclude it. A kernel-level device_has<aspect...> property would follow the same pattern as the three properties here, and device functions can continue to use the core attribute.

That said, I share Greg's view. device_has can be applied on device functions AND kernels, which make it more complex in terms of implementation and specification.

@koparasy
koparasy marked this pull request as ready for review November 10, 2026 17:39
@koparasy
koparasy requested a review from gmlueck November 10, 2026 17:49
@koparasy

Copy link
Copy Markdown
Contributor Author

@TApplencourt @VerenaBeckham @gmlueck I would love to get some feedback on this one. We briefly discussed this during the F2F. The KHR itself is very small and if you read the example, you should get the gist of it.

koparasy and others added 2 commits November 12, 2026 13:05
@TApplencourt

Copy link
Copy Markdown
Contributor
  • December 10 deadline for review (if people want to have deadline)
  • We would like to accept it during the Decembre 3 workging group call (next one)
    • Need a CTS
    • Need 2 Approval, need 2 implementer

(- Requirement of Property -- First use of the compile time aspect of the new propertes)

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