Skip to content

[ml service] Support flexible tensors for compatibility with filters like llama.cpp - #635

Merged
jaeyun-jung merged 1 commit into
nnstreamer:mainfrom
songgot:dev_support_flexible_filter
Jul 31, 2025
Merged

[ml service] Support flexible tensors for compatibility with filters like llama.cpp#635
jaeyun-jung merged 1 commit into
nnstreamer:mainfrom
songgot:dev_support_flexible_filter

Conversation

@songgot

@songgot songgot commented Jun 20, 2025

Copy link
Copy Markdown
Contributor
  • Refactor tensor allocation logic to support flexible tensor
  • Enable compatibility with filters such as llama.cpp by allowing dynamic tensor management

@songgot
songgot marked this pull request as draft June 20, 2025 05:43
@songgot
songgot force-pushed the dev_support_flexible_filter branch 4 times, most recently from d2911a9 to 0fe78c0 Compare June 23, 2025 04:51
@songgot
songgot marked this pull request as ready for review June 23, 2025 09:01
@songgot
songgot force-pushed the dev_support_flexible_filter branch 3 times, most recently from 46df6bc to 6fdc295 Compare June 24, 2025 00:10
@anyj0527

Copy link
Copy Markdown
Member

Please rebase the branch c/src/ml-api-inference-single.c is updated in the recent PR merge.

@myungjoo

Copy link
Copy Markdown
Member

Need a smaller unit test case. We execute all unit test cases for every PR, SR, build, ,..

@songgot
songgot force-pushed the dev_support_flexible_filter branch from 6fdc295 to 0d952a8 Compare July 25, 2025 01:40
@songgot

songgot commented Jul 25, 2025

Copy link
Copy Markdown
Contributor Author

Please rebase the branch c/src/ml-api-inference-single.c is updated in the recent PR merge.

Thank you. Rebase is completed.
For extensibility, we used format instead of is_flexible.

@songgot

songgot commented Jul 25, 2025

Copy link
Copy Markdown
Contributor Author

Need a smaller unit test case. We execute all unit test cases for every PR, SR, build, ,..
scenarioConfigLlamacpp TC is included in unittest_capi_service_extension.c
Generating TCs based on logic changes seems difficult.
Thank you.

Comment thread tests/capi/unittest_capi_service_extension.cc Outdated
@songgot
songgot force-pushed the dev_support_flexible_filter branch from 0d952a8 to 40e1488 Compare July 29, 2025 07:51

@anyj0527 anyj0527 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM👍 However there is a concern related with syncing nnstreamer to the tizen-unified. You may proceed the SR process of reflecting latest nnstreamer into the Tizen.

Comment thread c/src/ml-api-inference-single.c Outdated
@songgot
songgot force-pushed the dev_support_flexible_filter branch from 40e1488 to c5abc2f Compare July 30, 2025 00:01
Comment thread c/src/ml-api-common.c Outdated
Comment thread c/src/ml-api-common.c Outdated
Comment thread c/src/ml-api-common.c Outdated
Comment thread c/src/ml-api-common.c Outdated
Comment thread c/src/ml-api-common.c Outdated
Comment thread c/src/ml-api-common.c Outdated
Comment thread c/src/ml-api-common.c
Comment thread c/src/ml-api-common.c Outdated
g_free (hw_name);

if (info->invoke_dynamic)
single_h->format = _NNS_TENSOR_FORMAT_FLEXIBLE;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

well, should we keep current format here?
How about updating information in single instance as flexible?

// updating below information as flexible
GstTensorsInfo in_info;
GstTensorsInfo out_info; 

@songgot songgot Jul 30, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Currently updating within the sub-plugin. We need to fix all sub-plugins. Is it a necessary discussion?

executorch_llama_subplugin::getModelInfo (
    model_info_ops ops, GstTensorsInfo &in_info, GstTensorsInfo &out_info)
{
  if (ops == GET_IN_OUT_INFO) {
    in_info.num_tensors = 1;
    in_info.format = _NNS_TENSOR_FORMAT_FLEXIBLE;

    out_info.num_tensors = 1;
    out_info.format = _NNS_TENSOR_FORMAT_FLEXIBLE;

    return 0;
  }

  return -ENOENT;
}

Comment thread tests/capi/unittest_capi_service_extension.cc Outdated
@songgot
songgot force-pushed the dev_support_flexible_filter branch 2 times, most recently from 6d101e2 to 3e012c5 Compare July 30, 2025 09:22
Comment thread tests/capi/unittest_capi_service_extension.cc Outdated
Comment thread c/src/ml-api-common.c Outdated
…like llama.cpp

- Refactor tensor allocation logic to support flexible tensor
- Enable compatibility with filters such as llama.cpp by allowing dynamic tensor management

Signed-off-by: hyunil park <hyunil46.park@samsung.com>
@songgot
songgot force-pushed the dev_support_flexible_filter branch from 3e012c5 to 9583757 Compare July 30, 2025 23:28
@jaeyun-jung
jaeyun-jung merged commit 08032dc into nnstreamer:main Jul 31, 2025
11 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.

4 participants