Skip to content

Commit aaddd8d

Browse files
committed
[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.
1 parent de2a86e commit aaddd8d

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

offload/plugins-nextgen/common/include/PluginInterface.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,6 +1063,7 @@ struct GenericDeviceTy : public DeviceAllocatorTy {
10631063

10641064
virtual Error getDeviceStackSize(uint64_t &V) = 0;
10651065

1066+
virtual bool hasDeviceHeapSize() { return false; }
10661067
virtual Error getDeviceHeapSize(uint64_t &V) {
10671068
return Plugin::error(error::ErrorCode::UNSUPPORTED,
10681069
"%s not supported by platform", __func__);

offload/plugins-nextgen/common/src/PluginInterface.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -762,13 +762,15 @@ Error GenericDeviceTy::init(GenericPluginTy &Plugin) {
762762
return StackSizeEnvarOrErr.takeError();
763763
OMPX_TargetStackSize = std::move(*StackSizeEnvarOrErr);
764764

765-
auto HeapSizeEnvarOrErr = UInt64Envar::create(
766-
"LIBOMPTARGET_HEAP_SIZE",
767-
[this](uint64_t &V) -> Error { return getDeviceHeapSize(V); },
768-
[this](uint64_t V) -> Error { return setDeviceHeapSize(V); });
769-
if (!HeapSizeEnvarOrErr)
770-
return HeapSizeEnvarOrErr.takeError();
771-
OMPX_TargetHeapSize = std::move(*HeapSizeEnvarOrErr);
765+
if (hasDeviceHeapSize()) {
766+
auto HeapSizeEnvarOrErr = UInt64Envar::create(
767+
"LIBOMPTARGET_HEAP_SIZE",
768+
[this](uint64_t &V) -> Error { return getDeviceHeapSize(V); },
769+
[this](uint64_t V) -> Error { return setDeviceHeapSize(V); });
770+
if (!HeapSizeEnvarOrErr)
771+
return HeapSizeEnvarOrErr.takeError();
772+
OMPX_TargetHeapSize = std::move(*HeapSizeEnvarOrErr);
773+
}
772774

773775
// Update the maximum number of teams and threads after the device
774776
// initialization sets the corresponding hardware limit.

offload/plugins-nextgen/cuda/src/rtl.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1242,6 +1242,7 @@ struct CUDADeviceTy : public GenericDeviceTy {
12421242
Error setDeviceStackSize(uint64_t Value) override {
12431243
return setCtxLimit(CU_LIMIT_STACK_SIZE, Value);
12441244
}
1245+
bool hasDeviceHeapSize() override { return true; }
12451246
Error getDeviceHeapSize(uint64_t &Value) override {
12461247
return getCtxLimit(CU_LIMIT_MALLOC_HEAP_SIZE, Value);
12471248
}

offload/test/offloading/interop-print.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
// REQUIRES: gpu
1010
// XFAIL: nvptx64-nvidia-cuda
11+
// XFAIL: nvptx64-nvidia-cuda-LTO
1112

1213
#include <omp.h>
1314
#include <stdio.h>

0 commit comments

Comments
 (0)