-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Use json lib to organize type shape during profiling #10974
Conversation
@@ -14,6 +14,7 @@ | |||
#include "core/framework/session_state.h" | |||
#include "core/framework/op_kernel_context_internal.h" | |||
#include "core/framework/utils.h" | |||
#include "nlohmann/json.hpp" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just remembered that this will increase the binary size unconditionally. How much is the increase (please use the rel branch to calculate before and after)? If the increase is significant, may be for this release we can fix the issue without using this lib.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the lib is already introduced by session.lib, the dependency we added here actually reuse the binary no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The inclusion is protected by a macro:
onnxruntime/onnxruntime/core/session/inference_session_utils.h
Lines 8 to 16 in c716b56
#if !defined(ORT_MINIMAL_BUILD) | |
// | |
// Includes to parse json session config from onnx model file | |
// | |
#include "core/graph/onnx_protobuf.h" | |
#include "core/session/inference_session.h" | |
#include "core/framework/session_options.h" | |
#include "core/common/common.h" | |
#include "nlohmann/json.hpp" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be we should exclude it from minimal build as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't disable the whole profiling feature for minimal builds.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, we just skip type and shape details.
Solve an issue when composing input/output type and shape in json format.
The root cause of the issue is that when an op has tensor sequence or sparse tensor as input, the calculation of the number of inputs is wrong, which resulted in an extra comma appended to the end of a json array.
To solve the problem, we switch to a json lib for data organization and serialization.