Skip to content
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

[MemProf][NFC] Rename DefaultShadowGranularity to DefaultMemGranulari… #79412

Merged
merged 1 commit into from
Jan 26, 2024

Conversation

Enna1
Copy link
Contributor

@Enna1 Enna1 commented Jan 25, 2024

…ty in instrumentation code, be consistent with runtime

In runtime code, the size of memory block mapped to a single shadow location is called MEM_GRANULARITY.
In instrumentation code, the size of memory block mapped to a single shadow location is called DefaultShadowGranularity.
Actually, the SHADOW_GRANULARITY is 8 (1 << SHADOW_SCALE), and the MEM_GRANULARITY is 64.
The wording of DefaultShadowGranularity in instrumentation code is a bit misleading, this patch renames DefaultShadowGranularity to DefaultMemGranularity, be consistent with runtime.

@llvmbot
Copy link
Collaborator

llvmbot commented Jan 25, 2024

@llvm/pr-subscribers-llvm-transforms

Author: Enna1 (Enna1)

Changes

…ty in instrumentation code, be consistent with runtime

In runtime code, the size of memory block mapped to a single shadow location is called MEM_GRANULARITY.
In instrumentation code, the size of memory block mapped to a single shadow location is called DefaultShadowGranularity.
Actually, the SHADOW_GRANULARITY is 8 (1 << SHADOW_SCALE), and the MEM_GRANULARITY is 64.
The wording of DefaultShadowGranularity in instrumentation code is a bit misleading, this patch renames DefaultShadowGranularity to DefaultMemGranularity, be consistent with runtime.


Full diff: https://github.com/llvm/llvm-project/pull/79412.diff

1 Files Affected:

  • (modified) llvm/lib/Transforms/Instrumentation/MemProfiler.cpp (+2-2)
diff --git a/llvm/lib/Transforms/Instrumentation/MemProfiler.cpp b/llvm/lib/Transforms/Instrumentation/MemProfiler.cpp
index 5123ed771c9d638..2445ba7f0dda993 100644
--- a/llvm/lib/Transforms/Instrumentation/MemProfiler.cpp
+++ b/llvm/lib/Transforms/Instrumentation/MemProfiler.cpp
@@ -59,7 +59,7 @@ extern cl::opt<bool> NoPGOWarnMismatchComdatWeak;
 constexpr int LLVM_MEM_PROFILER_VERSION = 1;
 
 // Size of memory mapped to a single shadow location.
-constexpr uint64_t DefaultShadowGranularity = 64;
+constexpr uint64_t DefaultMemGranularity = 64;
 
 // Scale from granularity down to shadow size.
 constexpr uint64_t DefaultShadowScale = 3;
@@ -120,7 +120,7 @@ static cl::opt<int> ClMappingScale("memprof-mapping-scale",
 static cl::opt<int>
     ClMappingGranularity("memprof-mapping-granularity",
                          cl::desc("granularity of memprof shadow mapping"),
-                         cl::Hidden, cl::init(DefaultShadowGranularity));
+                         cl::Hidden, cl::init(DefaultMemGranularity));
 
 static cl::opt<bool> ClStack("memprof-instrument-stack",
                              cl::desc("Instrument scalar stack variables"),

…ty in instrumentation code, be consistent with runtime

In runtime code, the size of memory block mapped to a single
shadow location is called MEM_GRANULARITY.
In instrumentation code, the size of memory block mapped to a single shadow
location is called DefaultShadowGranularity.
Actually, the SHADOW_GRANULARITY is 8 (1 << SHADOW_SCALE),
and the MEM_GRANULARITY is 64.
The wording of DefaultShadowGranularity in instrumentation code is a bit misleading,
this patch renames DefaultShadowGranularity to DefaultMemGranularity,
be consistent with runtime.
@Enna1 Enna1 force-pushed the users/Enna1/memprof-rename-mem-granularity branch from acbe891 to f325222 Compare January 26, 2024 01:13
@Enna1 Enna1 merged commit e0ade45 into main Jan 26, 2024
3 of 4 checks passed
@Enna1 Enna1 deleted the users/Enna1/memprof-rename-mem-granularity branch January 26, 2024 02:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants