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 device number in the system for omp_get_device_num.
32 uint32_t getDeviceNum();
33 
34 /// Return the user choosen debug level.
35 uint32_t getDebugKind();
36 
37 /// Return the amount of dynamic shared memory that was allocated at launch.
38 uint64_t getDynamicMemorySize();
39 
40 /// Return if debugging is enabled for the given debug kind.
41 bool isDebugMode(DebugKind Level);
42 
43 /// Indicates if this kernel may require thread-specific states, or if it was
44 /// explicitly disabled by the user.
45 bool mayUseThreadStates();
46 
47 } // namespace config
48 } // namespace _OMP
49 
50 #endif
51