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

[onert/api] Introduce nnfw_compile and nnfw_set_compiled_model_path APIs #12583

Merged
merged 2 commits into from
Feb 5, 2024

Conversation

jyoungyun
Copy link
Contributor

This commit introduces nnfw_compile and nnfw_set_compiled_model_path.
It contains a detailed description of these APIs in the header file.

ONE-DCO-1.0-Signed-off-by: Jiyoung Yun jy910.yun@samsung.com
Co-authored-by: Sanggyu Lee sg5.lee@samsung.com

Related issue : #12505
Draft PR: #12504

This commit introduces nnfw_compile and nnfw_set_compiled_model_path.
It contains a detailed description of these APIs in the header file.

ONE-DCO-1.0-Signed-off-by: Jiyoung Yun <jy910.yun@samsung.com>
Co-authored-by: Sanggyu Lee <sg5.lee@samsung.com>
@jyoungyun jyoungyun requested a review from a team February 1, 2024 02:39
@jyoungyun jyoungyun added the PR/ready for review It is ready to review. Please review it. label Feb 1, 2024
@glistening
Copy link
Contributor

@jyoungyun I am not sure nnfw_compile and nnfw_set_compiled_model_path are clear.

Internally when @chunseoklee / @hseok-oh and I wrote codegen (q-circle → binary for npu), it was the 1st and the only one which transform something to another. But as quantizer is introduced later, I would like to use compile as broader meaning.

That is, in my mind, compile is the term for the whole end-to-end path like on-deivce compiler.

f-circle --(quantize)--> q-circle --(codegen)--> binary
`--------------------compile------------------------'

Thus, I would like to use nnfw_codegen and nnfw_set_codegen_path at this moment.

I would like to hear other's opinion.

Also, after we used nnfw_compile, we developed on-device training, and it has nnfw_train prefix for all training-realted APIs. Will use introduce another prefix? Or go w/o prefix?
Will we introduce another prefix? Or name w/o prefix?

YongseopKim
YongseopKim previously approved these changes Feb 1, 2024
Copy link
Contributor

@YongseopKim YongseopKim left a comment

Choose a reason for hiding this comment

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

LGTM but code about codegen can be revised soon(or in the future).

  • I discussed it with @jyoungyun and heard that almost code has been written before.
  • That's why LGTM with some comment.

}

assert(_codegen_manager != nullptr);
_codegen_manager->exportModelPath(std::string(path));
Copy link
Contributor

Choose a reason for hiding this comment

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

This is just setter for _export_model_path, right? This is really confusing... In the future, this should be fixed, I think.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@YongseopKim Thank you for your comment. :) Can I ask what you want to fix?

Copy link
Contributor

Choose a reason for hiding this comment

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

(Above all, I don't say that this should be done right now. This is one of points to revise in the future.)

I talked to the name exportModelPath().

_codegen_manager->exportModelPath(std::string(path));

export is a verb word so the method can be translated to 'the manager exports with the model path and returns a something to be export'.

That's why I'm saying to fix it. 😄

}

assert(_codegen_manager != nullptr);
auto export_model_path = _codegen_manager->exportModelPath();
Copy link
Contributor

Choose a reason for hiding this comment

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

This is just getter for _export_model_path.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is not calculating(manipulating) path for model.

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's revise this for sure in the future!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@YongseopKim

This is not calculating(manipulating) path for model.

I'm sorry but I couldn't catch your intention. Could you explain that in some detail?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto

auto export_model_path = _codegen_manager->exportModelPath();
// If the export_model_path is not set, it generates a compiled model path
// automatically.
if (export_model_path.empty())
Copy link
Contributor

Choose a reason for hiding this comment

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

These code(Set the proper model path with some vars) can be in CodegenManger.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@YongseopKim I agree to implement this function in CodegenManager. I will update it in another PR. :)

@hseok-oh
Copy link
Contributor

hseok-oh commented Feb 1, 2024

Thus, I would like to use nnfw_codegen and nnfw_set_codegen_path at this moment.

I would like to hear other's opinion.

I have similar opinion with @glistening. Additionally, compile make confusion with runtime core's Compiler class.

glistening
glistening previously approved these changes Feb 1, 2024
Copy link
Contributor

@glistening glistening left a comment

Choose a reason for hiding this comment

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

LGTM. Let's revise later. The APIs are in nnfw_experimental.h. We may change it.

@jyoungyun jyoungyun added PR/NO MERGE Please don't merge. I'm still working on this :) and removed PR/ready for review It is ready to review. Please review it. labels Feb 1, 2024
@jyoungyun
Copy link
Contributor Author

@glistening @hseok-oh

Thus, I would like to use nnfw_codegen and nnfw_set_codegen_path at this moment.

I would like to hear other's opinion.

I have similar opinion with @glistening. Additionally, compile make confusion with runtime core's Compiler class.

I agreed with your opinion. I also thought this api name is not suitable for Codegen feature.
#12504 (comment)

If everyone agrees to modify this function to use codegen string rather than compile, I'd like to modify in this PR.
Do you agree to use codegen string instead of compile for API name?

@hseok-oh
Copy link
Contributor

hseok-oh commented Feb 1, 2024

I agreed with your opinion. I also thought this api name is not suitable for Codegen feature. #12504 (comment)

If everyone agrees to modify this function to use codegen string rather than compile, I'd like to modify in this PR. Do you agree to use codegen string instead of compile for API name?

Agree

@YongseopKim
Copy link
Contributor

Agree

@glistening
Copy link
Contributor

Agree. codegen is better than compile. Though I am still not sure, but it is okay since it is under experimental.

ONE-DCO-1.0-Signed-off-by: Jiyoung Yun <jy910.yun@samsung.com>
@jyoungyun jyoungyun dismissed stale reviews from glistening and YongseopKim via 830fb35 February 1, 2024 09:09
@jyoungyun jyoungyun added PR/ready for review It is ready to review. Please review it. and removed PR/NO MERGE Please don't merge. I'm still working on this :) labels Feb 1, 2024
@jyoungyun
Copy link
Contributor Author

jyoungyun commented Feb 1, 2024

If you want to update this PR's title, please let me know. Currently, I just added a new commit for this change.

Copy link
Contributor

@YongseopKim YongseopKim left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@jyoungyun
Copy link
Contributor Author

@glistening PTAL

@jyoungyun
Copy link
Contributor Author

@glistening PTAL, again.

Copy link
Contributor

@glistening glistening left a comment

Choose a reason for hiding this comment

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

LGTM

@glistening
Copy link
Contributor

glistening commented Feb 5, 2024

@jyoungyun Could you update (or May I edit) the commit title as the function names are changed? It may be better to update by myself, since it already has 2 approvals.

@hseok-oh hseok-oh merged commit 356901d into Samsung:master Feb 5, 2024
9 checks passed
@hseok-oh
Copy link
Contributor

hseok-oh commented Feb 5, 2024

I've updated title and commit.

@jyoungyun jyoungyun deleted the onert/introduce_nnfw_compile branch February 6, 2024 06:02
jyoungyun added a commit to jyoungyun/ONE that referenced this pull request Feb 6, 2024
This commit implements codegen function in onert_run.
As discussed below, the `compile` string of functions and variables
has been changed to `codegen`.
Samsung#12583 (comment)

ONE-DCO-1.0-Signed-off-by: Jiyoung Yun <jy910.yun@samsung.com>
glistening pushed a commit that referenced this pull request Feb 7, 2024
This commit implements codegen function in onert_run.
As discussed below, the `compile` string of functions and variables
has been changed to `codegen`.
#12583 (comment)

ONE-DCO-1.0-Signed-off-by: Jiyoung Yun <jy910.yun@samsung.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR/ready for review It is ready to review. Please review it.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants