1 //===--- Configuration.h - OpenMP device configuration interface -- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 // API to query the global (constant) device environment.
11 //===----------------------------------------------------------------------===//
13 #ifndef OMPTARGET_CONFIGURATION_H
14 #define OMPTARGET_CONFIGURATION_H
16 #include "Shared/Environment.h"
18 #include "DeviceTypes.h"
23 /// Return the number of devices in the system, same number as returned on the
24 /// host by omp_get_num_devices.
25 uint32_t getNumDevices();
27 /// Return the device number in the system for omp_get_device_num.
28 uint32_t getDeviceNum();
30 /// Return the user choosen debug level.
31 uint32_t getDebugKind();
33 /// Return if teams oversubscription is assumed
34 uint32_t getAssumeTeamsOversubscription();
36 /// Return if threads oversubscription is assumed
37 uint32_t getAssumeThreadsOversubscription();
39 /// Return the amount of dynamic shared memory that was allocated at launch.
40 uint64_t getDynamicMemorySize();
42 /// Returns the cycles per second of the device's fixed frequency clock.
43 uint64_t getClockFrequency();
45 /// Returns the pointer to the beginning of the indirect call table.
46 void *getIndirectCallTablePtr();
48 /// Returns the size of the indirect call table.
49 uint64_t getIndirectCallTableSize();
51 /// Returns the size of the indirect call table.
52 uint64_t getHardwareParallelism();
54 /// Return if debugging is enabled for the given debug kind.
55 bool isDebugMode(DeviceDebugKind Level
);
57 /// Indicates if this kernel may require thread-specific states, or if it was
58 /// explicitly disabled by the user.
59 bool mayUseThreadStates();
61 /// Indicates if this kernel may require data environments for nested
62 /// parallelism, or if it was explicitly disabled by the user.
63 bool mayUseNestedParallelism();