DPC++ Runtime
Runtime libraries for oneAPI DPC++
platform_util.hpp
Go to the documentation of this file.
1 //===--------- platform_util.hpp - platform utilities ----------*- C++ -*--===//
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 <cstdint>
12 
13 #include <stddef.h> // for ::size_t
14 
15 #include <sycl/detail/defines.hpp>
16 
17 #ifdef _MSC_VER
18 // This feature is not supported in MSVC.
19 #define __builtin_expect(a, b) (a)
20 #endif
21 
22 namespace sycl {
23 inline namespace _V1 {
24 namespace detail {
25 
26 struct PlatformUtil {
27  enum class TypeIndex : unsigned int {
28  Char = 0,
29  Short = 1,
30  Int = 2,
31  Long = 3,
32  Float = 4,
33  Double = 5,
34  Half = 6
35  };
36 
38  static uint32_t getNativeVectorWidth(TypeIndex Index);
39 
40  static uint32_t getMaxClockFrequency();
41 
42  static uint32_t getMemCacheLineSize();
43 
44  static uint64_t getMemCacheSize();
45 
46  static void prefetch(const char *Ptr, size_t NumBytes);
47 };
48 
49 } // namespace detail
50 } // namespace _V1
51 } // namespace sycl
Definition: access.hpp:18
static uint32_t getMemCacheLineSize()
static void prefetch(const char *Ptr, size_t NumBytes)
static uint32_t getNativeVectorWidth(TypeIndex Index)
Returns the maximum vector width counted in elements of the given type.
static uint32_t getMaxClockFrequency()