File tree Expand file tree Collapse file tree 4 files changed +12
-7
lines changed Expand file tree Collapse file tree 4 files changed +12
-7
lines changed Original file line number Diff line number Diff 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__);
Original file line number Diff line number Diff 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.
Original file line number Diff line number Diff 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 }
Original file line number Diff line number Diff line change 88
99// REQUIRES: gpu
1010// XFAIL: nvptx64-nvidia-cuda
11+ // XFAIL: nvptx64-nvidia-cuda-LTO
1112
1213#include <omp.h>
1314#include <stdio.h>
You can’t perform that action at this time.
0 commit comments