1 //===--- Configuration.h - OpenMP device configuration interface -- 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 // API to query the global (constant) device environment.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef OMPTARGET_CONFIGURATION_H
14 #define OMPTARGET_CONFIGURATION_H
15 
16 #include "Types.h"
17 
18 namespace _OMP {
19 namespace config {
20 
21 enum DebugKind : uint32_t {
22   Assertion = 1U << 0,
23   FunctionTracing = 1U << 1,
24   CommonIssues = 1U << 2,
25 };
26 
27 /// Return the number of devices in the system, same number as returned on the
28 /// host by omp_get_num_devices.
29 uint32_t getNumDevices();
30 
31 /// Return the number of devices in the system, same number as returned on the
32 /// host by omp_get_num_devices.
33 uint32_t getDeviceNum();
34 
35 /// Return the user choosen debug level.
36 uint32_t getDebugKind();
37 
38 /// Return the amount of dynamic shared memory that was allocated at launch.
39 uint64_t getDynamicMemorySize();
40 
41 /// Return if debugging is enabled for the given debug kind.
42 bool isDebugMode(DebugKind Level);
43 
44 /// Indicates if this kernel may require thread-specific states, or if it was
45 /// explicitly disabled by the user.
46 bool mayUseThreadStates();
47 
48 } // namespace config
49 } // namespace _OMP
50 
51 #endif
52