Skip to content

Conversation

elizabethandrews
Copy link
Contributor

This patch implements 2 new attributes [[sycl::device_has()]]
and [[sycl_detail::uses_aspects()]]. Both attributes
accept 0 or more device aspects (cl::sycl::aspect) as arguments.

[[sycl::device_has()]] can be applied only to functions. If a
function is decorated with this attribute, !intel_declared_aspects
metadata, listing the aspects specified in attribute argument, is
added to the function metadata.

[[sycl_detail::uses_aspects()]] is an undocumented internal
attribute which can be applied to records (type declarations) and
function. If a function is decorated with this attribute,
!intel_used_aspects metadata, listing the aspects specified in
attribute argument, is added to the function metadata. If a record
is decorated with this attribute, a named metadata node
!intel_types_that_use_aspects is generated. The value of the this
metadata is a list of unnamed metadata nodes, each of which
describes one type that is decorated with this attribute. The value
of each unnamed metadata node starts with a string giving the name
of the type which is followed by a list of i32 constants, where each
constant is a value from cl::sycl::aspect enum class, telling the
numerical value of an aspect from the type's
[[sycl_detail::uses_aspects()]] attribute.

E.g.
!intel_types_that_use_aspects = !{!0, !1, !2}
!0 = !{!"class.cl::sycl::detail::half_impl::half", i32 8}
!1 = !{!"class.cl::sycl::amx_type", i32 9}
!2 = !{!"class.cl::sycl::other_type", i32 8, i32 9}

In the example above, the type cl::sycl::detail::half_impl::half uses
an aspect whose numerical value is 8 and the type cl::sycl::other_type
uses two aspects 8 and 9.

Spec:
github.com/intel/llvm/blob/sycl/sycl/doc/OptionalDeviceFeatures.md

Signed-off-by: Elizabeth Andrews elizabeth.andrews@intel.com

This patch implements 2 new attributes [[sycl::device_has()]]
and [[__sycl_detail__::__uses_aspects__()]]. Both attributes
accept 0 or more device aspects (cl::sycl::aspect) as arguments.

[[sycl::device_has()]] can be applied only to functions. If a
function is decorated with this attribute, !intel_declared_aspects
metadata, listing the aspects specified in attribute argument, is
added to the function metadata.

[[__sycl_detail__::__uses_aspects__()]] is an undocumented internal
attribute which can be applied to records (type declarations) and
function. If a function is decorated with this attribute,
!intel_used_aspects metadata, listing the aspects specified in
attribute argument, is added to the function metadata. If a record
is decorated with this attribute, a named metadata node
!intel_types_that_use_aspects is generated. The value of the this
metadata is a list of unnamed metadata nodes, each of which
describes one type that is decorated with this attribute. The value
of each unnamed metadata node starts with a string giving the name
of the type which is followed by a list of i32 constants, where each
constant is a value from cl::sycl::aspect enum class, telling the
numerical value of an aspect from the type's
[[sycl_detail::uses_aspects()]] attribute.

E.g.
!intel_types_that_use_aspects = !{!0, !1, !2}
!0 = !{!"class.cl::sycl::detail::half_impl::half", i32 8}
!1 = !{!"class.cl::sycl::amx_type", i32 9}
!2 = !{!"class.cl::sycl::other_type", i32 8, i32 9}

In the example above, the type cl::sycl::detail::half_impl::half uses
an aspect whose numerical value is 8 and the type cl::sycl::other_type
uses two aspects 8 and 9.

Spec:
github.com/intel/llvm/blob/sycl/sycl/doc/OptionalDeviceFeatures.md

Signed-off-by: Elizabeth Andrews <elizabeth.andrews@intel.com>
Signed-off-by: Elizabeth Andrews <elizabeth.andrews@intel.com>
Copy link
Contributor

@premanandrao premanandrao left a comment

Choose a reason for hiding this comment

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

Mostly looks good to me. Just a couple nits.

…rations

Signed-off-by: Elizabeth Andrews <elizabeth.andrews@intel.com>
smanna12
smanna12 previously approved these changes Dec 20, 2021
Copy link
Contributor

@smanna12 smanna12 left a comment

Choose a reason for hiding this comment

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

Changes look good to me.

gmlueck
gmlueck previously approved these changes Dec 20, 2021
Fznamznon
Fznamznon previously approved these changes Dec 20, 2021
Copy link
Contributor

@Fznamznon Fznamznon left a comment

Choose a reason for hiding this comment

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

No more concerns from my side.

Signed-off-by: Elizabeth Andrews <elizabeth.andrews@intel.com>
@elizabethandrews
Copy link
Contributor Author

Thanks for the reviews everyone!

@bader
Copy link
Contributor

bader commented Dec 22, 2021

/summary:run

@elizabethandrews
Copy link
Contributor Author

@bader is anything holding this up? I believe I've received the required approvals and tests pass.

@bader bader merged commit 7a53ff6 into intel:sycl Dec 23, 2021
elizabethandrews added a commit to elizabethandrews/llvm that referenced this pull request Feb 8, 2022
The original implementation of this attribute in
intel#5166, did not support
applying the attribute on the kernel itself. This patch
fixes that. The attribute can be applied to the operator
method of kernel functor or on the kernel lambda.

Signed-off-by: Elizabeth Andrews <elizabeth.andrews@intel.com>
bader pushed a commit that referenced this pull request Feb 9, 2022
The original implementation of this attribute in
#5166, did not support
applying the attribute on the kernel itself. This patch
fixes that. The attribute can be applied to the operator
method of kernel functor or on the kernel lambda.

Signed-off-by: Elizabeth Andrews <elizabeth.andrews@intel.com>
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.

6 participants