Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a tool to generate a time chart from an instrumentation file #2809

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

negiyas
Copy link
Collaborator

@negiyas negiyas commented Apr 30, 2024

This PR provides a tool to generate a time chart figure from outputs generated by applications compiled by onnx-mlir with the "--InstrumentReportTime" option.

Users typically use utils/make-timechart.py with an instrumentation file. An output file in png format is generated. For example ./utils/make-timechart.py resnet50-v2-7.inst generates resnet50-v2-7.png

The main graph shows a single folded time line for showing elapsed time of executed operations.
The Y-axis shows the beginning time of each horizontal line, and the X-axis shows time offsets to be added to the Y-axis.

The legend shows the total execution time and number of calls of each operation. As default, operations occupying 1.0%+ of execution time have independent legends, and other operations has a common "Other" legend.

Any comments and design requests are very welcome.
resnet50-v2-7

The following is an example scenario to compile, build, run a module and generate its timechart.

$ ./build/Debug/bin/onnx-mlir  --shapeInformation=-1:64  -mcpu=z16 --mtriple=s390x-ibm-loz --parallel --O3 --maccel=NNPA  --instrument-stage=ZHigh --instrument-ops=onnx.*,zhigh.* --InstrumentBeforeOp --InstrumentAfterOp --InstrumentReportTime --EmitLib resnet50-v2-7.onnx
$ ONNX_MLIR_HOME=./build/Debug utils/RunONNXModel.py --shape-info=-1:64 --load-so resnet50-v2-7.so > resnet50-v2-7.inst
$ head resnet50-v2-7.inst
==START-REPORT==
==PERF-REPORT==, onnx.Constant, NOTSET, before, 0.000007, 0.000007
==PERF-REPORT==, onnx.Constant, NOTSET, after, 0.000001, 0.000008
==PERF-REPORT==, onnx.Constant, NOTSET, before, 0.000001, 0.000009
==PERF-REPORT==, onnx.Constant, NOTSET, after, 0.000000, 0.000009
==PERF-REPORT==, onnx.Constant, NOTSET, before, 0.000001, 0.000010
==PERF-REPORT==, onnx.Constant, NOTSET, after, 0.000000, 0.000010
==PERF-REPORT==, onnx.Constant, NOTSET, before, 0.000000, 0.000010
==PERF-REPORT==, onnx.Constant, NOTSET, after, 0.000001, 0.000011
==PERF-REPORT==, onnx.Constant, Initializer_reshape_attr_tensor430, before, 0.000000, 0.000011
$ ./utils/make-timechart.py resnet50-v2-7.inst

…ompiled by onnx-mlir with the "--InstrumentReportTime" option.

Signed-off-by: Yasushi Negishi <negishi@jp.ibm.com>
@negiyas negiyas changed the title Add a tool to generate a time chart from an intrumentation file Add a tool to generate a time chart from an instrumentation file May 8, 2024
negiyas added 11 commits May 9, 2024 07:35
Signed-off-by: Yasushi Negishi <negishi@jp.ibm.com>
Signed-off-by: Yasushi Negishi <negishi@jp.ibm.com>
Signed-off-by: Yasushi Negishi <negishi@jp.ibm.com>
Signed-off-by: Yasushi Negishi <negishi@jp.ibm.com>
Signed-off-by: Yasushi Negishi <negishi@jp.ibm.com>
Signed-off-by: Yasushi Negishi <negishi@jp.ibm.com>
Signed-off-by: Yasushi Negishi <negishi@jp.ibm.com>
Copy link
Collaborator

@AlexandreEichenberger AlexandreEichenberger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM,
please confirm that help is provided if I type python make-time chart.py -h?
Looking forward to use this tool, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants