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

Use json lib to organize type shape during profiling #10974

Closed
wants to merge 6 commits into from

Conversation

RandySheriffH
Copy link
Contributor

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.

@@ -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"
Copy link
Contributor

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.

Copy link
Contributor Author

@RandySheriffH RandySheriffH Mar 22, 2022

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?

Copy link
Contributor

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:

#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"

Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Contributor Author

@RandySheriffH RandySheriffH Mar 22, 2022

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.

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

Successfully merging this pull request may close these issues.

2 participants