Skip to content

Conversation

@chenyx113
Copy link
Contributor

related issue: #14534
historical full changes: #14613

add functions for json config process

ONE-DCO-1.0-Signed-off-by: Youxin Chen yx113.chen@samsung.com

add functions for json config process

ONE-DCO-1.0-Signed-off-by: Youxin Chen <yx113.chen@samsung.com>
@chenyx113 chenyx113 marked this pull request as ready for review April 11, 2025 09:02
std::ifstream in(json_path, std::ios::binary);
if (!in.is_open())
{
std::cout << "Error opening file\n";
Copy link
Contributor

Choose a reason for hiding this comment

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

below code used this

Suggested change
std::cout << "Error opening file\n";
std::cerr << "Error opening file." << std::endl;

maybe use single convention

if (reader.parse(in, root))
{
// Extract and set the maximum subgraph size from hardware limits
float max_subgraph_size_json = root["hardware_limits"]["max_subgraph_size"].asFloat();
Copy link
Contributor

Choose a reason for hiding this comment

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

Q) what if file has wrong content and there is no such ["hardware_limits"]["max_subgraph_size"] ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, it is a problem that I don't consider such exception cases in this PR, current I suppose there are such contents in the config.json, I will add it in next PR, thank you!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have tested, if there was no such ["hardware_limits"]["max_subgraph_size"], max_subgraph_size_json =0, and no exception happened, thank you

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, thanks for checking.
Without such nodes, having max_subgraph_size_json = 0, can this be correct interpretation of the json file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

for safety using, need to check the existing by using if(root.contains("hardware_limits")), I will add it in future code

Copy link
Contributor

@seanshpark seanshpark left a comment

Choose a reason for hiding this comment

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

LGTM

@seanshpark seanshpark merged commit d4ee48a into Samsung:master Apr 13, 2025
5 checks passed
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