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

Adding more support for SpGEMM via rocsparse #1589

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

seanofthemillers
Copy link
Contributor

Changes:

  • Adding Jacobi SpGEMM via rocsparse

  • Enabling rocsparse testing for SpGEMM

  • Enabling complex datatypes with SpGEMM

  • Adding option for non-int size types (e.g. size_t and int64_t) for SpGEMM

@seanofthemillers
Copy link
Contributor Author

@lucbv are you up for reviewing this? It adds some feature support for SpGEMM with rocsparse.

@kokkos-devops-admin
Copy link

Status Flag 'Pre-Test Inspection' - - This Pull Request Requires Inspection... The code must be inspected by a member of the Team before Testing/Merging
NO INSPECTION HAS BEEN PERFORMED ON THIS PULL REQUEST! - This PR must be inspected by setting label 'AT: PRE-TEST INSPECTED'.

@lucbv
Copy link
Contributor

lucbv commented Nov 16, 2022

@seanofthemillers I'm at SC22 this week, will look at this when I get back

Copy link
Contributor

@lucbv lucbv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks fine, however it will conflict with recent changes to handle complex type. The title and description of this PR were not very explicit about including a bug fix so it was not prioritized as such...
There are also some issues related to changes to the public API which cannot be accepted. The public API needs to be deprecated before it is removed or downstream libraries (Trilinos, PETSc...) and application will break.

void choose_default_algorithm() {
static
SPGEMMAlgorithm
default_spgemm_algorithm() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is part of Kokkos Kernels public API, you are not allowed to change it.
If you need to the new signature you can add it to the API and if for some reason you need to remove the old one, it needs to be marked as deprecated and should preferably be implemented by calling the new interface.

{

/// Constructor
rocSparseSpgemmHandleType():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The API of Kokkos Kernels cannot arbitrarily change, you need to deprecate the old constructor until the next major release. You also need to motivate why your new implementation is more appropriate to users than the current one.

@@ -292,7 +310,7 @@ struct SPGEMM_JACOBI<KernelHandle, a_size_view_t_, a_lno_view_t,
Kokkos::MemoryTraits<Kokkos::Unmanaged> >, \
false, true>;

#include <KokkosSparse_spgemm_tpl_spec_decl.hpp>
// #include <KokkosSparse_spgemm_tpl_spec_decl.hpp>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be removed not commented.

- Adding Jacobi SpGEMM via rocsparse

- Enabling rocsparse testing for SpGEMM

- Adding option for non-int size types (e.g. size_t and int64_t) for SpGEMM
@kokkos-devops-admin
Copy link

Status Flag 'Pre-Test Inspection' - - This Pull Request Requires Inspection... The code must be inspected by a member of the Team before Testing/Merging
NO INSPECTION HAS BEEN PERFORMED ON THIS PULL REQUEST! - This PR must be inspected by setting label 'AT: PRE-TEST INSPECTED'.

@lucbv
Copy link
Contributor

lucbv commented Feb 15, 2023

@seanofthemillers @brian-kelley
Is it fair to say that this PR has been superseded by recent work that was merged in Kokkos Kernels on integrating TPLs and redesigning our interfaces for SPGEMM?
In which case I would suggest just closing this.

@brian-kelley
Copy link
Contributor

brian-kelley commented Feb 15, 2023

@lucbv Hmm... the testing and complex support are superseded now, but I haven't supported any TPLs for SpGEMM-Jacobi. I also haven't converted non-int ordinals/offsets to int to call TPLs.

  • For SpGEMM-Jacobi, ideally any TPLs would be supported through the unification layer (KokkosSparse_spgemm_jacobi_spec.hpp does exist now), instead of the old SpGEMM way of having rocSparse be an "algorithm" choice in the handle. In fact, the algorithm enums corresponding to TPLs are now deprecated
  • On converting ordinals/offsets to int, I think it's a good idea in the sense that the time to convert is probably a lot smaller than the savings from using TPLs instead of native. But reusing the symbolic phase would require keeping a second copy of the product matrix around

@seanofthemillers
Copy link
Contributor Author

@lucbv @brian-kelley Sorry, I've been a bit sidetracked. I can rewrite this to work with the new backend for spgemm-jacobi, and remove my changes for testing/complex. I'll can try to get back on this next week.

I am a little worried about memory consumption for duplicating some of these arrays (index arrays and the D^{-1} * A allocation). Hiding those allocations inside a handle may not always be advisable. With the new spgemm-jacobi backend, is there a way to chose not to use rocsparse? Outside of recompiling the code with rocsparse disabled.

@brian-kelley
Copy link
Contributor

@seanofthemillers When TPL support is done through the unification layer, the decision to call a TPL is done at compile-time and normally there isn't a way to opt out of the TPL at runtime. This design assumes that the TPL will always outperform the implementation that we write. In a few places we have alternate runtime paths for cases where TPLs perform poorly (for example, KokkosBlas::gemm where A is short-and-fat, and B is tall-and-skinny).

I think in this case, the only decision to make is, should non-int index types be supported (requiring a copy of int32-typed indices in the handle)? I don't have a strong opinion either way.

@kokkos-devops-admin
Copy link

Status Flag 'Pre-Test Inspection' - - This Pull Request Requires Inspection... The code must be inspected by a member of the Team before Testing/Merging
NO INSPECTION HAS BEEN PERFORMED ON THIS PULL REQUEST! - This PR must be inspected by setting label 'AT: PRE-TEST INSPECTED'.

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 this pull request may close these issues.

4 participants