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

Matrix product always falls back to native implementation #248

Open
srinivasyadav18 opened this issue Mar 7, 2023 · 3 comments
Open

Matrix product always falls back to native implementation #248

srinivasyadav18 opened this issue Mar 7, 2023 · 3 comments

Comments

@srinivasyadav18
Copy link

I am trying to implement HPX backend for matrix_product.
I am not certainly clear with this section of code (below).
The following always evalutes to false right ?
Because both qualified lookup and unqualified lookup of matrix_product return void, so the second part of the expression always evaluates to false and hence whole std::enable_if_t is false.

template <class Exec, class A_t, class B_t, class C_t>
struct is_custom_matrix_product_avail<
  Exec, A_t, B_t, C_t,
  std::enable_if_t<
    std::is_void_v<
      decltype(
	      matrix_product(
          std::declval<Exec>(),
          std::declval<A_t>(),
		      std::declval<B_t>(),
		      std::declval<C_t>()))
      >
    && !std::is_same_v< // see #218
      decltype(
        std::experimental::linalg::matrix_product(
          std::declval<Exec>(),
          std::declval<A_t>(),
		      std::declval<B_t>(),
		      std::declval<C_t>())),
      decltype(
        matrix_product(
          std::declval<Exec>(),
          std::declval<A_t>(),
		      std::declval<B_t>(),
		      std::declval<C_t>()))
      >
    && !linalg::impl::is_inline_exec_v<Exec>
    >
  >
  : std::true_type{};

Which makes this : https://github.com/kokkos/stdBLAS/blob/main/include/experimental/__p1673_bits/blas3_matrix_product.hpp#L757 always false and hence falls backs to native sequential implementation.

@fnrizzi
Copy link
Contributor

fnrizzi commented Mar 7, 2023

hi @srinivasyadav18 , pinging @mzuzek since he is the one who posted #218

@mzuzek
Copy link

mzuzek commented Mar 8, 2023

@srinivasyadav18 @fnrizzi
Hi!
Thanks for rising this.
I've just created #249 which reverts my incorrect fix #222 for #218 - essentially removing the second condition.
For more details and background, please see the discussion at #218 (comment).

@srinivasyadav18
Copy link
Author

@fnrizzi @mzuzek

Thank you.
#249 Works for me now as expected. It is being dispatched to the correct overload now.

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