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 "Shared/Environment.h" 17 18 #include "DeviceTypes.h" 19 20 namespace ompx { 21 namespace config { 22 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(); 26 27 /// Return the device number in the system for omp_get_device_num. 28 uint32_t getDeviceNum(); 29 30 /// Return the user choosen debug level. 31 uint32_t getDebugKind(); 32 33 /// Return if teams oversubscription is assumed 34 uint32_t getAssumeTeamsOversubscription(); 35 36 /// Return if threads oversubscription is assumed 37 uint32_t getAssumeThreadsOversubscription(); 38 39 /// Return the amount of dynamic shared memory that was allocated at launch. 40 uint64_t getDynamicMemorySize(); 41 42 /// Returns the cycles per second of the device's fixed frequency clock. 43 uint64_t getClockFrequency(); 44 45 /// Returns the pointer to the beginning of the indirect call table. 46 void *getIndirectCallTablePtr(); 47 48 /// Returns the size of the indirect call table. 49 uint64_t getIndirectCallTableSize(); 50 51 /// Returns the size of the indirect call table. 52 uint64_t getHardwareParallelism(); 53 54 /// Return if debugging is enabled for the given debug kind. 55 bool isDebugMode(DeviceDebugKind Level); 56 57 /// Indicates if this kernel may require thread-specific states, or if it was 58 /// explicitly disabled by the user. 59 bool mayUseThreadStates(); 60 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(); 64 65 } // namespace config 66 } // namespace ompx 67 68 #endif 69