DPC++ Runtime
Runtime libraries for oneAPI DPC++
util.hpp
Go to the documentation of this file.
1 //==----------------- util.hpp - DPC++ Explicit SIMD API ------------------==//
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 // Utility functions used for implementing experimental Explicit SIMD APIs.
9 //===----------------------------------------------------------------------===//
10 
11 #pragma once
12 
14 
16 
18 namespace __ESIMD_EDNS {
19 
20 template <unsigned int N, unsigned int M>
21 constexpr unsigned int roundUpNextMultiple() {
22  return ((N + M - 1) / M) * M;
23 }
24 
26 template <typename...> struct is_one_of {
27  static constexpr bool value = false;
28 };
29 
30 template <typename Checked, typename First, typename... Other>
31 struct is_one_of<Checked, First, Other...> {
32  static constexpr bool value =
33  std::is_same<typename std::remove_const<Checked>::type,
34  typename std::remove_const<First>::type>::value ||
35  is_one_of<Checked, Other...>::value;
36 };
37 template <typename Checked, typename... T>
38 inline constexpr bool is_one_of_v = is_one_of<Checked, T...>::value;
39 
42 template <typename enumClass, enumClass... E> struct is_one_of_enum {
43  static constexpr bool value = false;
44 };
45 
46 template <typename enumClass, enumClass Checked, enumClass First,
47  enumClass... Else>
48 struct is_one_of_enum<enumClass, Checked, First, Else...> {
49  static constexpr bool value =
50  (Checked == First) || is_one_of_enum<enumClass, Checked, Else...>::value;
51 };
52 template <typename enumClass, enumClass... T>
53 inline constexpr bool is_one_of_enum_v = is_one_of_enum<enumClass, T...>::value;
54 
55 } // namespace __ESIMD_EDNS
56 } // __SYCL_INLINE_NAMESPACE(cl)
57 
T
util.hpp
cl
We provide new interfaces for matrix muliply in this patch:
Definition: access.hpp:13
__SYCL_INLINE_NAMESPACE
#define __SYCL_INLINE_NAMESPACE(X)
Definition: defines_elementary.hpp:12