Skip to content

Fix: Honor ChipCallable orchestration symbols in runtime dlsym#554

Open
yanghaoran29 wants to merge 1 commit intohw-native-sys:mainfrom
yanghaoran29:fix-hard-dlsym
Open

Fix: Honor ChipCallable orchestration symbols in runtime dlsym#554
yanghaoran29 wants to merge 1 commit intohw-native-sys:mainfrom
yanghaoran29:fix-hard-dlsym

Conversation

@yanghaoran29
Copy link
Copy Markdown
Contributor

Resolve device orchestration entry/config symbols from ChipCallable metadata with safe defaults and keep config lookup optional, while plumbing config_name through callable/runtime/bindings and Python build paths for backward-compatible behavior.

@yanghaoran29
Copy link
Copy Markdown
Contributor Author

Issue #549 Analysis: Runtime Hardcodes Orchestration Symbol Names

Issue Description

In the tensormap_and_ringbuffer runtime path, the AICPU executor performs dlsym using hardcoded symbol names:

  • aicpu_orchestration_entry
  • aicpu_orchestration_config

However, the function names in the orchestration configuration are written to ChipCallable (func_name / config_name) and passed to the runtime.
This results in an inconsistency of "configurable in settings but unused in behavior": when the exported symbols differ from the hardcoded names, the runtime will fail during the dlsym phase.

Problems with the Previous Code Implementation

  1. aicpu_executor.cpp for a2a3/a5 uses fixed string constants for dlsym and ignores ChipCallable metadata.
  2. function_name does not take effect in this path, which easily misleads developers and test cases.
  3. The config symbol lacks configurability and cannot be customized per scenario.
  4. The contracts for entry names and config names are inconsistent, posing high risks for future evolution (renaming symbols).

Modification Solution

  1. Extend ChipCallable to add the config_name field and its getter.
  2. Write func_name/config_name to Runtime during the init_runtime_impl(...) phase.
  3. Modify the AICPU executor to use dynamic resolution:
    • Entry symbol: entry_name = runtime->get_device_orch_func_name(); fall back to aicpu_orchestration_entry if empty
    • Config symbol: config_name = runtime->get_device_orch_config_name(); fall back to aicpu_orchestration_config if empty
  4. Maintain optional semantics for the config symbol: failure of dlsym(config_name) only triggers a warning and continues execution.
  5. The Python build entry passes through the optional config_name without breaking old configuration files (default empty string).

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces support for configurable orchestration entry and configuration function names across the runtime and Python bindings. It updates the Callable struct and Runtime classes to store these names, enabling the AicpuExecutor to dynamically resolve symbols via dlsym rather than using hardcoded defaults. Feedback was provided regarding the memory layout of the Callable struct, noting that inserting fields in the middle breaks binary compatibility for serialized artifacts.

@yanghaoran29 yanghaoran29 force-pushed the fix-hard-dlsym branch 3 times, most recently from 7ae75a4 to 5c2ab9f Compare April 14, 2026 13:42
Resolve device orchestration entry/config symbols from ChipCallable metadata with safe defaults and keep config lookup optional, while plumbing config_name through callable/runtime/bindings and Python build paths for backward-compatible behavior.
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.

1 participant