-
Notifications
You must be signed in to change notification settings - Fork 82
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
[ONNX] add onnx proto & meson setting #2891
base: main
Are you sure you want to change the base?
Conversation
i'll check the doxygen issue (that compiled-onnx-schema script is automatically generated by the protocol buffer compiler with onnx schema file) |
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.
I have a question about the onnx proto.
Isn't the proto already defined for onnx format? What about adding proto file (not pb.cc & pb.h) and using it by compilation?
For external file : i think we don't need consider doxygen |
If onnx.pb.cc/h files are generated by protoc, add a onnx.proto file and let meson script generate .cc/.h files from it. Or is there a reason you cannot generate files in the build scripts? Reference: nnstreamer/nnstreamer@ff5c1fd |
@EunjuYang @myungjoo Actually, I just didn't want to make a dependency on protoc..! |
@DonghakPark Thank you for your detailed guide!! |
Having auto-generated files commited in a git repo is not recommended. It is like having .so file in the git repo where you can compile that .so file easily from available open source codes. You already have a dependency to protobuf-devel. Adding protoc dependency shouldn't be a problem.
For Tizen:
For Android, unfortunately, you may need to touch a few more scripts. (I guess this is why you added the auto-generated files.) But you don't have any dependency issue for this; you just need to enforce developers to install a proper protobuf-compiler here. |
compiler_sources += [ | ||
'onnx.pb.cc', | ||
] | ||
endif |
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.
You need a script to generate onnx.pb.cc around here.
Hints:
# Protobuf compiler
pb_comp = find_program('protoc', required: get_option('protobuf-support'))
if protobuf_support_is_available
pb_gen = generator(pb_comp,
output: ['@BASENAME@.pb.h', '@BASENAME@.pb.cc'],
arguments : [
'--proto_path=@CURRENT_SOURCE_DIR@/include',
'--cpp_out=@BUILD_DIR@',
'@INPUT@'
]
)
pb_gen_src = pb_gen.process('./include/nnstreamer.proto')
endif
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.
@myungjoo I haven't finished editing yet, but I accidentally pushed while working out of habit.
I'll refer to the code you provided, make the necessary changes, and push again. Thanks a lot!
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.
protobuf_dep = dependency('protobuf', required: true)
nntrainer_base_deps += protobuf_dep
protoc = find_program('protoc', required: true)
pb_gen = generator(
protoc,
output: ['@BASENAME@.pb.cc', '@BASENAME@.pb.h'],
arguments: ['--cpp_out=@BUILD_DIR@', '-I=@CURRENT_SOURCE_DIR@', '@INPUT@'],
)
pb_gen_src = pb_gen.process('onnx.proto')
// + shared_library setting using pb_gen_src
@myungjoo I referred to the given code and tried to use the generator
as shown above, and I think this method is more appropriate for this purpose. However, since the same meson script uses custom_target
instead of generator
for FlatBuffer and TFLite, I uploaded the code using custom_target
to unify the code within the same script. How about updating all parts to use generator
instead of custom_target
at a later time(when I have some spare time)?
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.
Yup. As long as you now have .proto file to generate .pb.cc/h automatically, it's all good.
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.
LGTM! Thank you for reflecting the opinion 👍
We do have tflite scheme file (fb) in compiler directory as well. I recommend to make scheme dir and put those in the same dir for better managing. |
@jijoongmoon Thank you for your feedback. then I'll make a new commit for making a new directory and put those schema files(onnx, tflite, nntrainer schema) in the same directory! |
- add onnx proto & compile it using meson protoc - add "enable-onnx-interpreter" meson option. I'll upload a separate pr for the onnx interpreter script. **Self evaluation:** Build test: [x]Passed [ ]Failed [ ]Skipped Run test: [x]Passed [ ]Failed [ ]Skipped Signed-off-by: Seungbaek Hong <sb92.hong@samsung.com>
I'll upload a separate pr for the onnx interpreter script.
Self evaluation:
Build test: [x]Passed [ ]Failed [ ]Skipped
Run test: [x]Passed [ ]Failed [ ]Skipped
Signed-off-by: Seungbaek Hong sb92.hong@samsung.com