Skip to content

[SYSTEMDS-3855] Vector API: Sparse-Sparse Matrix Multiplication Kernels#2553

Open
Elmanjhg wants to merge 1 commit into
apache:mainfrom
Elmanjhg:SYSTEMDS-3855-vector-api-usage-in-dense-sparse-matrix-multiplications
Open

[SYSTEMDS-3855] Vector API: Sparse-Sparse Matrix Multiplication Kernels#2553
Elmanjhg wants to merge 1 commit into
apache:mainfrom
Elmanjhg:SYSTEMDS-3855-vector-api-usage-in-dense-sparse-matrix-multiplications

Conversation

@Elmanjhg

Copy link
Copy Markdown
Contributor

This PR completes the missing Vector API (SIMD) implementations for sparse matrix combinations, extending the work done in previous dense/sparse vectorization PR #2423.

Modifications

Replaced the scalar inner loops with the vectorized "vectMultiplyAddScatter" using the JDK 17 Vector API in the following three Sparse-Sparse matrix multiplication kernels within "LibMatrixMult.java":

  1. matrixMultSparseSparseMM
  2. matrixMultSparseSparseMMSmallRHS
  3. matrixMultSparseSparseSparseMM

Testing & Validation

  • Component tests (MatrixMultiplyTest) executed successfully (5000 tests passed, 0 failures).

BENCHMARK

Hardware Environment (Linux)

  • OS: Ubuntu Linux
  • CPU Model: AMD Ryzen 5 PRO 7530U (x86_64)
  • Cores/Threads: 6 Cores / 12 Threads (Turbo: 4.54 GHz)
  • Vector Capability: 256-bit (AVX2)
  • Cache: L1: 384 KiB / L2: 3 MiB / L3: 16 MiB
  • Memory: 16 GB

The benchmark uses like the PR Request before the Java Microbenchmark Harness (JMH) framework to measure the performance of the rewritten kernels. The result is the average execution time in microseconds. Each benchmark run consists of 5 warmup iterations followed by 10 measurement iterations (1 second each), executed in a single forked JVM.

Sparse-Sparse Benchmark Result Summary

  • The vectorized implementations yield solid performance gains (up to 1.35x) on larger matrices (e.g., 8192x8192).
  • Minor performance regressions (dropping to ~0.87x) occur when the right hand sparsity is precisely around 0.01, likely where the overhead of vector preparation and scatter operations slightly outweighs the raw SIMD throughput.

Benchmark Parameters

  • m: 1024, 2048, 4096, 8192
  • cd: 1
  • n: 1024, 2048, 4096, 8192
  • Sparsity Left: 0.5, 0.75, 1.0
  • Sparsity Right: 0.001, 0.01, 0.1, 0.2
  • Total Configs: 192

Top Performance Gains (Speedup > 1.0)

m n sparsityLeft sparsityRight Speedup
8192 4096 1.0 0.001 1.35x
8192 8192 0.5 0.001 1.35x
8192 8192 0.75 0.001 1.33x
8192 8192 1.0 0.001 1.32x
8192 4096 1.0 0.010 1.22x

Top Performance Losses (Speedup < 1.0)

m n sparsityLeft sparsityRight Speedup
8192 2048 1.0 0.010 0.87x
1024 2048 0.75 0.010 0.88x
4096 8192 0.75 0.010 0.90x
8192 2048 0.5 0.010 0.91x
2048 4096 1.0 0.010 0.92x

Baseline vs Vectorized Performance plots

performanceComparisonsSYSTEMDS

Raw Data

runtimeComparisonSYSTEMDSProject.csv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

1 participant