When InfiniTensor compiling with WITH_METAX=1, the build fails with:
error: unable to deduce 'const auto' from 'mcMalloc'
This occurs in src/cuda/metax/runtime_.h when the header is included by source files
compiled with g++ (not mxcc).
Root Cause
The current implementation directly assigns function pointers:
static constexpr auto Malloc = mcMalloc;
This causes type deduction issues when the header is included in files compiled
by the standard host compiler (g++), as it cannot properly deduce the function
pointer type in this context.
Expected Behavior
Compare with src/cuda/moore/runtime_.h, which uses lambda wrappers:
static constexpr auto Malloc = [](auto&&... args) {
return musaMalloc(std::forward<decltype(args)>(args)...);
};
This approach avoids the type deduction problem since the lambda's type is
directly generated by the compiler.
Suggested Fix
Replace direct function pointer assignments with lambda wrappers for consistency
with the Moore backend implementation.
When InfiniTensor compiling with
WITH_METAX=1, the build fails with:error: unable to deduce 'const auto' from 'mcMalloc'
This occurs in
src/cuda/metax/runtime_.hwhen the header is included by source filescompiled with g++ (not mxcc).
Root Cause
The current implementation directly assigns function pointers:
This causes type deduction issues when the header is included in files compiled
by the standard host compiler (g++), as it cannot properly deduce the function
pointer type in this context.
Expected Behavior
Compare with src/cuda/moore/runtime_.h, which uses lambda wrappers:
This approach avoids the type deduction problem since the lambda's type is
directly generated by the compiler.
Suggested Fix
Replace direct function pointer assignments with lambda wrappers for consistency
with the Moore backend implementation.