[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 04:13:29 PST 2022


gchatelet updated this revision to Diff 409582.
gchatelet added a comment.

rebase


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/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.409582.patch
Type: text/x-patch
Size: 1322 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20220217/73e6b04c/attachment.bin>


More information about the libc-commits mailing list