diff options
| author | Alex <alejandro.duran@intel.com> | 2025-03-28 23:28:14 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-28 17:28:14 -0500 |
| commit | 021a1f69742aab7d650887a0978db5cf007967d3 (patch) | |
| tree | 2941af414f80a7fa8e36a4d20ad46d006b25f1ab /offload/include/OffloadPolicy.h | |
| parent | 5a073f1f3ad99e70138e9ef8097ccc2b7fad05b2 (diff) | |
[OFFLOAD] Stricter enforcement of user offload disable (#133470)
If user specifies offload is disabled (e.g.,
OMP_TARGET_OFFLOAD=disable), disable library almost completely. This
reduces resources spent to a minimum and ensures all APIs behave as if
the only available device is the host device.
Currently some of the APIs behave as if there were devices avaible for
offload even when under OMP_TARGET_OFFLOAD=disable.
---------
Co-authored-by: Joseph Huber <huberjn@outlook.com>
Diffstat (limited to 'offload/include/OffloadPolicy.h')
| -rw-r--r-- | offload/include/OffloadPolicy.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/offload/include/OffloadPolicy.h b/offload/include/OffloadPolicy.h index 858d9c323b15..800fefb22432 100644 --- a/offload/include/OffloadPolicy.h +++ b/offload/include/OffloadPolicy.h @@ -46,10 +46,15 @@ class OffloadPolicy { Kind = DISABLED; } return; - }; + } } public: + static bool isOffloadDisabled() { + return static_cast<kmp_target_offload_kind_t>( + __kmpc_get_target_offload()) == tgt_disabled; + } + static const OffloadPolicy &get(PluginManager &PM) { static OffloadPolicy OP(PM); return OP; |
