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

Row Major gemm for complex double throws oneapi::math::unimplemented #638

Closed
LukeTheWalker opened this issue Feb 26, 2025 · 3 comments
Closed

Comments

@LukeTheWalker
Copy link

LukeTheWalker commented Feb 26, 2025

Summary

I'm trying to use the library for a simple example, I'd like to use the row_major interface, already tried the column major one and it works as expected-

Version

Latest commit is:
Commit af66e5e

Environment

oneMath works with multiple HW and backend libraries and also depends on the
compiler and build environment. Include
the following information to help reproduce the issue:

  • NVIDIA A100
  • CUDA 12.4
  • RedHat
  • icpx 2025.0.4

Steps to reproduce

cpx A[4] = {1, 2, 3, 4};
cpx B[4] = {5, 6, 7, 8};
cpx C[4] = {0};

sycl::buffer<cpx> buf_A(A, sycl::range<1>(size * size));
sycl::buffer<cpx> buf_B(B, sycl::range<1>(size * size));
sycl::buffer<cpx> buf_C(C, sycl::range<1>(size * size));

oneapi::math::blas::row_major::gemm(queue_, 
            oneapi::math::transpose::nontrans,  oneapi::math::transpose::nontrans,
            size, size, size, 
            cpx(1.0, 0), buf_A, size, buf_B, size, cpx(0.0, 0.0), buf_C, size);

Observed behavior

When I run the code I get:

terminate called after throwing an instance of 'oneapi::math::unimplemented'
  what():  oneMath: blas/gemm: function is not implemented for row_major layout

Expected behavior

I would expect this to just work as it is a quite standard blas routine and to me it seems to not be advertised anywhere that it should not work so I assume it is actually an issue

@LukeTheWalker LukeTheWalker changed the title Row Major germ for complex double throws oneapi::math::unimplemented Row Major gemm for complex double throws oneapi::math::unimplemented Feb 26, 2025
@s-Nick
Copy link
Contributor

s-Nick commented Feb 26, 2025

Hi @LukeTheWalker Can you also add to how you compiled the library and the example please?
I suppose you are using cuBLAS backend, so please keep in mind that oneMath doesn't offer more functionality than underlying libraries. e.g. cuBLAS doesn't have row_major support for gemm operator therefore neither oneMath supports row_major for cuBLAS backend.

@sknepper
Copy link
Contributor

Please note that for many standard BLAS functions, it is possible to rearrange the parameters and call a column-major function to compute when the matrices are in row-major layout. E.g., see Netlib cblas_zgemm.c: https://github.com/Reference-LAPACK/lapack/blob/master/CBLAS/src/cblas_zgemm.c
We'd be happy to get such a contribution!

@LukeTheWalker
Copy link
Author

I see, I still think it should be provided as an interface for completeness as suggested in #588

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

No branches or pull requests

3 participants