cornell-zhang / heterocl

HeteroCL: A Multi-Paradigm Programming Infrastructure for Software-Defined Heterogeneous Computing
https://cornell-zhang.github.io/heterocl/
Apache License 2.0
326 stars 92 forks source link

[Profiler] Count Memory Access & Arith Ops from MLIR code #463

Open tonyjie opened 2 years ago

tonyjie commented 2 years ago

Profiler: Count Memory Access & Arith Ops from MLIR code

Add feature: Read the .mlir code and count memory access and arithmetic ops by analyzing the loop nest.

How to use the new feature: python profile.py <file_name.mlir>

Detailed description: implementation details Get the tripcount of current loop, and accumulates the number of memory access when visiting AffineLoadOp and AffineStoreOp; accumulates the number of ArithOps when visiting arith.AddIOp, arith.MulIOp, arith.AddFOp, arith.MulFOp

Link to the tests: https://github.com/zzzDavid/hcl-memory-opt/tree/main/roofline_profile