TL;DR
Hardware accelerators for sparse matrix multiplication (SpGEMM) typically commit to a single, fixed dataflow—inner, outer, or row-wise product—which cripples performance when matrix sparsity patterns shift. Misam introduces a machine learning approach that dynamically selects the optimal execution dataflow block-by-block based on sparse matrix features, yielding up to 28× speedups over fixed schemes.
What Problem Does This Paper Address?
SpGEMM is foundational in graph analytics, scientific computing, and sparse neural networks. Prior hardware accelerators tailor their architectures to one of three primary execution dataflows:
- Inner Product (IP): Efficient for denser workloads where input reuse is high, but struggles with sparse index intersection.
- Outer Product (OP): Excellent for ultra-sparse inputs because it avoids index matching, but generates heavy partial-sum traffic.
- Row-Wise Product (RW): Balances input and output reuse, but suffers memory fetch penalties if row access patterns are irregular.
Because standard accelerators fix this choice in silicon, they perform poorly when inputs diverge from anticipated sparsity patterns (e.g., transitioning from extremely sparse 0.001% graph adjacency matrices to moderately sparse neural network weights). Recent adaptive accelerators use static heuristics or runtime profiling, which either overfit to specific domains or terminate search early, missing optimal configurations.
Methods
The authors frame dataflow selection as a classification/decision task over streaming matrix blocks:
- Feature Engineering & Selection: Instead of tracking dozens of matrix traits, the authors trained an initial tree to rank feature importance. They narrowed 12 candidate metrics down to the top five:
blocks_accessed(blocks of matrix $B$ needed for row-wise product that are missing from memory)avg_col_lengthBavg_row_lengthA_var(variance in non-zeros per row)sparsityAandsparsityB- Decision Tree Classifier: Implemented via Scikit-learn with class-weight balancing (to prevent majority-class bias) and pruned to a maximum depth of 9 to minimize storage and prevent overfitting.
- Deep Q-Network (DQN): An offline reinforcement learning agent using an $\epsilon$-greedy exploration policy, experience replay, and a compact neural network (one hidden layer, 9,219 parameters) taking matrix features as states and targeting maximum PE utilization and minimal latency.
- Decision-Tree-Guided Heuristic: A distilled, 2-level nested
if-elseroutine derived directly from the decision tree’s top features (blocks_accessedandavg_row_lengthA_var) as an ultra-lightweight baseline.
Datasets
Because no standard benchmark tracks detailed SpGEMM structural features alongside execution latencies, the authors synthesized a custom dataset using cycle-accurate simulators (with a fixed processing element count of 4):
- 30 real-world matrices from the SuiteSparse Matrix Collection, covering machine learning, graph analytics, chemical simulation, and linear programming (e.g.,
email-Enron,webbase-1M,cage12). - 70 synthetic matrices generated with randomized sparsity levels and structural distributions.
- Matrices were segmented into sub-blocks to simulate streaming hardware execution, split 70% for training and 30% for evaluation.
Key Insights and Ideas
- Local sparsity variation matters: While real-world matrices in SuiteSparse often favored one consistent dataflow across the entire matrix, randomized matrices exhibited high internal variance. Sub-blocks within the same matrix performed best under different dataflows, validating the need for block-level dynamic dispatch.
- Cache locality dominates dataflow choice: The single most predictive feature across models was
blocks_accessed, proving that dataflow optimality is dictated primarily by off-chip memory traffic for non-resident rows rather than raw non-zero counts alone. - ML as a heuristic generator: The decision tree proved valuable not just as a classifier, but as an automated pipeline to identify critical decision thresholds, enabling the creation of an ultra-compact 512-byte heuristic.
Key Results
- Decision Tree: Achieved 94% classification accuracy, delivering an average speedup of 2.7× over IP, 2.1× over OP, 2.64× over RW, and 1.13× over the heuristic (with peak individual benchmark speedups reaching up to ~28×).
- Reinforcement Learning (DQN): Reached 90% accuracy, achieving average speedups of 2.36× over IP, 1.85× over OP, and 2.3× over RW. Occasional suboptimal actions resulted in minor dips below baseline performance on isolated benchmarks.
- Storage Footprint:
- Heuristic: 512 B
- Compiled Decision Tree: 24 KB (reduced from 29 KB after metadata removal)
- DQN: 38 KB
Limitations and Future Work
- Offline Training Only: The DQN is currently trained offline with static reward lookups; real-time online adaptation to unseen matrix distributions during hardware execution remains future work.
- Hardware Architecture Scope: The evaluations rely on a cycle-accurate simulator fixed at a small scale (4 PEs). Validation on larger spatial arrays and diverse memory hierarchies is not yet demonstrated.
- Dataset Size: The training corpus consists of 100 matrices; expanding real-world domain coverage will be necessary to ensure tree boundaries generalize reliably across arbitrary scientific and AI workloads.
Summary updated