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][Doc] Design doc for compile-time properties #4937

Merged
merged 8 commits into from
Jan 14, 2022

Conversation

gmlueck
Copy link
Contributor

@gmlueck gmlueck commented Nov 10, 2021

Add a design document for the DPC++ extension API
SYCL_EXT_ONEAPI_PROPERTY_LIST, which describes how compile-time
properties are recognized by the front-end, how they are represented
in LLVM IR, and how they are translated into SPIR-V.

Add a design document for the DPC++ extension API
`SYCL_EXT_ONEAPI_PROPERTY_LIST`, which describes how compile-time
properties are recognized by the front-end, how they are represented
in LLVM IR, and how they are translated into SPIR-V.
sycl/doc/CompileTimeProperties.md Show resolved Hide resolved
sycl/doc/CompileTimeProperties.md Show resolved Hide resolved
sycl/doc/CompileTimeProperties.md Outdated Show resolved Hide resolved
@gmlueck gmlueck requested a review from AlexeySotkin December 6, 2021 16:35
@gmlueck
Copy link
Contributor Author

gmlueck commented Dec 6, 2021

@AlexeySotkin could you review this from the SPIR-V perspective? I think the section "Representing properties in SPIR-V" is most relevant to you.

AlexeySachkov
AlexeySachkov previously approved these changes Dec 7, 2021
Copy link
Contributor

@AlexeySachkov AlexeySachkov left a comment

Choose a reason for hiding this comment

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

sycl-post-link part LGTM

@AlexeySotkin
Copy link
Contributor

AlexeySotkin commented Dec 7, 2021

@AlexeySotkin could you review this from the SPIR-V perspective? I think the section "Representing properties in SPIR-V" is most relevant to you.

Do I get it right that this design aims to avoid any changes in the compiler FE, while on SPIR-V level we still need to create a SPIR-V extension every time the desired property can't be expressed with the current version of SPIR-V spec and/or exising extensions?

I mean we still may need new execution modes and decorations, right?

@gmlueck
Copy link
Contributor Author

gmlueck commented Dec 7, 2021

Do I get it right that this design aims to avoid any changes in the compiler FE, while on SPIR-V level we still need to create a SPIR-V extension every time the desired property can't be expressed with the current version of SPIR-V spec and/or exising extensions?

I mean we still may need new execution modes and decorations, right?

This is correct. However, I think you should not compare the compiler FE with the SPIR-V spec. Instead, think of it this way. Let's say we want to add some new compile-time property in the future which also needs to be represented in SPIR-V. We would create a SYCL extension to describe the new property and we would also create a SPIR-V extension to describe the new matching decoration. Thus, we create an extension at both the SYCL level and also the SPIR-V level.

It so happens that we can implement the SYCL extension in the header files without changing the front-end compiler. That is just an implementation detail, though.

romanovvlad
romanovvlad previously approved these changes Dec 8, 2021
Copy link
Contributor

@romanovvlad romanovvlad left a comment

Choose a reason for hiding this comment

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

LGTM

sycl/doc/CompileTimeProperties.md Show resolved Hide resolved
* When representing properties using `@llvm.ptr.annotation`, represent
  all properties in the fifth argument.  This allows each property and
  its value to be represented as its own metadata, rather than combining
  them all into a single string.

* Add an initial optional parameter to each C++ attribute that allows
  filtering of the properties.

* The header now passes `nullptr` instead of `""` to represent the
  "value" of a property that has no value.

* Clarify that each property in the C++ attribute parameter list has
  exactly one value, so the number of parameters is even (assuming the
  initial optional parameter is not specified).
@gmlueck gmlueck dismissed stale reviews from romanovvlad and AlexeySachkov via 4476369 December 8, 2021 19:09
AlexeySotkin
AlexeySotkin previously approved these changes Dec 8, 2021
Copy link
Contributor

@AlexeySotkin AlexeySotkin left a comment

Choose a reason for hiding this comment

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

SPIR-V part LGTM.

sycl/doc/CompileTimeProperties.md Outdated Show resolved Hide resolved
sycl/doc/CompileTimeProperties.md Outdated Show resolved Hide resolved
sycl/doc/CompileTimeProperties.md Outdated Show resolved Hide resolved
sycl/doc/CompileTimeProperties.md Outdated Show resolved Hide resolved
sycl/doc/CompileTimeProperties.md Outdated Show resolved Hide resolved
sycl/doc/CompileTimeProperties.md Outdated Show resolved Hide resolved
* Capture some more open issues with properties that are represented
  as IR attributes on kernel arguments.  What happens if an single
  aggregate kernel argument gets properties from more than one source?

* Resolve TODO about replacing `handler::kernel_single_task()` with
  a wrapper class like `KernelSingleTaskWrapper`.  The front-end team
  thinks this is the preferred direction.

* Add note that `<initializer_list>` must be included in order to use
  the optional "filter list" parameter to the C++ attributes.  This
  "filter list" parameter is a brace-enclosed list, and the front-end
  team thinks it would be easier to implement if `<initializer_list>`
  is included.
Solve the TODO issues with properties that decorate kernel parameter
by:

* Move the C++ attribute from the parameter's class to a member
  variable inside the class.  The author of the header file will
  need to decide with member variable to attach the properties to.

* Restrict the C++ attribute, so it is only used to decorate a SYCL
  "special class".  When a value of this type is passed as a kernel
  parameter, each member variable is passed as a separate parameter
  to the kernel's function.  As a result, there is no ambiguity about
  which function parameter receives the property.
@gmlueck gmlueck requested a review from a team as a code owner January 12, 2022 16:44
@gmlueck
Copy link
Contributor Author

gmlueck commented Jan 12, 2022

Finalization of this design document is on the critical path for resuming implementation of this feature, so I'd like to get approvals from stakeholders.

@elizabethandrews, @AaronBallman: Can one of you approve from the CFE team? I think all of the issues you raised earlier have been resolved. The only change since your last review is d0622a6, which eliminates one of the TODO items.

@GarveyJoe: Since d0622a6 addressed your comment, can you approve also?

@steffenlarsen: Adding you as an approver also, since you will be (and have been) implementing much of this design.

Note that there are still two TODO's in this design about extending the set of property values that can be represented in IR. The design is workable without addressing those items, so I'd like to get approval in the current form. If we decide that we need to expand the set of legal IR properties later, we can update this design at that time.

@bader: Please let me know if we need additional approvals before this can be merged.

sycl/doc/CompileTimeProperties.md Outdated Show resolved Hide resolved
sycl/doc/CompileTimeProperties.md Show resolved Hide resolved
sycl/doc/CompileTimeProperties.md Outdated Show resolved Hide resolved
sycl/doc/CompileTimeProperties.md Outdated Show resolved Hide resolved
sycl/doc/CompileTimeProperties.md Show resolved Hide resolved
sycl/doc/CompileTimeProperties.md Show resolved Hide resolved
Clarify the description about the changes to the header file to state
exactly which C++ attribute is added.
GarveyJoe
GarveyJoe previously approved these changes Jan 13, 2022
@gmlueck gmlueck dismissed stale reviews from GarveyJoe and elizabethandrews via 9ad4651 January 13, 2022 18:31
@gmlueck gmlueck requested a review from GarveyJoe January 13, 2022 18:36
Copy link
Contributor

@steffenlarsen steffenlarsen left a comment

Choose a reason for hiding this comment

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

Only a small question but it shouldn't block the merge. LGTM. Great work! 😄

sycl/doc/CompileTimeProperties.md Show resolved Hide resolved
@gmlueck
Copy link
Contributor Author

gmlueck commented Jan 14, 2022

@bader: Can this be merged? In addition to the current approvers, the following people have previously approved earlier versions of this design. Their approvals were dismissed by later commits:

Note that testing fails with the HIP backend on the following tests:

  • SubGroup/broadcast.cpp
  • SubGroup/broadcast_fp16.cpp
  • SubGroup/broadcast_fp64.cpp

I think this must be unrelated since this PR changes only a document. In addition, the same three tests fail in #5268

@bader bader merged commit 912572f into intel:sycl Jan 14, 2022
@gmlueck gmlueck deleted the gmlueck/property-design branch January 18, 2022 22:41
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.