summaryrefslogtreecommitdiff
path: root/offload/plugins-nextgen
diff options
context:
space:
mode:
authorJoseph Huber <huberjn@outlook.com>2025-11-06 12:37:19 -0600
committerJoseph Huber <huberjn@outlook.com>2025-11-06 13:00:26 -0600
commitaaddd8d38aa06f096cdf5ebe0d36c8e2b9a63265 (patch)
tree9028fb571c9d8d91390afda1e024a2de9972e53b /offload/plugins-nextgen
parentde2a86e5f0bdab3a09d91f4f8f57b06d3ff55b18 (diff)
[OpenMP] Fix tests relying on the heap size variable
Summary: I made that an unimplemented error, but forgot that it was used for this environment variable.
Diffstat (limited to 'offload/plugins-nextgen')
-rw-r--r--offload/plugins-nextgen/common/include/PluginInterface.h1
-rw-r--r--offload/plugins-nextgen/common/src/PluginInterface.cpp16
-rw-r--r--offload/plugins-nextgen/cuda/src/rtl.cpp1
3 files changed, 11 insertions, 7 deletions
diff --git a/offload/plugins-nextgen/common/include/PluginInterface.h b/offload/plugins-nextgen/common/include/PluginInterface.h
index eac5ee215152..2135e0608323 100644
--- a/offload/plugins-nextgen/common/include/PluginInterface.h
+++ b/offload/plugins-nextgen/common/include/PluginInterface.h
@@ -1063,6 +1063,7 @@ struct GenericDeviceTy : public DeviceAllocatorTy {
virtual Error getDeviceStackSize(uint64_t &V) = 0;
+ virtual bool hasDeviceHeapSize() { return false; }
virtual Error getDeviceHeapSize(uint64_t &V) {
return Plugin::error(error::ErrorCode::UNSUPPORTED,
"%s not supported by platform", __func__);
diff --git a/offload/plugins-nextgen/common/src/PluginInterface.cpp b/offload/plugins-nextgen/common/src/PluginInterface.cpp
index 3ed3cb1cc13b..ee2ecbcfd309 100644
--- a/offload/plugins-nextgen/common/src/PluginInterface.cpp
+++ b/offload/plugins-nextgen/common/src/PluginInterface.cpp
@@ -762,13 +762,15 @@ Error GenericDeviceTy::init(GenericPluginTy &Plugin) {
return StackSizeEnvarOrErr.takeError();
OMPX_TargetStackSize = std::move(*StackSizeEnvarOrErr);
- auto HeapSizeEnvarOrErr = UInt64Envar::create(
- "LIBOMPTARGET_HEAP_SIZE",
- [this](uint64_t &V) -> Error { return getDeviceHeapSize(V); },
- [this](uint64_t V) -> Error { return setDeviceHeapSize(V); });
- if (!HeapSizeEnvarOrErr)
- return HeapSizeEnvarOrErr.takeError();
- OMPX_TargetHeapSize = std::move(*HeapSizeEnvarOrErr);
+ if (hasDeviceHeapSize()) {
+ auto HeapSizeEnvarOrErr = UInt64Envar::create(
+ "LIBOMPTARGET_HEAP_SIZE",
+ [this](uint64_t &V) -> Error { return getDeviceHeapSize(V); },
+ [this](uint64_t V) -> Error { return setDeviceHeapSize(V); });
+ if (!HeapSizeEnvarOrErr)
+ return HeapSizeEnvarOrErr.takeError();
+ OMPX_TargetHeapSize = std::move(*HeapSizeEnvarOrErr);
+ }
// Update the maximum number of teams and threads after the device
// initialization sets the corresponding hardware limit.
diff --git a/offload/plugins-nextgen/cuda/src/rtl.cpp b/offload/plugins-nextgen/cuda/src/rtl.cpp
index fc3e7710622a..45e580e7e0cd 100644
--- a/offload/plugins-nextgen/cuda/src/rtl.cpp
+++ b/offload/plugins-nextgen/cuda/src/rtl.cpp
@@ -1242,6 +1242,7 @@ struct CUDADeviceTy : public GenericDeviceTy {
Error setDeviceStackSize(uint64_t Value) override {
return setCtxLimit(CU_LIMIT_STACK_SIZE, Value);
}
+ bool hasDeviceHeapSize() override { return true; }
Error getDeviceHeapSize(uint64_t &Value) override {
return getCtxLimit(CU_LIMIT_MALLOC_HEAP_SIZE, Value);
}