[After #607][api/single] Support executorch-llama - #574
Conversation
|
📝 TAOS-CI Version: 1.5.20200925. Thank you for submitting PR #574. Please a submit 1commit/1PR (one commit per one PR) policy to get comments quickly from reviewers. Your PR must pass all verificiation processes of cibot before starting a review process from reviewers. If you are new member to join this project, please read manuals in documentation folder and wiki page. In order to monitor a progress status of your PR in more detail, visit http://ci.nnstreamer.ai/. |
83c9879 to
ed9a143
Compare
| ml_tensors_info_set_tensor_type (in_info, 0, ML_TENSOR_TYPE_UINT8); | ||
| ml_tensors_info_set_tensor_dimension (in_info, 0, dim); | ||
|
|
||
| ml_tensors_data_create (in_info, &in_data); |
There was a problem hiding this comment.
How about checking if in_data is created properly?
status = ml_tensors_data_create (in_info, &in_data);
EXPECT_EQ (status, ML_ERROR_NONE);
| ml_tensors_info_set_tensor_dimension (in_info, 0, dim); | ||
|
|
||
| ml_tensors_data_create (in_info, &in_data); | ||
| ml_tensors_data_set_tensor_data (in_data, 0, prompt.c_str (), prompt.size () + 1); |
There was a problem hiding this comment.
Let's check the result, how about you?
EXPECT_EQ (status, ML_ERROR_NONE);
| goto error; | ||
| } | ||
| /* handle flexible single */ | ||
| if (info->nnfw == ML_NNFW_TYPE_EXECUTORCH_LLAMA) { |
There was a problem hiding this comment.
I think if there are more flexible filter, we may revise this part later.
The llama2c filter I created doesn't seem to be scalable due to API limitations, so I won't add it now.
| ML_NNFW_TYPE_NCNN = 18, /**< Tencent ncnn (Since 9.0) */ | ||
| ML_NNFW_TYPE_TENSORRT = 19, /**< NVidia Tensor-RT (Since 9.0) */ | ||
| ML_NNFW_TYPE_QNN = 20, /**< Qualcomm QNN (Qualcomm® AI Engine Direct) (Since 9.0) */ | ||
| ML_NNFW_TYPE_EXECUTORCH_LLAMA = 21, /**< ExecuTorch Llama runner */ |
|
Please do not merge this until tizen gbm release is done! |
- Let single API handle flexible filter. Signed-off-by: Yongjoo Ahn <yongjoo1.ahn@samsung.com>
- Add a enum for new nnfw `EXECUTORCH_LLAMA` Signed-off-by: Yongjoo Ahn <yongjoo1.ahn@samsung.com>
ed9a143 to
8f8b2e4
Compare
- Let single API handle executorch-llama as flexible filter thus do invoke-dynamic. Signed-off-by: Yongjoo Ahn <yongjoo1.ahn@samsung.com>
- Add a simple test to show how to use executorch-llama with single api Signed-off-by: Yongjoo Ahn <yongjoo1.ahn@samsung.com>
8f8b2e4 to
cd1847b
Compare
myungjoo-bot
left a comment
There was a problem hiding this comment.
Automated review of this draft (transcribed from an AI review agent's report; please verify before acting).
Summary: The PR (4 commits, +72 lines, all DCO-signed) lets the single API handle a flexible-format filter, adds ML_NNFW_TYPE_EXECUTORCH_LLAMA, and adds a disabled sample test. Commit 1 (1674c69) is byte-for-byte the content of #607, merged 2025-07-24, so it is already on main; main subsequently reworked that code in #635 (08032dc, d14a4c8) into a generic single_h->invoke_dynamic flag driven by ml_single_preset.invoke_dynamic / ml_single_open_with_option ("invoke_dynamic", "true"). So the flexible-handling part is fully superseded, and the enum value collides with ML_NNFW_TYPE_LLAMACPP = 21 (Since 10.0) added in 28b5dfb — which is why GitHub reports CONFLICTING (2 files, 3 hunks). The nnstreamer-side executorch-llama subplugin does exist (ext/nnstreamer/tensor_filter/tensor_filter_executorch_llama.cc, still present), but executorch_support is 0 in every Tizen profile of nnstreamer.spec. What remains genuinely new is ~4 lines: the enum entry (renumbered), the ml_nnfw_subplugin_name[] entry, and the _ml_validate_model_file case; the test should be rewritten against ml_single_open_with_option + invoke_dynamic.
- [High] Enum value collision / ABI —
c/include/ml-api-common.h:78(PR):ML_NNFW_TYPE_EXECUTORCH_LLAMA = 21.mainalready hasLLAMACPP = 21andTIZEN_HAL = 22(Since 10.0). Merging as-is would silently alias two frameworks. Fix: rebase, assign= 23afterTIZEN_HAL, add(Since 11.0)(or the next release) to the Doxygen, and file the Tizen ACR as in28b5dfb. - [High] Superseded implementation / merge conflict —
c/src/ml-api-inference-single.c:141, 783-786, 856, 956, 1095-1103, 1340-1343(PR): the wholeis_flexiblemachinery (struct field,ml_single_set_info_in_handleoverride,_ml_single_invoke_validate_dataskip,g_object_set (filter_obj, "invoke-dynamic", TRUE)) duplicates what #607 merged and #635 refactored intosingle_h->invoke_dynamic(mainlines 144, 749-757, 1106, 1181, 1455). Conflicting hunks: the enum tail, the subplugin-name table, and the validate-datacontinueblock. Fix: drop commit 1 and the single.c portion of commit 3; keep only the name-table entry and the_ml_validate_model_filecase. - [Medium] Design mismatch with
main's opt-in flexible mode —:1095-1103forces dynamic invoke by nnfw type.maindeliberately keepsinvoke_dynamican explicit preset/option (nnstreamer-tizen-internal.h:51), andLLAMACPPdoes not auto-enable it. If executorch-llama must always be dynamic, that should be discussed with the #635 authors and applied symmetrically, not hard-coded for one type. Also the PR unconditionally setsgst_info.num_tensors = 1U, whereasmainonly does so when the filter reports 0. - [Medium] Test uses the wrong API and has UB paths —
tests/capi/unittest_capi_inference_single.cc:3186-3225(PR): usesml_single_open(cannot request dynamic mode onmain);out_dataandresultare uninitialized yet used inml_tensors_data_destroy/strncmp/g_infowhen earlierEXPECT_EQs fail;g_info ("%s", result)assumes NUL-termination;strncmp (result, prompt, ...)assumes the LLM echoes the prompt. Typotokienizer. TheDISABLED_prefix and@briefare fine. Fix: rewrite following the llama.cpp pattern inunittest_capi_service_extension.cc:407-532(#if defined(ENABLE_...), skip-if-model-missing macro,invoke_dynamicoption), initialize pointers to NULL, guard cleanup. - [Low] Doxygen / ACR completeness —
ml-api-common.h:78:/**< ExecuTorch Llama runner */lacks the(Since X.0)marker every other entry carries; commit message and PR body do not mention the ACR. - [Low] Tizen packaging reality — nnstreamer's spec sets
%define executorch_support 0in all profiles, so the subplugin is never shipped on Tizen today. Adding a Tizen public enum for a subplugin that cannot be loaded there is premature; either gate it like the Android-onlySNAPor land it together with enabling executorch in the Tizen spec. - [Low] Process — 4 commits with one already merged separately; marked
[After #607]but never rebased after #607 merged; no CI results on the branch. Last maintainer comment (2025-03-18) asked to hold until the Tizen GBM release.
No back-door or suspicious behavior found.
EXECUTORCH_LLAMA