Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Simple einsum program failed to compile #597

Closed
lucifer1004 opened this issue Mar 16, 2024 · 4 comments · Fixed by #599
Closed

[BUG] Simple einsum program failed to compile #597

lucifer1004 opened this issue Mar 16, 2024 · 4 comments · Fixed by #599

Comments

@lucifer1004
Copy link
Contributor

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;
@lucifer1004
Copy link
Contributor Author

It seems that the code for einsum cache has not been updated according to matxCache_t's API changes.

@tmartin-gh
Copy link
Collaborator

tmartin-gh commented Mar 22, 2024

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.

tmartin-gh added a commit to tmartin-gh/MatX that referenced this issue Mar 22, 2024
@tmartin-gh
Copy link
Collaborator

Note: Example reproducer "ik,kl->il" is a matrix multiply, should have been caught by TYPED_TEST(EinsumTestsFloatNonComplexNonHalfTypes, GEMM).

tmartin-gh added a commit to tmartin-gh/MatX that referenced this issue Mar 23, 2024
cliffburdick pushed a commit that referenced this issue Mar 24, 2024
* Rework einsum for new cache style.  Fix for issue #597

* Rework MatX cache to use CacheId instead of CacheName.

* Switch from GetCacheIdFromFunction to GetCacheIdFromType
@cliffburdick
Copy link
Collaborator

Fixed by 2c34e34

@tmartin-gh tmartin-gh linked a pull request Apr 4, 2024 that will close this issue
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 a pull request may close this issue.

3 participants