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/common.hpp>
15 #include <sycl/types.hpp>
16 
17 // TODO Decide whether to mark functions with this attribute.
18 #define __NOEXC /*noexcept*/
19 
20 namespace sycl {
21 inline namespace _V1 {
22 
23 // cos
24 template <int SZ>
25 ESIMD_NODEBUG ESIMD_INLINE __ESIMD_NS::simd<float, SZ>
26 cos(__ESIMD_NS::simd<float, SZ> x) __NOEXC {
27 #ifdef __SYCL_DEVICE_ONLY__
28  return __ESIMD_NS::detail::ocl_cos<SZ>(x.data());
29 #else
30  return __esimd_cos<float, SZ>(x.data());
31 #endif // __SYCL_DEVICE_ONLY__
32 }
33 
34 // sin
35 template <int SZ>
36 ESIMD_NODEBUG ESIMD_INLINE __ESIMD_NS::simd<float, SZ>
37 sin(__ESIMD_NS::simd<float, SZ> x) __NOEXC {
38 #ifdef __SYCL_DEVICE_ONLY__
39  return __ESIMD_NS::detail::ocl_sin<SZ>(x.data());
40 #else
41  return __esimd_sin<float, SZ>(x.data());
42 #endif // __SYCL_DEVICE_ONLY__
43 }
44 
45 // exp
46 template <int SZ>
47 ESIMD_NODEBUG ESIMD_INLINE __ESIMD_NS::simd<float, SZ>
48 exp(__ESIMD_NS::simd<float, SZ> x) __NOEXC {
49 #ifdef __SYCL_DEVICE_ONLY__
50  return __ESIMD_NS::detail::ocl_exp<SZ>(x.data());
51 #else
52  return __esimd_exp<float, SZ>(x.data());
53 #endif // __SYCL_DEVICE_ONLY__
54 }
55 
56 // log
57 template <int SZ>
58 ESIMD_NODEBUG ESIMD_INLINE __ESIMD_NS::simd<float, SZ>
59 log(__ESIMD_NS::simd<float, SZ> x) __NOEXC {
60 #ifdef __SYCL_DEVICE_ONLY__
61  return __ESIMD_NS::detail::ocl_log<SZ>(x.data());
62 #else
63  return __esimd_log<float, SZ>(x.data());
64 #endif // __SYCL_DEVICE_ONLY__
65 }
66 
67 } // namespace _V1
68 } // namespace sycl
69 
70 #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
ESIMD_NODEBUG ESIMD_INLINE sycl::ext::intel::esimd::simd< float, SZ > exp(sycl::ext::intel::esimd::simd< float, SZ > x) __NOEXC
autodecltype(x) x
Definition: access.hpp:18