[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 03:52:21 PST 2022


gchatelet created this revision.
gchatelet added a reviewer: courbet.
Herald added a project: libc-project.
Herald added a subscriber: libc-commits.
gchatelet requested review of this revision.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D120037

Files:
  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,11 @@
 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> FilterDistributions(
+    "filter-distributions", cl::ZeroOrMore,
+    cl::desc("<list of valid distribution names to keep, all if unspecified>"));
+
 namespace automemcpy {
 
 // This is defined in the autogenerated 'Implementations.cpp' file.
@@ -121,6 +126,15 @@
     llvm::append_range(Samples, Result.Samples);
   }
 
+  if (!FilterDistributions.empty()) {
+    llvm::StringSet<> ValidDistributions;
+    ValidDistributions.insert(FilterDistributions.begin(),
+                              FilterDistributions.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);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120037.409575.patch
Type: text/x-patch
Size: 1322 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20220217/4a8db254/attachment.bin>


More information about the libc-commits mailing list