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] Clarify WI funcs in kernel compiler #12891

Conversation

gmlueck
Copy link
Contributor

@gmlueck gmlueck commented Mar 1, 2024

Clarify the SPIR-V and OpenCL kernel compiler specifications to explain
how the SYCL iteration space maps to the SPIR-V / OpenCL C languages
and clarify that these kernels can use their normal language mechanisms
to find the current work-item's position in the iteration space.

We also disallow launching a SPIR-V or OpenCL C kernel as a simple
"range" kernel. This seems consistent with our view that a "range"
kernel is not just a degenerate form of an nd-range kernel. Since
SPIR-V and OpenCL C kernels always have access to nd-range features, it
does not make sense to launch them as range kernels. This is also
consistent with our decision to limit SYCL free function kernels to
"nd-range" and "single-task" forms.

Some other cleanup of these specifications also:

  • Clarify what happens when a local_accessor is passed as a kernel
    argument to a SPIR-V or OpenCL kernel. This was causing some
    confusion from users.

  • Reformat the table in the OpenCL spec describing kernel arguments
    so that it has the same layout as the equivalent SPIR-V table.

  • Fix the name of the OpenCL header file in the example.

Also disallows launching a SPIR-V kernel as a simple "range" kernel.
This seems consistent with our view that a "range" kernel is not just a
degenerate form of an nd-range kernel.  Since SPIR-V kernels always
have access to nd-range features, it does not make sense to launch them
as range kernels.  This is also consistent with our decision to limit
SYCL free function kernels to "nd-range" and "single-task" forms.
The OpenCL table describing legal kernel arguments had the opposite
order from the corresponding SPIR-V table.  The OpenCL table listed
the SYCL argument type in the left column while the SPIR-V table listed
the SYCL argument tupe in the right column.  I like the SPIR-V format
better, so change the OpenCL table to match.  This also adopts some of
the same wording from the SPIR-V table into the OpenCL one.
Clarify the iteration space and the user of work-item functions in the
OpenCL spec.  These changes closely follow the corresponding changes in
the SPIR-V spec.
@gmlueck gmlueck requested a review from a team as a code owner March 1, 2024 23:16
Add a note referencing section C.7.7 of the core SYCL spec, which has
more details about the inverted sense of SYCL dimensions compared to
OpenCL.
Clarify that a single-task OpenCL and SPIR-V kernel can still use
features like `local_accessor` and group functions.  These are
well-defined because we already state that these single-task kernels
are launched as nd-range kernels with 1 work-item.
@gmlueck
Copy link
Contributor Author

gmlueck commented Mar 6, 2024

@intel/llvm-gatekeepers please merge #12888 before this one. I'll deal with the merge conflicts in this PR.

@gmlueck
Copy link
Contributor Author

gmlueck commented Mar 7, 2024

@intel/llvm-gatekeepers: Conflicts are resolved. I think this is ready to merge.

@steffenlarsen steffenlarsen merged commit eca61f1 into intel:sycl Mar 7, 2024
2 checks passed
@gmlueck gmlueck deleted the gmlueck/kernel-compiler-work-item-clarifications branch March 7, 2024 17:34
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.

3 participants