Skip to content

Commit 0783bf1

Browse files
authored
[OpenMP][NFC] Merge MemoryManager into PluginInterface (#73678)
Similar to #73677, there is no benefit from keeping MemoryManager seperate; it's tied into the current design. Except the move I also replaced the getenv call with our Env handling.
1 parent 43f783f commit 0783bf1

File tree

8 files changed

+14
-30
lines changed

8 files changed

+14
-30
lines changed

openmp/libomptarget/plugins-nextgen/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "${tmachine}$")
4747

4848
LINK_LIBS
4949
PRIVATE
50-
MemoryManager
5150
PluginInterface
5251
${LIBOMPTARGET_DEP_LIBFFI_LIBRARIES}
5352
${OPENMP_PTHREAD_LIB}

openmp/libomptarget/plugins-nextgen/amdgpu/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ add_llvm_library(omptarget.rtl.amdgpu SHARED
8080

8181
LINK_LIBS
8282
PRIVATE
83-
MemoryManager
8483
PluginInterface
8584
${LIBOMPTARGET_DEP_LIBRARIES}
8685
${OPENMP_PTHREAD_LIB}

openmp/libomptarget/plugins-nextgen/common/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,3 @@
1212

1313
add_subdirectory(OMPT)
1414
add_subdirectory(PluginInterface)
15-
add_subdirectory(MemoryManager)

openmp/libomptarget/plugins-nextgen/common/MemoryManager/CMakeLists.txt

Lines changed: 0 additions & 11 deletions
This file was deleted.

openmp/libomptarget/plugins-nextgen/common/OMPT/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ endif()
5252
target_link_libraries(OMPT
5353
PUBLIC
5454
${llvm_libs}
55-
MemoryManager
5655
)
5756

5857
# Define the TARGET_NAME and DEBUG_PREFIX.

openmp/libomptarget/plugins-nextgen/common/PluginInterface/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ endif()
6363
target_link_libraries(PluginInterface
6464
PUBLIC
6565
${llvm_libs}
66-
MemoryManager
6766
)
6867

6968
# Include the RPC server from the `libc` project if availible.

openmp/libomptarget/plugins-nextgen/common/MemoryManager/MemoryManager.h renamed to openmp/libomptarget/plugins-nextgen/common/PluginInterface/MemoryManager.h

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
#ifndef LLVM_OPENMP_LIBOMPTARGET_PLUGINS_COMMON_MEMORYMANAGER_MEMORYMANAGER_H
14-
#define LLVM_OPENMP_LIBOMPTARGET_PLUGINS_COMMON_MEMORYMANAGER_MEMORYMANAGER_H
13+
#ifndef LLVM_OPENMP_LIBOMPTARGET_PLUGINS_COMMON_MEMORYMANAGER_H
14+
#define LLVM_OPENMP_LIBOMPTARGET_PLUGINS_COMMON_MEMORYMANAGER_H
1515

1616
#include <cassert>
1717
#include <functional>
@@ -22,6 +22,8 @@
2222
#include <vector>
2323

2424
#include "Debug.h"
25+
#include "Utilities.h"
26+
#include "omptarget.h"
2527

2628
/// Base class of per-device allocator.
2729
class DeviceAllocatorTy {
@@ -322,16 +324,15 @@ class MemoryManagerTy {
322324
/// manager explicitly by setting the var to 0. If user doesn't specify
323325
/// anything, returns <0, true>.
324326
static std::pair<size_t, bool> getSizeThresholdFromEnv() {
325-
size_t Threshold = 0;
326-
327-
if (const char *Env =
328-
std::getenv("LIBOMPTARGET_MEMORY_MANAGER_THRESHOLD")) {
329-
Threshold = std::stoul(Env);
330-
if (Threshold == 0) {
331-
DP("Disabled memory manager as user set "
332-
"LIBOMPTARGET_MEMORY_MANAGER_THRESHOLD=0.\n");
333-
return std::make_pair(0, false);
334-
}
327+
static llvm::omp::target::UInt32Envar MemoryManagerThreshold(
328+
"LIBOMPTARGET_MEMORY_MANAGER_THRESHOLD", 0);
329+
330+
size_t Threshold = MemoryManagerThreshold.get();
331+
332+
if (MemoryManagerThreshold.isPresent() && Threshold == 0) {
333+
DP("Disabled memory manager as user set "
334+
"LIBOMPTARGET_MEMORY_MANAGER_THRESHOLD=0.\n");
335+
return std::make_pair(0, false);
335336
}
336337

337338
return std::make_pair(Threshold, true);
@@ -343,4 +344,4 @@ class MemoryManagerTy {
343344
constexpr const size_t MemoryManagerTy::BucketSize[];
344345
constexpr const int MemoryManagerTy::NumBuckets;
345346

346-
#endif // LLVM_OPENMP_LIBOMPTARGET_PLUGINS_COMMON_MEMORYMANAGER_MEMORYMANAGER_H
347+
#endif // LLVM_OPENMP_LIBOMPTARGET_PLUGINS_COMMON_MEMORYMANAGER_H

openmp/libomptarget/plugins-nextgen/cuda/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ add_llvm_library(omptarget.rtl.cuda SHARED
3434
Object
3535

3636
LINK_LIBS PRIVATE
37-
MemoryManager
3837
PluginInterface
3938
${OPENMP_PTHREAD_LIB}
4039

0 commit comments

Comments
 (0)