[PATCH] D115138: [llvm-mca] Compare multiple files

Milica Matic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 8 02:24:58 PST 2021


mmatic05 updated this revision to Diff 392691.
mmatic05 added a comment.

- addressed comments


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115138/new/

https://reviews.llvm.org/D115138

Files:
  llvm/utils/llvm-mca-compare-multiple-files.py
  llvm/utils/llvm-mca-pretty-printer/llvm-mca-pretty-printer.py


Index: llvm/utils/llvm-mca-compare-multiple-files.py
===================================================================
--- llvm/utils/llvm-mca-compare-multiple-files.py
+++ llvm/utils/llvm-mca-compare-multiple-files.py
@@ -26,23 +26,26 @@
 # Parse the program arguments.
 def parse_program_args(parser):
   parser.add_argument('file_names', nargs = '+', type = str, help = 'Names of files which tool process.')
-  parser.add_argument('-mtriple', nargs = 1, type = str, action = 'store', default = ['x86_64-unknown-linux-gnu'], help = 'Target triple.')
-  parser.add_argument('-mcpu', nargs = 1, type = str, action = 'store', default = ['skylake'], help = 'Target a specific cpu type .')
+  parser.add_argument('-mtriple', nargs = 1, type = str, action = 'store', metavar='[=<arg>]', default = ['x86_64-unknown-linux-gnu'], help = 'Target triple.')
+  parser.add_argument('-mcpu', nargs = 1, type = str, action = 'store', metavar='[=<arg>]', default = ['skylake'], help = 'Target a specific cpu type.')
   parser.add_argument('-diff', action = 'store_true', default = False, help = 'Prints the difference of statistics for multiple input assembler files.')
-  parser.add_argument('-iterations', type = int, nargs = 1, action = 'store', default = [100], help = 'Number of iterations to run.')
-  parser.add_argument('-useMca', nargs = 1, type = str, action = 'store', help = 'Specified relative path to llvm-mca.')
+  parser.add_argument('-iterations', type = int, nargs = 1, action = 'store', metavar='[=N]', default = [100], help = 'Number of iterations to run.')
+  parser.add_argument('--llvm-mca-binary', nargs = 1, type = str, action = 'store', metavar='[=<path to llvm-mca>]', help = 'Specified relative path to binary of llvm-mca.')
   return parser.parse_args()
 
 # Verify that the program inputs meet the requirements.
 def verify_program_inputs(opts):
   if len(sys.argv) < 2 :
-    print ('error: Wrong number of arguments.')
+    print ('error: Wrong number of arguments. At least ' \
+    'you must specify the script name and an attached file.')
     return False
   if opts.diff and len(opts.file_names) < 2:
-    print ('error: Wrong number of input files.')
+    print ('error: Wrong number of input files. At least you ' \
+    'must specify two input files with the given diff option.')
     return False
   if not opts.diff and len(opts.file_names) > 1:
-    print ('error: Wrong number of input files.')
+    print ('error: Wrong number of input files. Without diff ' \
+    'option, you can attach only one file.')
     return False
   return True
 
@@ -55,10 +58,10 @@
 def llvmMcaStats (opts, FileName):
 
   # Get the directory of the LLVM tools.
-  if not opts.useMca:
-    llvm_mca_cmd = os.path.normpath(os.path.join(os.path.dirname(__file__), "../../../../build/bin/llvm-mca"))
+  if not opts.llvm_mca_binary:
+    llvm_mca_cmd = os.path.normpath(os.path.join(os.path.dirname(__file__), "../../../build/bin/llvm-mca"))
   else:
-    llvm_mca_cmd = opts.useMca[0]
+    llvm_mca_cmd = opts.llvm_mca_binary[0]
 
   # The statistics llvm-mca options.
   llvm_mca_stats_opt1 = "-mtriple=" + opts.mtriple[0]
@@ -114,7 +117,7 @@
   matrix[3][0] = "Dispatch Width: "
   matrix[4][0] = "uOps Per Cycle: "
   matrix[5][0] = "IPC: "
-  matrix[6][0] = "Block RThroughp: "
+  matrix[6][0] = "Block RThroughput: "
   
   for j in range (len(arrayOneFileStats)):
       matrix[0][j + 1] = str(arrayOneFileStats[j].Instructions)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115138.392691.patch
Type: text/x-patch
Size: 3444 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211208/c81cc035/attachment.bin>


More information about the llvm-commits mailing list