Skip to content

Commit 1d2007b

Browse files
authored
[SYCL][COMPAT] kernel_function and kernel_library constexpr constructors (#13932)
Updated classes in `sycl/include/syclcompat/kernel.hpp` to have constexpr constructors and align to SYCLomatic's latest `kernel.hpp` header. Signed-off-by: Alberto Cabrera <[email protected]>
1 parent 0cb5307 commit 1d2007b

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

sycl/doc/syclcompat/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1426,8 +1426,8 @@ static void get_kernel_function_info(kernel_function_info *kernel_info,
14261426
static kernel_function_info get_kernel_function_info(const void *function);
14271427

14281428
class kernel_library {
1429-
kernel_library();
1430-
kernel_library(void *ptr);
1429+
constexpr kernel_library();
1430+
constexpr kernel_library(void *ptr);
14311431
operator void *() const;
14321432
};
14331433

@@ -1436,8 +1436,8 @@ static kernel_library load_kernel_library_mem(char const *const image);
14361436
static void unload_kernel_library(const kernel_library &library);
14371437

14381438
class kernel_function {
1439-
kernel_function();
1440-
kernel_function(kernel_functor ptr);
1439+
constexpr kernel_function();
1440+
constexpr kernel_function(kernel_functor ptr);
14411441
operator void *() const;
14421442
void operator()(sycl::queue &q, const sycl::nd_range<3> &range,
14431443
unsigned int local_mem_size, void **args, void **extra);

sycl/include/syclcompat/kernel.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -340,8 +340,8 @@ class path_lib_record {
340340

341341
class kernel_library {
342342
public:
343-
kernel_library() : ptr{nullptr} {}
344-
kernel_library(void *ptr) : ptr{ptr} {}
343+
constexpr kernel_library() : ptr{nullptr} {}
344+
constexpr kernel_library(void *ptr) : ptr{ptr} {}
345345

346346
operator void *() const { return ptr; }
347347

@@ -415,8 +415,8 @@ static inline void unload_kernel_library(const kernel_library &library) {
415415

416416
class kernel_function {
417417
public:
418-
kernel_function() : ptr{nullptr} {}
419-
kernel_function(kernel_functor ptr) : ptr{ptr} {}
418+
constexpr kernel_function() : ptr{nullptr} {}
419+
constexpr kernel_function(kernel_functor ptr) : ptr{ptr} {}
420420

421421
operator void *() const { return ((void *)ptr); }
422422

0 commit comments

Comments
 (0)