@@ -318,8 +318,10 @@ class kernel_library {
318318public:
319319 constexpr kernel_library () : ptr{nullptr } {}
320320 constexpr kernel_library (void *ptr) : ptr{ptr} {}
321+ kernel_library (uint64_t addr) : ptr(reinterpret_cast <void *>(addr)) {}
321322
322323 operator void *() const { return ptr; }
324+ explicit operator uint64_t () const { return reinterpret_cast <uint64_t >(ptr); }
323325
324326private:
325327 void *ptr;
@@ -393,15 +395,17 @@ class kernel_function {
393395public:
394396 constexpr kernel_function () : ptr{nullptr } {}
395397 constexpr kernel_function (dpct::kernel_functor ptr) : ptr{ptr} {}
398+ kernel_function (uint64_t addr)
399+ : ptr(reinterpret_cast <dpct::kernel_functor>(addr)) {}
396400
397401 operator void *() const { return ((void *)ptr); }
398402
399403 void operator ()(sycl::queue &q, const sycl::nd_range<3 > &range,
400- unsigned int a, void **args, void **extra) {
404+ unsigned int a, void **args, void **extra) const {
401405 ptr (q, range, a, args, extra);
402406 }
403407
404- explicit operator uint64_t () const { return ( uint64_t ) this ; }
408+ explicit operator uint64_t () const { return reinterpret_cast < uint64_t >(ptr) ; }
405409
406410private:
407411 dpct::kernel_functor ptr;
@@ -411,7 +415,7 @@ class kernel_function {
411415// / \param [in] library Handle to the kernel library.
412416// / \param [in] name Name of the kernel function.
413417static inline dpct::kernel_function
414- get_kernel_function (kernel_library &library, const std::string &name) {
418+ get_kernel_function (const kernel_library &library, const std::string &name) {
415419#ifdef _WIN32
416420 dpct::kernel_functor fn = reinterpret_cast <dpct::kernel_functor>(
417421 GetProcAddress (static_cast <HMODULE>(static_cast <void *>(library)),
@@ -434,7 +438,7 @@ get_kernel_function(kernel_library &library, const std::string &name) {
434438// / function.
435439// / \param [in] kernelParams Array of pointers to kernel arguments.
436440// / \param [in] extra Extra arguments.
437- static inline void invoke_kernel_function (dpct::kernel_function &function,
441+ static inline void invoke_kernel_function (const dpct::kernel_function &function,
438442 sycl::queue &queue,
439443 sycl::range<3 > groupRange,
440444 sycl::range<3 > localRange,
0 commit comments