DPC++ Runtime
Runtime libraries for oneAPI DPC++
builtins_esimd.hpp
Go to the documentation of this file.
1 //==----------- builtins_esimd.hpp - SYCL ESIMD built-in functions ---------==//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #pragma once
10 
11 #include <sycl/detail/boolean.hpp>
12 #include <sycl/detail/builtins.hpp>
13 #include <sycl/detail/common.hpp>
16 #include <sycl/types.hpp>
17 
18 // TODO Decide whether to mark functions with this attribute.
19 #define __NOEXC /*noexcept*/
20 
21 namespace sycl {
22 inline namespace _V1 {
23 
24 // cos
25 template <int SZ>
26 ESIMD_NODEBUG ESIMD_INLINE __ESIMD_NS::simd<float, SZ>
27 cos(__ESIMD_NS::simd<float, SZ> x) __NOEXC {
28 #ifdef __SYCL_DEVICE_ONLY__
29  return __ESIMD_NS::detail::ocl_cos<SZ>(x.data());
30 #else
31  return __esimd_cos<float, SZ>(x.data());
32 #endif // __SYCL_DEVICE_ONLY__
33 }
34 
35 // sin
36 template <int SZ>
37 ESIMD_NODEBUG ESIMD_INLINE __ESIMD_NS::simd<float, SZ>
38 sin(__ESIMD_NS::simd<float, SZ> x) __NOEXC {
39 #ifdef __SYCL_DEVICE_ONLY__
40  return __ESIMD_NS::detail::ocl_sin<SZ>(x.data());
41 #else
42  return __esimd_sin<float, SZ>(x.data());
43 #endif // __SYCL_DEVICE_ONLY__
44 }
45 
46 // exp
47 template <int SZ>
48 ESIMD_NODEBUG ESIMD_INLINE __ESIMD_NS::simd<float, SZ>
49 exp(__ESIMD_NS::simd<float, SZ> x) __NOEXC {
50 #ifdef __SYCL_DEVICE_ONLY__
51  return __ESIMD_NS::detail::ocl_exp<SZ>(x.data());
52 #else
53  return __esimd_exp<float, SZ>(x.data());
54 #endif // __SYCL_DEVICE_ONLY__
55 }
56 
57 // log
58 template <int SZ>
59 ESIMD_NODEBUG ESIMD_INLINE __ESIMD_NS::simd<float, SZ>
60 log(__ESIMD_NS::simd<float, SZ> x) __NOEXC {
61 #ifdef __SYCL_DEVICE_ONLY__
62  return __ESIMD_NS::detail::ocl_log<SZ>(x.data());
63 #else
64  return __esimd_log<float, SZ>(x.data());
65 #endif // __SYCL_DEVICE_ONLY__
66 }
67 
68 } // namespace _V1
69 } // namespace sycl
70 
71 #undef __NOEXC
#define __NOEXC
ESIMD_NODEBUG ESIMD_INLINE sycl::ext::intel::esimd::simd< float, SZ > log(sycl::ext::intel::esimd::simd< float, SZ > x) __NOEXC
ESIMD_NODEBUG ESIMD_INLINE sycl::ext::intel::esimd::simd< float, SZ > sin(sycl::ext::intel::esimd::simd< float, SZ > x) __NOEXC
ESIMD_NODEBUG ESIMD_INLINE sycl::ext::intel::esimd::simd< float, SZ > cos(sycl::ext::intel::esimd::simd< float, SZ > x) __NOEXC
Definition: access.hpp:18