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

Merged
merged 13 commits into from
Jun 10, 2024

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 <[email protected]>
@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
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

@negiyas
Copy link
Collaborator Author

negiyas commented Jun 10, 2024

@AlexandreEichenberger Thanks for the comments.

LGTM, please confirm that help is provided if I type python make-timechart.py -h?
"-h" option works as follows.

$ ./utils/make-timechart.py -h
usage: make-timechart.py [-h] [--print-summary] [-g GRAPH] [-t TITLE]
                         [--start-time START_TIME] [--period PERIOD]
                         [--xscale XSCALE] [--number-of-lines NUMBER_OF_LINES]
                         [--iteration ITERATION]
                         [--minimum-legend-percent MINIMUM_LEGEND_PERCENT]
                         [-l NUMBER_OF_LEGENDS]
                         instrumentation

positional arguments:
  instrumentation       Path to instrumentation file to be read

options:
  -h, --help            show this help message and exit
...

@negiyas negiyas merged commit e58195c into onnx:main Jun 10, 2024
7 checks passed
@jenkins-droid
Copy link
Collaborator

Jenkins Linux amd64 Build #14929 [push] Add a tool to generate a... started at 20:50

@jenkins-droid
Copy link
Collaborator

Jenkins Linux ppc64le Build #13959 [push] Add a tool to generate a... started at 22:01

@jenkins-droid
Copy link
Collaborator

Jenkins Linux s390x Build #14934 [push] Add a tool to generate a... started at 21:50

@jenkins-droid
Copy link
Collaborator

Jenkins Linux amd64 Build #14929 [push] Add a tool to generate a... passed after 1 hr 9 min

@jenkins-droid
Copy link
Collaborator

Jenkins Linux s390x Build #14934 [push] Add a tool to generate a... passed after 1 hr 36 min

@jenkins-droid
Copy link
Collaborator

Jenkins Linux ppc64le Build #13959 [push] Add a tool to generate a... passed after 2 hr 4 min

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.

3 participants