Skip to content

Support for Builtins replacing integration header functionality #50

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

Open
wants to merge 4 commits into
base: sycl-upstream-fe-pr9
Choose a base branch
from

Conversation

elizabethandrews
Copy link
Collaborator

This PR contains 3 commits:

  1. Preliminary support for builtins : I squashed all commits related to builtins from intel/llvm@sycl...elizabethandrews:llvm:DebugForkSYCLUpstreamFE to create a single commit. Individual commits can be seen in pasted link if required but some of the older commits may have incorrect code which were fixed later.
  2. Added support for case where builtin-sycl-kernel-name is called before kernel is invoked.
  3. Fixed a warning which showed up in this branch due to some discrepancies between Tom's branch and DebugForkSYCLUpstreamFE.

tahonermann and others added 4 commits March 14, 2025 15:27
…ctions.

A SYCL kernel entry point function is a non-member function or a static member
function declared with the `sycl_kernel_entry_point` attribute. Such functions
define a pattern for an offload kernel to be generated to enable execution of
a SYCL kernel on a device. A SYCL library implementation orchestrates the
invocation of these functions with corresponding SYCL kernel arguments in
response to calls to SYCL kernel invocation functions specified by the SYCL
2020 specification.

SYCL kernel entry point functions are represented in the AST as functions
with a body consisting of a `SYCLKernelCallStmt` and its associated
`OutlinedFunctionDecl` instance. The `OutlinedFunctionDecl` instance specifies
the parameters and body to be used for the generated offload kernel. The
offload kernel is sometimes referred to as a SYCL kernel caller function.

A distinct offload kernel is generated for each SYCL kernel entry point
function defined as a non-inline function or ODR-used in the translation unit.
These offload kernels are given names equivalent to a specialization of a
function template named '__sycl_kernel_caller' with a void return type, no
function parameters, and a single type template argument corresponding to the
type used as the SYCL kernel name as passed as an argument to the
`sycl_kernel_entry_point` attribute. These offload kernels are only emitted
when compiling for a SYCL device target; when compiling for a SYCL host target,
SYCL kernel entry point functions are emitted as normal functions.

Eventually, only those functions that are referenced from an offload kernel
(or declared as SYCL_EXTERNAL) will be emitted when compiling for a device
target. That pruning will be implemented in a future change.
This PR adds preliminary support for builtins replacing
Integration Header functionality.
Prior support for builtins depends on KernelInfo being available
at the time of builtin call. This is not always the case. If a
builtin is called prior to kernel invocation, KernelInfo is not
populated and the builtin will be unable to retrieve the information
it requires. In this case,a global variable is declared to hold the
required information, which is populated later when kernel
invocation is processed.

This PR implements support for this case for
builtin-sycl-kernel-name.
@tahonermann tahonermann self-requested a review March 19, 2025 16:13
@tahonermann tahonermann changed the base branch from sycl-upstream-fe-pr4 to sycl-upstream-fe-pr9 March 26, 2025 02:17
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