-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[hwasan][NFCI] Rename ClRandomSkipRate to ClRandomKeepRate #126990
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
The meaning of ClRandomSkipRate was inverted in llvm#88070 but the variable name was not changed. This patch fixes it to avoid confusion. Additionally, it elaborates the flag description to mention the interaction between the random keep rate and hotness cutoff.
|
@llvm/pr-subscribers-llvm-transforms Author: Thurston Dang (thurstond) ChangesThe meaning of ClRandomSkipRate was inverted in Additionally, it elaborates the flag description to mention the interaction between the random keep rate and hotness cutoff. Full diff: https://github.com/llvm/llvm-project/pull/126990.diff 1 Files Affected:
diff --git a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
index 645c102752692..5a184cc066aab 100644
--- a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
@@ -195,9 +195,11 @@ static cl::opt<int> ClHotPercentileCutoff("hwasan-percentile-cutoff-hot",
cl::desc("Hot percentile cutoff."));
static cl::opt<float>
- ClRandomSkipRate("hwasan-random-rate",
+ ClRandomKeepRate("hwasan-random-rate",
cl::desc("Probability value in the range [0.0, 1.0] "
- "to keep instrumentation of a function."));
+ "to keep instrumentation of a function. "
+ "Note: instrumentation can be skipped randomly "
+ "OR because of the hot percentile cutoff."));
STATISTIC(NumTotalFuncs, "Number of total funcs");
STATISTIC(NumInstrumentedFuncs, "Number of instrumented funcs");
@@ -301,7 +303,7 @@ class HWAddressSanitizer {
: M(M), SSI(SSI) {
this->Recover = optOr(ClRecover, Recover);
this->CompileKernel = optOr(ClEnableKhwasan, CompileKernel);
- this->Rng = ClRandomSkipRate.getNumOccurrences() ? M.createRNG(DEBUG_TYPE)
+ this->Rng = ClRandomKeepRate.getNumOccurrences() ? M.createRNG(DEBUG_TYPE)
: nullptr;
initializeModule();
@@ -1599,9 +1601,9 @@ bool HWAddressSanitizer::selectiveInstrumentationShouldSkip(
};
auto SkipRandom = [&]() {
- if (!ClRandomSkipRate.getNumOccurrences())
+ if (!ClRandomKeepRate.getNumOccurrences())
return false;
- std::bernoulli_distribution D(ClRandomSkipRate);
+ std::bernoulli_distribution D(ClRandomKeepRate);
return !D(*Rng);
};
|
|
@llvm/pr-subscribers-compiler-rt-sanitizer Author: Thurston Dang (thurstond) ChangesThe meaning of ClRandomSkipRate was inverted in Additionally, it elaborates the flag description to mention the interaction between the random keep rate and hotness cutoff. Full diff: https://github.com/llvm/llvm-project/pull/126990.diff 1 Files Affected:
diff --git a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
index 645c102752692..5a184cc066aab 100644
--- a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
@@ -195,9 +195,11 @@ static cl::opt<int> ClHotPercentileCutoff("hwasan-percentile-cutoff-hot",
cl::desc("Hot percentile cutoff."));
static cl::opt<float>
- ClRandomSkipRate("hwasan-random-rate",
+ ClRandomKeepRate("hwasan-random-rate",
cl::desc("Probability value in the range [0.0, 1.0] "
- "to keep instrumentation of a function."));
+ "to keep instrumentation of a function. "
+ "Note: instrumentation can be skipped randomly "
+ "OR because of the hot percentile cutoff."));
STATISTIC(NumTotalFuncs, "Number of total funcs");
STATISTIC(NumInstrumentedFuncs, "Number of instrumented funcs");
@@ -301,7 +303,7 @@ class HWAddressSanitizer {
: M(M), SSI(SSI) {
this->Recover = optOr(ClRecover, Recover);
this->CompileKernel = optOr(ClEnableKhwasan, CompileKernel);
- this->Rng = ClRandomSkipRate.getNumOccurrences() ? M.createRNG(DEBUG_TYPE)
+ this->Rng = ClRandomKeepRate.getNumOccurrences() ? M.createRNG(DEBUG_TYPE)
: nullptr;
initializeModule();
@@ -1599,9 +1601,9 @@ bool HWAddressSanitizer::selectiveInstrumentationShouldSkip(
};
auto SkipRandom = [&]() {
- if (!ClRandomSkipRate.getNumOccurrences())
+ if (!ClRandomKeepRate.getNumOccurrences())
return false;
- std::bernoulli_distribution D(ClRandomSkipRate);
+ std::bernoulli_distribution D(ClRandomKeepRate);
return !D(*Rng);
};
|
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/88/builds/7968 Here is the relevant piece of the build log for the reference |
The meaning of ClRandomSkipRate was inverted in llvm#88070 but the variable name was not changed. This patch fixes it to avoid confusion. Additionally, it elaborates the flag description to mention the interaction between the random keep rate and hotness cutoff.
The meaning of ClRandomSkipRate was inverted in llvm#88070 but the variable name was not changed. This patch fixes it to avoid confusion. Additionally, it elaborates the flag description to mention the interaction between the random keep rate and hotness cutoff.
The meaning of ClRandomSkipRate was inverted in llvm#88070 but the variable name was not changed. This patch fixes it to avoid confusion. Additionally, it elaborates the flag description to mention the interaction between the random keep rate and hotness cutoff.
The meaning of ClRandomSkipRate was inverted in
#88070 but the variable name was not changed. This patch fixes it to avoid confusion.
Additionally, it elaborates the flag description to mention the interaction between the random keep rate and hotness cutoff.