[libc-commits] [PATCH] D120037: [llvm][automemcpy] Allow distribution filtering in analysis
Guillaume Chatelet via Phabricator via libc-commits
libc-commits at lists.llvm.org
Thu Feb 17 05:11:04 PST 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG48e0e6cedc56: [llvm][automemcpy] Allow distribution filtering in analysis (authored by gchatelet).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D120037/new/
https://reviews.llvm.org/D120037
Files:
libc/benchmarks/automemcpy/lib/CodeGen.cpp
libc/benchmarks/automemcpy/lib/ResultAnalyzerMain.cpp
Index: libc/benchmarks/automemcpy/lib/ResultAnalyzerMain.cpp
===================================================================
--- libc/benchmarks/automemcpy/lib/ResultAnalyzerMain.cpp
+++ libc/benchmarks/automemcpy/lib/ResultAnalyzerMain.cpp
@@ -20,6 +20,12 @@
static cl::list<std::string> InputFilenames(cl::Positional, cl::OneOrMore,
cl::desc("<input json files>"));
+// User can filter the distributions to be taken into account.
+static cl::list<std::string>
+ KeepOnlyDistributions("keep-only-distributions", cl::ZeroOrMore,
+ cl::desc("<comma separated list of distribution "
+ "names, keeps all if unspecified>"));
+
namespace automemcpy {
// This is defined in the autogenerated 'Implementations.cpp' file.
@@ -48,7 +54,7 @@
// Functions and distributions names are stored quite a few times so it's more
// efficient to internalize these strings and refer to them through 'StringRef'.
static StringRef getInternalizedString(StringRef VolatileStr) {
- static llvm::StringSet<> StringCache;
+ static llvm::StringSet StringCache;
return StringCache.insert(VolatileStr).first->getKey();
}
@@ -121,6 +127,15 @@
llvm::append_range(Samples, Result.Samples);
}
+ if (!KeepOnlyDistributions.empty()) {
+ llvm::StringSet ValidDistributions;
+ ValidDistributions.insert(KeepOnlyDistributions.begin(),
+ KeepOnlyDistributions.end());
+ llvm::erase_if(Samples, [&ValidDistributions](const Sample &S) {
+ return !ValidDistributions.contains(S.Id.Distribution.Name);
+ });
+ }
+
// Extracts median of throughputs.
std::vector<FunctionData> Functions = getThroughputs(Samples);
fillScores(Functions);
Index: libc/benchmarks/automemcpy/lib/CodeGen.cpp
===================================================================
--- libc/benchmarks/automemcpy/lib/CodeGen.cpp
+++ libc/benchmarks/automemcpy/lib/CodeGen.cpp
@@ -613,7 +613,7 @@
// Stores `VolatileStr` into a cache and returns a StringRef of the cached
// version.
StringRef getInternalizedString(std::string VolatileStr) {
- static llvm::StringSet<> StringCache;
+ static llvm::StringSet StringCache;
return StringCache.insert(std::move(VolatileStr)).first->getKey();
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120037.409598.patch
Type: text/x-patch
Size: 2324 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20220217/d992a4d9/attachment.bin>
More information about the libc-commits
mailing list