You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@systemds.apache.org by "Elmanjhg (via GitHub)" <gi...@apache.org> on 2026/07/17 11:51:52 UTC
[PR] [SYSTEMDS-3855] Vector API: Sparse-Sparse Matrix Multiplication Kernels [systemds]
Elmanjhg opened a new pull request, #2553:
URL: https://github.com/apache/systemds/pull/2553
This PR completes the missing Vector API (SIMD) implementations for sparse matrix combinations, extending the work done in previous dense/sparse vectorization PR https://github.com/apache/systemds/pull/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
<img width="1600" height="1200" alt="performanceComparisonsSYSTEMDS" src="https://github.com/user-attachments/assets/239f5fe1-4d64-41d4-8c7f-ae6337727b4c" />
### Raw Data
[runtimeComparisonSYSTEMDSProject.csv](https://github.com/user-attachments/files/30123047/runtimeComparisonSYSTEMDSProject.csv)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@systemds.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SYSTEMDS-3855] Vector API: Sparse-Sparse Matrix Multiplication Kernels [systemds]
Posted by "mboehm7 (via GitHub)" <gi...@apache.org>.
mboehm7 commented on PR #2553:
URL: https://github.com/apache/systemds/pull/2553#issuecomment-5891423035
LGTM - thanks @Elmanjhg for the patch and experiments. However, I agree with @Baunsgaard of not taking over the benchmark and new dependencies.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@systemds.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SYSTEMDS-3855] Vector API: Sparse-Sparse Matrix Multiplication Kernels [systemds]
Posted by "mboehm7 (via GitHub)" <gi...@apache.org>.
mboehm7 closed pull request #2553: [SYSTEMDS-3855] Vector API: Sparse-Sparse Matrix Multiplication Kernels
URL: https://github.com/apache/systemds/pull/2553
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@systemds.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SYSTEMDS-3855] Vector API: Sparse-Sparse Matrix Multiplication Kernels [systemds]
Posted by "Baunsgaard (via GitHub)" <gi...@apache.org>.
Baunsgaard commented on code in PR #2553:
URL: https://github.com/apache/systemds/pull/2553#discussion_r4026652399
##########
src/test/java/org/apache/sysds/test/component/matrix/BenchmarkMatMult.java:
##########
@@ -0,0 +1,83 @@
+package org.apache.sysds.test.component.matrix;
+
+import java.util.concurrent.TimeUnit;
+import org.apache.sysds.runtime.matrix.data.LibMatrixMult;
+import org.apache.sysds.runtime.matrix.data.MatrixBlock;
+import org.apache.sysds.test.TestUtils;
+import org.openjdk.jmh.annotations.*;
+import org.openjdk.jmh.infra.Blackhole;
+import org.openjdk.jmh.results.format.ResultFormatType;
+import org.openjdk.jmh.runner.Runner;
+import org.openjdk.jmh.runner.RunnerException;
+import org.openjdk.jmh.runner.options.Options;
+import org.openjdk.jmh.runner.options.OptionsBuilder;
+
+@State(Scope.Thread)
+@BenchmarkMode(Mode.AverageTime)
+@OutputTimeUnit(TimeUnit.MICROSECONDS)
+@Warmup(iterations = 5, time = 1, timeUnit = TimeUnit.SECONDS)
+@Measurement(iterations = 10, time = 1, timeUnit = TimeUnit.SECONDS)
+@Fork(1)
Review Comment:
I would not add this JMH dependency to make a benchmark for the matrix multiply.
Instead please move this from being in test to being in performance.
https://github.com/apache/systemds/tree/main/src/test/java/org/apache/sysds/performance
and do not add the dependency package for the benchmark.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@systemds.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org