xiayouran / VisuTVM

TVM Relay IR Visualization Tool (TVM 可视化工具)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

VisuTVM

TVM Relay IR Visualization Tool (TVM 可视化工具)

Introduction

Visualize the TVM's Relay IR structure, and support the visualization of Pass optimized Relay IR.

Visu Relay IR

👉note:In the example(b), the nodes with the same color are fused.

Usage

# add env path
export PYTHONPATH=$PYTHONPATH:${your-path}/VisuTVM

# visu relay ir(default: FuseOps)
python main.py -bp relay_ir/example_fo_bp.txt -ap relay_ir/example_fo_ap.txt -sn example

# visu relay ir with tensor info
python main.py -bp relay_ir/example_fo_bp.txt -ap relay_ir/example_fo_ap.txt -sn example -wi

# if you only have one relay ir file(before pass file or after pass file), 
# you can run the following command
# input unoptimized relay ir file(before pass file)
python main.py -ri relay_ir/mobilenet_v2_fo_bp.txt -sn mobilenet_v2

# input optimized relay ir file(after pass file) and specify the pass name
python main.py -ri relay_ir/resnet18_all_pass.txt -pn AllPass -sn resnet18 -wi

# create relay ir txt file(depend on TVM environment)
python examples/example.py --passname FuseOps

Installation

  • Step1: install graphviz

  • Step2: install graphviz's python API

    pip install graphviz

Supported Pass

  • FuseOps
  • RemoveUnusedFunctions(no case)
  • ToBasicBlockNormalForm(no case)
  • EliminateCommonSubexpr
  • FoldConstant
  • SimplifyInference
  • CombineParallelConv2D
  • CombineParallelDense
  • CombineParallelBatchMatmul
  • FoldScaleAxis
  • SimplifyExpr
  • CanonicalizeCast
  • CanonicalizeOps(no case)
  • FlattenAtrousConv
  • FastMath
  • ConvertLayout
  • MergeComposite

Preview

🚀️ EliminateCommonSubexpr

🚀️ FoldConstant

🚀️ SimplifyInference

🚀️ CombineParallelConv2D

🚀️ FlattenAtrousConv

🚀️ All Pass with tensor info

Q&A

在使用过程中遇到可视化失败的Relay IR网络结构,可以在 issues 上提出你的问题,如果有任何好的想法,也可以进行交流哦👏👏👏

About

TVM Relay IR Visualization Tool (TVM 可视化工具)

License:Apache License 2.0


Languages

Language:Python 100.0%