This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by springerm on Sep 12 2021, 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

Event Timeline

springerm created this revision.Sep 12 2021, 11:15 PM
springerm requested review of this revision.Sep 12 2021, 11:15 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 12 2021, 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.Sep 14 2021, 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".

springerm abandoned this revision.Oct 16 2021, 9:32 PM