[Driver] Remove ignored Flag form of -fauto-profile/-fprofile-sample-use
[llvm-project.git] / offload / DeviceRTL / src / Configuration.cpp
blob9e14c203d4a04e6dcc673240d0231f39e0b31f54
1 //===- Configuration.cpp - 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 // This file contains the data object of the constant device environment and the
10 // query API.
12 //===----------------------------------------------------------------------===//
14 #include "Configuration.h"
15 #include "DeviceTypes.h"
16 #include "State.h"
18 using namespace ompx;
20 #pragma omp begin declare target device_type(nohost)
22 // Weak definitions will be overridden by CGOpenmpRuntimeGPU if enabled.
23 [[gnu::weak]] extern const uint32_t __omp_rtl_debug_kind = 0;
24 [[gnu::weak]] extern const uint32_t __omp_rtl_assume_no_thread_state = 0;
25 [[gnu::weak]] extern const uint32_t __omp_rtl_assume_no_nested_parallelism = 0;
26 [[gnu::weak]] extern const uint32_t __omp_rtl_assume_threads_oversubscription =
28 [[gnu::weak]] extern const uint32_t __omp_rtl_assume_teams_oversubscription = 0;
30 // This variable should be visibile to the plugin so we override the default
31 // hidden visibility.
32 [[gnu::used, gnu::retain, gnu::weak,
33 gnu::visibility("protected")]] DeviceEnvironmentTy
34 CONSTANT(__omp_rtl_device_environment);
36 uint32_t config::getAssumeTeamsOversubscription() {
37 return __omp_rtl_assume_teams_oversubscription;
40 uint32_t config::getAssumeThreadsOversubscription() {
41 return __omp_rtl_assume_threads_oversubscription;
44 uint32_t config::getDebugKind() {
45 return __omp_rtl_debug_kind & __omp_rtl_device_environment.DeviceDebugKind;
48 uint32_t config::getNumDevices() {
49 return __omp_rtl_device_environment.NumDevices;
52 uint32_t config::getDeviceNum() {
53 return __omp_rtl_device_environment.DeviceNum;
56 uint64_t config::getDynamicMemorySize() {
57 return __omp_rtl_device_environment.DynamicMemSize;
60 uint64_t config::getClockFrequency() {
61 return __omp_rtl_device_environment.ClockFrequency;
64 void *config::getIndirectCallTablePtr() {
65 return reinterpret_cast<void *>(
66 __omp_rtl_device_environment.IndirectCallTable);
69 uint64_t config::getHardwareParallelism() {
70 return __omp_rtl_device_environment.HardwareParallelism;
73 uint64_t config::getIndirectCallTableSize() {
74 return __omp_rtl_device_environment.IndirectCallTableSize;
77 bool config::isDebugMode(DeviceDebugKind Kind) {
78 return config::getDebugKind() & uint32_t(Kind);
81 bool config::mayUseThreadStates() { return !__omp_rtl_assume_no_thread_state; }
83 bool config::mayUseNestedParallelism() {
84 if (__omp_rtl_assume_no_nested_parallelism)
85 return false;
86 return state::getKernelEnvironment().Configuration.MayUseNestedParallelism;
89 #pragma omp end declare target