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

[DAPHNE-#811] Extension of EwBinaryMat and EwUnaryMat Kernels to Support Sparse and Dense Matrix Addition #812

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

StoeckOverflow
Copy link
Contributor

@StoeckOverflow StoeckOverflow commented Aug 20, 2024

Overview

This draft pull request introduces an extension to the EwBinaryMat and EwUnaryMat kernels to support efficient operations for matrix addition between dense and sparse matrices (see issue #811). The following kernels have been added:

  • EwBinaryMat Kernels:

    • DenseMatrix <- CSRMatrix, DenseMatrix
    • DenseMatrix <- DenseMatrix, CSRMatrix
    • CSRMatrix <- CSRMatrix, DenseMatrix
  • EwUnaryMat Kernels:

    • CSRMatrix <- CSRMatrix

Implementation Details

As part of this implementation, a resize method was added to the CSRMatrix class to dynamically handle the reallocation of memory when the number of non-zero elements exceeds the initially allocated space.

Questions Regarding resize Method Implementation

The resize method is essential for managing dynamic memory allocation within sparse matrices, especially when the number of non-zero elements increases during operations.

  1. Comparison with Dense Matrices: In some scenarios, the memory usage of a CSR matrix may approach or even exceed that of a dense matrix, particularly when the matrix is nearly dense or when the overhead from storing indices becomes significant. Is it advisable to dynamically adjust the size of the CSR matrix in these cases, considering that the most efficient representation should have already been chosen in a previous compiler pass?

  2. Alternative Approaches: Are there alternative methods that could offer more efficiency in handling dynamic resizing, especially in the context of sparse matrices?

@StoeckOverflow StoeckOverflow marked this pull request as ready for review August 20, 2024 18:16
@philipportner philipportner self-assigned this Aug 25, 2024
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.

2 participants