19 #include <type_traits>
26 template <
typename T,
typename Group>
27 std::enable_if_t<std::is_trivially_destructible<T>::value &&
28 sycl::detail::is_group<Group>::value,
29 multi_ptr<T, access::address_space::local_space>>
32 #ifdef __SYCL_DEVICE_ONLY__
34 __sycl_allocateLocalMemory(
sizeof(
T),
alignof(
T));
35 return reinterpret_cast<__attribute__((opencl_local))
T *
>(AllocatedMem);
38 "sycl_ext_oneapi_local_memory extension is not supported on host device",
43 template <
typename T,
typename Group,
typename... Args>
44 std::enable_if_t<std::is_trivially_destructible<T>::value &&
49 #ifdef __SYCL_DEVICE_ONLY__
51 __sycl_allocateLocalMemory(
sizeof(
T),
alignof(
T));
54 id<3> Id = __spirv::initLocalInvocationId<3, id<3>>();
55 if (Id ==
id<3>(0, 0, 0))
56 new (AllocatedMem)
T(std::forward<Args>(args)...);
58 return reinterpret_cast<__attribute__((opencl_local))
T *
>(AllocatedMem);
63 "sycl_ext_oneapi_local_memory extension is not supported on host device",