-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[Offload] Make MemoryManager threshold ENV var size_t type. #124063
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
Conversation
|
@llvm/pr-subscribers-offload Author: None (hidekisaito) ChangesFull diff: https://github.com/llvm/llvm-project/pull/124063.diff 2 Files Affected:
diff --git a/offload/include/Shared/EnvironmentVar.h b/offload/include/Shared/EnvironmentVar.h
index 82f434e91a85b8..c1854774d572b6 100644
--- a/offload/include/Shared/EnvironmentVar.h
+++ b/offload/include/Shared/EnvironmentVar.h
@@ -128,6 +128,7 @@ using Int32Envar = Envar<int32_t>;
using Int64Envar = Envar<int64_t>;
using UInt32Envar = Envar<uint32_t>;
using UInt64Envar = Envar<uint64_t>;
+using SizeTEnvar = Envar<size_t>;
using StringEnvar = Envar<std::string>;
using BoolEnvar = Envar<bool>;
diff --git a/offload/plugins-nextgen/common/include/MemoryManager.h b/offload/plugins-nextgen/common/include/MemoryManager.h
index fe1989930b76ef..34e9e9618680f3 100644
--- a/offload/plugins-nextgen/common/include/MemoryManager.h
+++ b/offload/plugins-nextgen/common/include/MemoryManager.h
@@ -324,7 +324,7 @@ 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() {
- static UInt32Envar MemoryManagerThreshold(
+ static SizeTEnvar MemoryManagerThreshold(
"LIBOMPTARGET_MEMORY_MANAGER_THRESHOLD", 0);
size_t Threshold = MemoryManagerThreshold.get();
|
jhuber6
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use uint64_t instead?
First change I thought of was indeed the use of UInt64Envar, but the variable being assigned to |
We don't support any 32-bit platforms at all right now, and generally I don't like |
|
I'm a big fan of consistency in the coding. Looks like we need another set of eyes to break a tie. @jdoerfert (author of 0783bf1), between UInt64Envar and newly creating SizeTEnvar, which would you prefer? I'd like to let users choose/try 4+GB threshold if desired. |
551aa2c to
1eb7685
Compare
|
In the interest of moving this quicker, I changed it to use UInt64Envar instead. I can try create/use SizeTEnvar after this patch goes in. @jhuber6, thanks for the approval. When the test passes, please merge. |
|
|
No description provided.