diff options
author | Tom Honermann <tom.honermann@intel.com> | 2025-04-17 06:14:45 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-17 09:14:45 -0400 |
commit | 0348ff515854438cab8a48b79e8839cb99d48701 (patch) | |
tree | 43c39d33ad5fddc7f5002a659bff17c3c1a2f322 /clang/lib/CodeGen/CodeGenModule.h | |
parent | fb00fa56b51b191d026eec104905e416bf34bbda (diff) | |
download | llvm-0348ff515854438cab8a48b79e8839cb99d48701.zip llvm-0348ff515854438cab8a48b79e8839cb99d48701.tar.gz llvm-0348ff515854438cab8a48b79e8839cb99d48701.tar.bz2 |
[SYCL] Basic code generation for SYCL kernel caller offload entry point functions. (#133030)
A function declared with the `sycl_kernel_entry_point` attribute,
sometimes called a SYCL kernel entry point function, specifies a pattern
from which the parameters and body of an offload entry point function,
sometimes called a SYCL kernel caller function, are derived.
SYCL kernel caller functions are emitted during SYCL device compilation.
Their parameters and body are derived from the `SYCLKernelCallStmt`
statement and `OutlinedFunctionDecl` declaration associated with their
corresponding SYCL kernel entry point function. A distinct SYCL kernel
caller function is generated for each SYCL kernel entry point function
defined as a non-inline function or ODR-used in the translation unit.
The name of each SYCL kernel caller function is parameterized by the
SYCL kernel name type specified by the `sycl_kernel_entry_point`
attribute attached to the corresponding SYCL kernel entry point
function. For the moment, the Itanium ABI mangled name for typeinfo data
(`_ZTS<type>`) is used to name these functions; a future change will
switch to a more appropriate naming scheme.
The calling convention used for a SYCL kernel caller function is target
dependent. Support for AMDGCN, NVPTX, and SPIR targets is currently
provided. These functions are required to observe the language
restrictions for SYCL devices as specified by the SYCL 2020
specification; this includes a forward progress guarantee and prohibits
recursion.
Only SYCL kernel caller functions, functions declared as
`SYCL_EXTERNAL`, and functions directly or indirectly referenced from
those functions should be emitted during device compilation. Pruning of
other declarations has not yet been implemented.
---------
Co-authored-by: Elizabeth Andrews <elizabeth.andrews@intel.com>
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.h')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.h b/clang/lib/CodeGen/CodeGenModule.h index 46de3d86..9a0bc67 100644 --- a/clang/lib/CodeGen/CodeGenModule.h +++ b/clang/lib/CodeGen/CodeGenModule.h @@ -1972,6 +1972,11 @@ private: /// .gcda files in a way that persists in .bc files. void EmitCoverageFile(); + /// Given a sycl_kernel_entry_point attributed function, emit the + /// corresponding SYCL kernel caller offload entry point function. + void EmitSYCLKernelCaller(const FunctionDecl *KernelEntryPointFn, + ASTContext &Ctx); + /// Determine whether the definition must be emitted; if this returns \c /// false, the definition can be emitted lazily if it's used. bool MustBeEmitted(const ValueDecl *D); |