Sparse Matrix Memory Allocation via Symbolic Hash Tables

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing methods for sparse matrix-matrix multiplication struggle to accurately predict the number of non-zero elements in the output matrix, leading to inefficient memory allocation and potential memory waste or excessive dynamic reallocation.

Innovation Solution

A method that computes floating-point multiplication operations and estimates the compression ratio for each row of the output matrix using sampled rows from both sparse matrices, constructs hash tables to determine actual non-zero elements, and allocates memory space based on these calculations, ensuring accurate memory allocation.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If memory space is allocated based on predicted non-zero elements, then memory allocation efficiency is improved, but prediction accuracy deteriorates leading to memory waste or excessive reallocation

Engineering Contradiction:
Improvememory allocation efficiencyVSAvoidprediction accuracy of non-zero elements
Core Design Contradiction:
ProductivityVSMeasurement precision

Solution Approach 1:

The patent performs symbolic computation before numerical multiplication to predict the exact number of non-zero elements in the output matrix. This preliminary action provides accurate memory allocation information before the actual computation, resolving the contradiction between allocation efficiency and prediction accuracy.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent introduces hash tables as an intermediary data structure to count non-zero elements during symbolic computation. The hash tables map column indices to row indices, enabling accurate counting of non-zero elements without performing full numerical multiplication, thus achieving both efficiency and accuracy.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Quantity of substance

If compact data structure is used for sparse matrices, then memory storage efficiency is improved, but memory allocation complexity worsens due to difficulty in predicting output size

Engineering Contradiction:
Improvememory storage efficiencyVSAvoidmemory allocation complexity
Core Design Contradiction:
Quantity of substanceVSDevice complexity

Solution Approach 1:

The patent performs symbolic computation to predict the exact number of non-zero elements before numerical multiplication. This preliminary action simplifies memory allocation for compact data structures by providing accurate size information in advance, reducing allocation complexity while maintaining storage efficiency.

Inventive Principle:
Principle #10Preliminary action

3Measurement precision

If dynamic reallocation is performed during computation, then memory accuracy is improved, but computation time increases due to reallocation overhead

Engineering Contradiction:
Improvememory allocation accuracyVSAvoidcomputation time
Core Design Contradiction:
Measurement precisionVSLoss of time

Solution Approach 1:

The patent performs symbolic computation to predict the exact number of non-zero elements before numerical multiplication begins. This allows static memory allocation based on accurate predictions, eliminating the need for dynamic reallocation during computation and avoiding the time overhead associated with reallocation operations.

Inventive Principle:
Principle #10Preliminary action

Data Source

PatentUS20240184848A1Memory allocation method for sparse matrix multiplication applications
Publication Date: 2024.06.06 ALIBABA (CHINA) CO LTD
  • US20240184848A1 patent drawing
  • US20240184848A1 patent drawing
  • US20240184848A1 patent drawing

AI summary

This application describes accelerator, computer system, and method for memory allocation in sparse matrix-matrix multiplications (spGEMM). An example method may include: computing a number of floating point multiplication operations (FLOP) to be performed to generate each row in the output matrix; determining an estimated compression ratio based on a plurality of first rows sampled from the first sparse matrix and a plurality of corresponding second rows from the second sparse matrix; determining an estimated number of non-zero data (NNZ) in each row of the to-be-generated output matrix; constructing a plurality of hash tables for the rows in the to-be-generated output matrix based on the estimated NNZ corresponding to each row; performing symbolic computations between the first and second sparse matrices by using the hash tables to determine actual NNZs in the to-be-generated output matrix; and allocating a memory space for the output matrix based on the actual NNZs.