Sparse Matrix Memory Pre-allocation via Symbolic Sampling

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Efficient memory allocation for sparse matrix multiplications is challenging due to the uncertainty in the number of non-zero elements in the output matrix, leading to issues such as memory waste or excessive dynamic allocations.

Innovation Solution

A hardware accelerator with sampling and memory management circuitry estimates the number of non-zero elements and floating-point operations through symbolic multiplication, allowing for pre-allocation of memory space before the sparse matrix-matrix multiplication, and dynamically allocates additional memory as needed.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Loss of energy

If memory space is pre-allocated based on estimated non-zero elements, then memory efficiency is improved, but estimation accuracy is worsened due to uncertainty in predicting the exact number of non-zero values

Engineering Contradiction:
Improvememory wasteVSAvoidprediction accuracy
Core Design Contradiction:
Loss of energyVSMeasurement precision

Solution Approach 1:

The patent performs symbolic multiplication in advance to estimate the number of non-zero elements and compute compression ratios before actual spGEMM execution. This preliminary estimation enables proactive memory space allocation, reducing memory waste while avoiding the need for expensive dynamic reallocations during runtime.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent samples a subset of rows (e.g., 100 rows) from the sparse matrix to perform symbolic multiplication and estimate compression ratios, rather than processing the entire matrix. This partial action provides sufficiently accurate estimates for memory allocation while significantly reducing the computational overhead of the estimation process.

Inventive Principle:
Principle #16Partial or excessive action

2Adaptability or versatility

If dynamic memory allocation is used during spGEMM, then memory utilization is improved, but computational overhead is worsened due to frequent reallocations

Engineering Contradiction:
Improvememory utilizationVSAvoidcomputational efficiency
Core Design Contradiction:
Adaptability or versatilityVSProductivity

Solution Approach 1:

The patent performs symbolic multiplication and memory space estimation before the actual spGEMM computation. By determining the required memory size in advance based on sampled compression ratios, the system can allocate sufficient contiguous memory space upfront, eliminating the need for frequent dynamic reallocations during runtime and thus maintaining high computational efficiency.

Inventive Principle:
Principle #10Preliminary action

3Measurement precision

If symbolic multiplication is performed on the entire matrix, then estimation accuracy is improved, but computational cost is worsened

Engineering Contradiction:
Improvecompression ratio accuracyVSAvoidcomputational cost
Core Design Contradiction:
Measurement precisionVSUse of energy by moving object

Solution Approach 1:

The patent performs symbolic multiplication on a sampled subset of rows (e.g., 100 rows) rather than the entire sparse matrix. This partial computation provides sufficiently accurate compression ratio estimates for memory allocation purposes while reducing the computational cost by a factor proportional to the sampling ratio, making the estimation process practical for large-scale applications.

Inventive Principle:
Principle #16Partial or excessive action

Data Source

PatentUS20240004955A1Computer-implemented memory allocation method for sparse matrix multiplication applications
Publication Date: 2024.01.04 ALIBABA (CHINA) CO LTD
  • US20240004955A1 patent drawing
  • US20240004955A1 patent drawing
  • US20240004955A1 patent drawing

AI summary

This application describes an accelerator, a computer system, and a method for memory optimization in sparse matrix-matrix multiplications (spGEMM). The memory optimization includes accurate memory pre-allocation for a to-be-generated output matrix of spGEMM between two sparse matrices. An exemplary method may include: sampling a plurality of first rows in the first sparse matrix; identifying, based on indices of non-zero data in the plurality of first rows, a plurality of second rows in a second sparse matrix; performing symbolic multiplication operations between the non-zero data in the plurality of first and second rows; determining an estimated compression ratio of the output matrix; determining an estimated mean row size for each row in the output matrix based on the estimated compression ratio; and allocating, according to the estimated mean row size and a total number of rows of the output matrix, a memory space in a hardware memory.