Skip to content

[OpenMP][NFC] Merge MemoryManager into PluginInterface #73678

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion openmp/libomptarget/plugins-nextgen/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "${tmachine}$")

LINK_LIBS
PRIVATE
MemoryManager
PluginInterface
${LIBOMPTARGET_DEP_LIBFFI_LIBRARIES}
${OPENMP_PTHREAD_LIB}
Expand Down
1 change: 0 additions & 1 deletion openmp/libomptarget/plugins-nextgen/amdgpu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ add_llvm_library(omptarget.rtl.amdgpu SHARED

LINK_LIBS
PRIVATE
MemoryManager
PluginInterface
${LIBOMPTARGET_DEP_LIBRARIES}
${OPENMP_PTHREAD_LIB}
Expand Down
1 change: 0 additions & 1 deletion openmp/libomptarget/plugins-nextgen/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@

add_subdirectory(OMPT)
add_subdirectory(PluginInterface)
add_subdirectory(MemoryManager)

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ endif()
target_link_libraries(OMPT
PUBLIC
${llvm_libs}
MemoryManager
)

# Define the TARGET_NAME and DEBUG_PREFIX.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ endif()
target_link_libraries(PluginInterface
PUBLIC
${llvm_libs}
MemoryManager
)

# Include the RPC server from the `libc` project if availible.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_OPENMP_LIBOMPTARGET_PLUGINS_COMMON_MEMORYMANAGER_MEMORYMANAGER_H
#define LLVM_OPENMP_LIBOMPTARGET_PLUGINS_COMMON_MEMORYMANAGER_MEMORYMANAGER_H
#ifndef LLVM_OPENMP_LIBOMPTARGET_PLUGINS_COMMON_MEMORYMANAGER_H
#define LLVM_OPENMP_LIBOMPTARGET_PLUGINS_COMMON_MEMORYMANAGER_H

#include <cassert>
#include <functional>
Expand All @@ -22,6 +22,8 @@
#include <vector>

#include "Debug.h"
#include "Utilities.h"
#include "omptarget.h"

/// Base class of per-device allocator.
class DeviceAllocatorTy {
Expand Down Expand Up @@ -322,16 +324,15 @@ class MemoryManagerTy {
/// manager explicitly by setting the var to 0. If user doesn't specify
/// anything, returns <0, true>.
static std::pair<size_t, bool> getSizeThresholdFromEnv() {
size_t Threshold = 0;

if (const char *Env =
std::getenv("LIBOMPTARGET_MEMORY_MANAGER_THRESHOLD")) {
Threshold = std::stoul(Env);
if (Threshold == 0) {
DP("Disabled memory manager as user set "
"LIBOMPTARGET_MEMORY_MANAGER_THRESHOLD=0.\n");
return std::make_pair(0, false);
}
static llvm::omp::target::UInt32Envar MemoryManagerThreshold(
"LIBOMPTARGET_MEMORY_MANAGER_THRESHOLD", 0);

size_t Threshold = MemoryManagerThreshold.get();

if (MemoryManagerThreshold.isPresent() && Threshold == 0) {
DP("Disabled memory manager as user set "
"LIBOMPTARGET_MEMORY_MANAGER_THRESHOLD=0.\n");
return std::make_pair(0, false);
}

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

#endif // LLVM_OPENMP_LIBOMPTARGET_PLUGINS_COMMON_MEMORYMANAGER_MEMORYMANAGER_H
#endif // LLVM_OPENMP_LIBOMPTARGET_PLUGINS_COMMON_MEMORYMANAGER_H
1 change: 0 additions & 1 deletion openmp/libomptarget/plugins-nextgen/cuda/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ add_llvm_library(omptarget.rtl.cuda SHARED
Object

LINK_LIBS PRIVATE
MemoryManager
PluginInterface
${OPENMP_PTHREAD_LIB}

Expand Down