[BUG] Simple einsum program failed to compile
lucifer1004 opened this issue · comments
The following code could not compile
#include "matx.h"
int main([[maybe_unused]] int argc, [[maybe_unused]] char **argv) {
MATX_ENTER_HANDLER();
auto a = matx::make_tensor<float>({10, 10});
auto b = matx::make_tensor<float>({10, 10});
auto c = matx::make_tensor<float>({10, 10});
auto exec = matx::cudaExecutor();
(c = matx::cutensor::einsum("ik,kl->il", a, b)).run(exec);
matx::print(c);
CUDA_CHECK_LAST_ERROR();
MATX_EXIT_HANDLER();
}
The error message was:
MatX/include/matx/transforms/einsum.h(457): error: class "matx::detail::matxCache_t" may not have a template argument list
static matxCache_t<EinsumParams_t<InT...>, EinsumParamsKeyHash<InT...>, EinsumParamsKeyEq<InT...>> einsum_cache;
It seems that the code for einsum cache has not been updated according to matxCache_t
's API changes.
Thanks! Reproduced when compiling with MATX_EN_CUTENSOR=ON. Secondary bug: compilation succeeds when using MATX_EN_CUTENSOR=OFF, but we should probably throw runtime error if MATX_EN_CUTENSOR=OFF and einsum capability not present.
Note: Example reproducer "ik,kl->il" is a matrix multiply, should have been caught by TYPED_TEST(EinsumTestsFloatNonComplexNonHalfTypes, GEMM).
Fixed by 2c34e34