13#ifndef PROTEUS_JIT_INTERFACE_H
14#define PROTEUS_JIT_INTERFACE_H
25 const char *AssociatedLambda);
31template <
typename T>
__attribute__((noinline))
void jit_arg(T V)
noexcept;
32#if defined(__CUDACC__) || defined(__HIP__)
34__attribute__((noinline)) __device__
void jit_arg(T V)
noexcept;
39jit_array(T V, [[maybe_unused]]
size_t NumElts,
41 typename std::remove_pointer<T>::type
Velem = 0) noexcept;
42#if defined(__CUDACC__) || defined(__HIP__)
45jit_array(T V, [[maybe_unused]]
size_t NumElts,
47 typename std::remove_pointer<T>::type
Velem = 0) noexcept;
52std::enable_if_t<std::is_trivially_copyable_v<std::remove_pointer_t<T>>,
void>
53jit_object(T *V,
size_t Size =
sizeof(std::remove_pointer_t<T>))
noexcept;
55#if defined(__CUDACC__) || defined(__HIP__)
58 std::is_trivially_copyable_v<std::remove_pointer_t<T>>,
void>
59jit_object(T *V,
size_t Size =
sizeof(T))
noexcept;
64std::enable_if_t<!std::is_pointer_v<T> &&
65 std::is_trivially_copyable_v<std::remove_reference_t<T>>,
67jit_object(T &V,
size_t Size =
sizeof(std::remove_reference_t<T>))
noexcept;
69#if defined(__CUDACC__) || defined(__HIP__)
72 !std::is_pointer_v<T> &&
73 std::is_trivially_copyable_v<std::remove_reference_t<T>>,
75jit_object(T &V,
size_t Size =
sizeof(T))
noexcept;
79 if constexpr (std::is_same_v<T, bool>) {
81 }
else if constexpr (std::is_integral_v<T> &&
sizeof(T) ==
sizeof(int8_t)) {
83 }
else if constexpr (std::is_integral_v<T> &&
sizeof(T) ==
sizeof(int32_t)) {
85 }
else if constexpr (std::is_integral_v<T> &&
sizeof(T) ==
sizeof(int64_t)) {
87 }
else if constexpr (std::is_same_v<T, float>) {
89 }
else if constexpr (std::is_same_v<T, double>) {
91 }
else if constexpr (std::is_same_v<T, long double>) {
93 }
else if constexpr (std::is_pointer_v<T>) {
103 const char *AssociatedLambda =
"") noexcept {
105 std::memcpy(
static_cast<void *
>(&RC), &V,
sizeof(T));
113register_lambda(T &&t,
const char *Symbol =
"") noexcept {
114 assert(Symbol &&
"Expected non-null Symbol");
119 using LambdaType = std::decay_t<T>;
120 LambdaType local = t;
122 return std::forward<T>(t);
125#if defined(__CUDACC__) || defined(__HIP__)
128template <
typename T,
size_t MAXN,
int UniqueID = 0>
130shared_array([[maybe_unused]]
size_t N,
131 [[maybe_unused]]
size_t ElemSize =
sizeof(T)) {
132 alignas(T)
static __shared__
char shmem[
sizeof(T) * MAXN];
133 return reinterpret_cast<T *
>(shmem);
void __jit_take_address(void const *) noexcept
void __jit_register_variable(proteus::RuntimeConstant RC, const char *AssociatedLambda)
void __jit_register_lambda(const char *Symbol)
Definition MemoryCache.h:26
size_t std::remove_pointer< T >::type Velem
Definition JitInterface.h:41
static int Pos
Definition JitInterface.h:102
RuntimeConstantType
Definition CompilerInterfaceTypes.h:20
@ NONE
Definition CompilerInterfaceTypes.h:22
@ INT32
Definition CompilerInterfaceTypes.h:25
@ INT64
Definition CompilerInterfaceTypes.h:26
@ FLOAT
Definition CompilerInterfaceTypes.h:27
@ LONG_DOUBLE
Definition CompilerInterfaceTypes.h:29
@ INT8
Definition CompilerInterfaceTypes.h:24
@ BOOL
Definition CompilerInterfaceTypes.h:23
@ PTR
Definition CompilerInterfaceTypes.h:30
@ DOUBLE
Definition CompilerInterfaceTypes.h:28
static int int Offset
Definition JitInterface.h:102
size_t NumElts
Definition JitInterface.h:39
__attribute__((noinline)) void jit_arg(T V) noexcept
Definition CompilerInterfaceTypes.h:72