Page MenuHomePhabricator

[mlir] print-op-stats: Print op counts for top-k locs
Needs ReviewPublic

Authored by springerm on Sun, Sep 12, 11:15 PM.

Details

Summary

Not only print the number of operations for the each location (show only top-k), but also a breakdown of how many operations of each kind.

Depends On D109672

Diff Detail

Unit TestsFailed

TimeTest
110 msx64 windows > MLIR.IR::op-stats.mlir
Script: -- : 'RUN: at line 1'; c:\ws\w6\llvm-project\premerge-checks\build\bin\mlir-opt.exe -allow-unregistered-dialect -print-op-stats="top-k-locs=5 top-k-locs-op-counts" C:\ws\w6\llvm-project\premerge-checks\mlir\test\IR\op-stats.mlir -o=/dev/null 2>&1 | c:\ws\w6\llvm-project\premerge-checks\build\bin\filecheck.exe C:\ws\w6\llvm-project\premerge-checks\mlir\test\IR\op-stats.mlir

Event Timeline

springerm created this revision.Sun, Sep 12, 11:15 PM
springerm requested review of this revision.Sun, Sep 12, 11:15 PM
Herald added a project: Restricted Project. · View Herald TranscriptSun, Sep 12, 11:15 PM

Example output:

Top locations by number of operations:
--------------------------------------
...nrolled-tensor-transfer-ops.mlir:1 offset ":67:17) , 7169
  builtin.unrealized_conversion_cast , 1280
     llvm.add                        , 512
     llvm.bitcast                    , 256
     llvm.extractvalue               , 512
     llvm.getelementptr              , 256
     llvm.insertvalue                , 256
     llvm.intr.masked.load           , 256
     llvm.mlir.constant              , 256
     llvm.mul                        , 256
      scf.if                         , 256
      scf.yield                      , 512
      std.addi                       , 256
      std.cmpi                       , 512
      std.constant                   , 513
      std.index_cast                 , 512
      std.splat                      , 768
...nrolled-tensor-transfer-ops.mlir:1 offset ":39:14) , 7168
  builtin.unrealized_conversion_cast , 1280
     llvm.add                        , 512
     llvm.bitcast                    , 256
     llvm.extractvalue               , 512
     llvm.getelementptr              , 256
     llvm.insertvalue                , 256
     llvm.intr.masked.load           , 256
     llvm.mlir.constant              , 256
     llvm.mul                        , 256
      scf.if                         , 256
      scf.yield                      , 512
      std.addi                       , 256
      std.cmpi                       , 512
      std.constant                   , 512
      std.index_cast                 , 512
      std.splat                      , 768
...nrolled-tensor-transfer-ops.mlir:1 offset ":50:14) , 7168
  builtin.unrealized_conversion_cast , 1280
     llvm.add                        , 512
     llvm.bitcast                    , 256
     llvm.extractvalue               , 512

[...]

Can you please add a commit summary?

jpienaar added inline comments.
mlir/lib/Transforms/OpStats.cpp
43

Isn't this just count per operation name? Not sure why this is marked as histogram

address comments

springerm retitled this revision from [mlir] print-op-stats: Print op name histogram for top-k locs to [mlir] print-op-stats: Print op counts for top-k locs.Tue, Sep 14, 10:37 PM
springerm edited the summary of this revision. (Show Details)

Note: This revision is separate from D109672 because it is arguably less useful; D109672 may be good enough for debugging in many cases. Maybe we only want to have D109672...

mlir/lib/Transforms/OpStats.cpp
43

Ah yes, I meant "counts".