Skip to content

Conversation

@songgot
Copy link
Contributor

@songgot songgot commented Sep 30, 2025

This commit refactors the monolithic ml_single_open_custom function (200+ lines) into smaller, focused helper functions to improve code readability and maintainability. The main function is now structured as a clear sequence of steps, each handled by a dedicated helper function.

Copy link

@hj210 hj210 left a comment

Choose a reason for hiding this comment

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

This patch refactors a 200+ line function into five smaller functions,
improving readability and maintainability. 👍

Additional recommendations:
a. Avoid the '__' prefix—it’s reserved for system/compiler use.
b. Split _configure_nnfw_tensors by NNFW types to adhere to SRP.

…etter maintainability

This commit refactors the monolithic ml_single_open_custom function (200+ lines)
into smaller, focused helper functions to improve code readability and
maintainability. The main function is now structured as a clear sequence
of steps, each handled by a dedicated helper function.

Signed-off-by: hyunil park <[email protected]>
@songgot songgot force-pushed the Repectoring_open_custom branch from 94e9e4e to 9ed6579 Compare November 5, 2025 04:29
@myungjoo
Copy link
Member

From cursor. (both look legit)

  1. c/src/ml-api-inference-single.c:L1154

_configure_nnfw_tensors()가 info->nnfw만 참조합니다. 그런데 직전에 호출한 _validate_and_determine_nnfw()는 검증 결과를 info->nnfw에 다시 써주지 않아서, 사용자가 ML_NNFW_TYPE_ANY(또는 잘못된 값)을 넘기면 여기 switch가 default로 빠집니다. TensorFlow/NNFW 등에서는 in/out 텐서 메타데이터 설정이 필수인데 이 단계가 생략돼 런타임 오류가 발생합니다. 검증된 nnfw를 info->nnfw에 저장하거나 이 함수가 nnfw 인자를 직접 받아 사용하도록 조정이 필요해 보입니다.

  1. c/src/ml-api-inference-single.c:L1181

framework_name/framework 옵션을 통해 info->fw_name에 값을 넣을 수 있지만, _configure_filter_properties()에서는 항상 fw_name 인자(자동 감지 결과)만 사용합니다. 그래서 사용자가 명시적으로 프레임워크 문자열을 지정해도 더 이상 반영되지 않아 기존 기능이 회귀된 상태입니다. info->fw_name이 존재하면 이를 우선 사용하도록 복원해 주세요.

@songgot
Copy link
Contributor Author

songgot commented Nov 20, 2025

From cursor. (both look legit)

  1. c/src/ml-api-inference-single.c:L1154

_configure_nnfw_tensors()가 info->nnfw만 참조합니다. 그런데 직전에 호출한 _validate_and_determine_nnfw()는 검증 결과를 info->nnfw에 다시 써주지 않아서, 사용자가 ML_NNFW_TYPE_ANY(또는 잘못된 값)을 넘기면 여기 switch가 default로 빠집니다. TensorFlow/NNFW 등에서는 in/out 텐서 메타데이터 설정이 필수인데 이 단계가 생략돼 런타임 오류가 발생합니다. 검증된 nnfw를 info->nnfw에 저장하거나 이 함수가 nnfw 인자를 직접 받아 사용하도록 조정이 필요해 보입니다.

  1. c/src/ml-api-inference-single.c:L1181

framework_name/framework 옵션을 통해 info->fw_name에 값을 넣을 수 있지만, _configure_filter_properties()에서는 항상 fw_name 인자(자동 감지 결과)만 사용합니다. 그래서 사용자가 명시적으로 프레임워크 문자열을 지정해도 더 이상 반영되지 않아 기존 기능이 회귀된 상태입니다. info->fw_name이 존재하면 이를 우선 사용하도록 복원해 주세요.

Thank you for your review.
I will properly revise this PR after completing some minor refactoring.

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.

3 participants