Better handling of constants in -profile-ir#3257
Better handling of constants in -profile-ir#3257AlexandreEichenberger wants to merge 6 commits intoonnx:mainfrom
Conversation
…-all-ops option (default off) Signed-off-by: Alexandre Eichenberger <alexe@us.ibm.com>
|
Can we unify "profileAllOp" and "SkipConstant" into one name? If more op may be affected by this option in future, keep profileAllOp. Otherwise use SkipProfileConstant. |
That is a good point. At this time, when we "profileAllOps", I explicitly add profiling for the constant AND disable removing of empty profiling (namely where was an operation that was profiled, but that operation vanished). When we do not "prodileAllOps", then I don't add profiling for the constant AND remove empty profiling. That is why I have 2 names. But maybe when I don't have the constant, there are not really any empty operations... I can check and let you know. thanks @chentong319 . |
Signed-off-by: Alexandre Eichenberger <alexe@us.ibm.com>
Signed-off-by: Alexandre Eichenberger <alexe@us.ibm.com>
|
Implemented the requested changes, now the option is |
Signed-off-by: Alexandre Eichenberger <alexe@us.ibm.com>
Signed-off-by: Alexandre Eichenberger <alexe@us.ibm.com>
| if (enableConstantOpProfiling) { | ||
| instrumentOps += ",krnl.global"; | ||
| instrumentSignatures += ",krnl.global"; | ||
| } |
There was a problem hiding this comment.
Just curious about why we need to add krnl.global here while this is for profiling onnx ops. I though there were no krnl.global ops at this IR level.
There was a problem hiding this comment.
Let me double check
Right now, when we do profiling of the IR, we get some constants (some are included, some are removed).
With this PR, the default with
-profile-iris to have as few constants in the runtime log as possible.But if the new option
-profile-all-opsis set (default off), then the profiling attempts to profile all constants, as well as the ops that may have been removed (by optimizations).This allow us to get an idea of the memory pressure due to constants, for example by compiling with
-profile-ir=ZHigh -profile-all-opsand log the output to a file.Then this command will show all of the constants in the model
where it lists all of the different shapes, and indicates how many of each of the shapes are present.