fix: wrap overloaded vendor runtime functions#6
Merged
Conversation
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
mcMalloc,mcMemcpy, andmcFreein forwarding lambdas before storing them as runtime adapter callables.musaGetDevice,musaGetDeviceCount, andmusaDeviceSynchronizein forwarding lambdas for the same reason.Motivation
Some vendor runtime APIs are exposed as overloaded function sets. Binding them directly to
static constexpr autois ambiguous for these toolchains, soinfinirtfails 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 --checkINFINI_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 -j2INFINI_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 -j2Notes
No public API change. This only disambiguates vendor function bindings in backend runtime adapters.