Skip to content

fix: wrap overloaded vendor runtime functions#6

Merged
voltjia merged 1 commit into
masterfrom
fix/vendor-runtime-overload-wrappers
Jun 18, 2026
Merged

fix: wrap overloaded vendor runtime functions#6
voltjia merged 1 commit into
masterfrom
fix/vendor-runtime-overload-wrappers

Conversation

@voltjia

@voltjia voltjia commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Wrap MetaX mcMalloc, mcMemcpy, and mcFree in forwarding lambdas before storing them as runtime adapter callables.
  • Wrap Moore musaGetDevice, musaGetDeviceCount, and musaDeviceSynchronize in forwarding lambdas for the same reason.

Motivation

Some vendor runtime APIs are exposed as overloaded function sets. Binding them directly to static constexpr auto is ambiguous for these toolchains, so infinirt fails to compile when MetaX or Moore backends are enabled. The existing NVIDIA/Moore memory wrappers already use forwarding lambdas for this pattern; this applies the same approach to the remaining overloaded calls.

This is a prerequisite for the InfiniOps runtime-shim cleanup in InfiniTensor/InfiniOps#644, where InfiniOps includes the InfiniRT backend runtime wrappers directly.

Validation

  • git diff --check
  • MetaX remote build passed as part of InfiniOps cleanup validation, with this InfiniRT branch synced as INFINI_RT_SOURCE_DIR:
cmake -S . -B build-metax -DWITH_METAX=ON -DCMAKE_BUILD_TYPE=Release \
  -DCMAKE_C_COMPILER=/tmp/infiniops-runtime-cleanup/InfiniOps/scripts/mxcc_wrapper.sh \
  -DCMAKE_CXX_COMPILER=/tmp/infiniops-runtime-cleanup/InfiniOps/scripts/mxcc_wrapper.sh
cmake --build build-metax -j2
  • Moore remote build passed as part of InfiniOps cleanup validation, with this InfiniRT branch synced as INFINI_RT_SOURCE_DIR:
cmake -S . -B build-moore -DWITH_MOORE=ON -DCMAKE_BUILD_TYPE=Release \
  -DCMAKE_C_COMPILER=/workspace/InfiniOps/scripts/mcc_wrapper.sh \
  -DCMAKE_CXX_COMPILER=/workspace/InfiniOps/scripts/mcc_wrapper.sh
cmake --build build-moore -j2

Notes

No public API change. This only disambiguates vendor function bindings in backend runtime adapters.

@voltjia voltjia marked this pull request as ready for review June 17, 2026 14:13
@voltjia voltjia merged commit 8c710bd into master Jun 18, 2026
4 checks passed
@voltjia voltjia deleted the fix/vendor-runtime-overload-wrappers branch June 18, 2026 01:11
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