1 //===-- OffloadPolicy.h - Configuration of offload behavior -----*- 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 // Configuration for offload behavior, e.g., if offload is disabled, can be
10 // disabled, is mandatory, etc.
12 //===----------------------------------------------------------------------===//
14 #ifndef OMPTARGET_OFFLOAD_POLICY_H
15 #define OMPTARGET_OFFLOAD_POLICY_H
17 #include "PluginManager.h"
19 enum kmp_target_offload_kind_t
{
25 extern "C" int __kmpc_get_target_offload(void) __attribute__((weak
));
29 OffloadPolicy(PluginManager
&PM
) {
30 // TODO: Check for OpenMP.
31 switch ((kmp_target_offload_kind_t
)__kmpc_get_target_offload()) {
39 if (PM
.getNumDevices()) {
40 DP("Default TARGET OFFLOAD policy is now mandatory "
41 "(devices were found)\n");
44 DP("Default TARGET OFFLOAD policy is now disabled "
45 "(no devices were found)\n");
53 static const OffloadPolicy
&get(PluginManager
&PM
) {
54 static OffloadPolicy
OP(PM
);
58 enum OffloadPolicyKind
{ DISABLED
, MANDATORY
};
60 OffloadPolicyKind Kind
= MANDATORY
;
63 #endif // OMPTARGET_OFFLOAD_POLICY_H