Add: OrchestrationRuntime vtable for host_build_graph, decouple orch from runtime.h#449
Merged
ChaoWao merged 1 commit intohw-native-sys:mainfrom Apr 3, 2026
Merged
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the loading of orchestration shared objects across the a2a3 and a5 platforms by introducing a platform-specific load_orch_so function. The changes unify temporary file creation and loading logic, ensuring files are unlinked immediately after use. Feedback includes suggestions to improve the robustness of the onboard implementation by using mkstemp and a complete write loop, restoring dlerror() in error logs for better observability, and removing now-redundant member variables and cleanup logic related to the SO file path.
src/a2a3/runtime/tensormap_and_ringbuffer/aicpu/aicpu_executor.cpp
Outdated
Show resolved
Hide resolved
1 task
97347cf to
d8c323f
Compare
d8c323f to
b8bc117
Compare
…from runtime.h Introduce an opaque OrchestrationRuntime + function-pointer table (orchestration_api.h) so host_build_graph orchestration SOs no longer include runtime.h. Orchestration sources include only orchestration_api.h and interact with the runtime through free-function wrappers. - orchestration_api.h (a2a3 + a5): C-compatible vtable with inline helpers add_task, add_successor, record_tensor_pair, device_malloc, device_free, copy_to_device, get_task_count, print_runtime - runtime_maker.cpp: wraps Runtime* in OrchestrationRuntimeImpl, calls orch function as OrchestrationFunc(OrchestrationRuntime*, orch_args); SO loading delegated to platform via extern-C load_orch_so (sim: mkstemp, onboard: getpid path) implemented in pto_runtime_c_api.cpp - build_config.py (a2a3 + a5): add orchestration compile target with include_dirs so kernel_compiler resolves orchestration_api.h - All host_build_graph example orchestration sources (bgemm, matmul, paged_attention, vector_example for a2a3 + a5) migrated to new API - tests/st host_build_graph paged_attention orchestration migrated - Docs updated (INCORE_ORCHESTRATION_GUIDE.md, RUNTIME_LOGIC.md, scripts/README.md, code_runner.py) Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
b8bc117 to
ae1544f
Compare
ChaoWao
approved these changes
Apr 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Introduce an opaque
OrchestrationRuntime+ function-pointer table (orchestration_api.h) sohost_build_graphorchestration SOs no longer includeruntime.h. Orchestration sources now include onlyorchestration_api.hand interact with the runtime through stable free-function wrappers.orchestration_api.h(a2a3 + a5): C-compatible vtable withstatic inlinehelpers —add_task,add_successor,record_tensor_pair,device_malloc,device_free,copy_to_device,get_task_count,print_runtimeruntime_maker.cpp(a2a3 + a5): wrapsRuntime*inOrchestrationRuntimeImpl, calls orchestration function asOrchestrationFunc(OrchestrationRuntime*, orch_args); SO loading delegated to platform viaextern "C" load_orch_so(sim: mkstemp; onboard: getpid path), implemented inpto_runtime_c_api.cppbuild_config.py(a2a3 + a5): addorchestrationcompile target sokernel_compilerresolvesorchestration_api.htests/sthost_build_graph paged_attention orchestration migratedTesting
python ci.py -p a2a3sim -c 6622890 -t 600 --build-runtime— 15/15 PASS