NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

HDCC: A Hyperdimensional Computing compiler for classification on embedded systems and high-performance computing

Pere Vergés, Mike Heddes, Igor Nunes, Tony Givargis, Alexandru NicolauarXiv 2023 · DOI

Introduction

Hyperdimensional Computing (HDC) is a brain-inspired machine learning paradigm that utilizes high-dimensional vectors (hypervectors) to represent and process data. Known for its robustness and computational simplicity, HDC is particularly well-suited for resource-constrained embedded systems. However, a significant "deployment gap" exists: while researchers typically prototype HDC models using high-level Python libraries like Torchhd, these frameworks rely on heavy dependencies such as PyTorch, making them impractical for bare-metal deployment on microcontrollers or specialized CPUs.

To bridge this gap, we present HDCC, the first open-source compiler designed to translate high-level HDC descriptions into optimized, standalone C code. By eliminating Python-related overhead, HDCC enables efficient HDC execution on both embedded devices and high-performance computing (HPC) systems.

The HDCC Compiler Architecture

HDCC follows a traditional compiler design to transform abstract model descriptions into executable code. The process begins with a domain-specific language (DSL) where users define hyperparameters—such as vector dimensions and class counts—and encoding strategies (e.g., N-grams or Multisets).

The HDCC compiler pipeline from input description to executable.

The compiler pipeline consists of several key stages:

  1. Front-end: A lexer and parser process the DSL input to generate an Abstract Syntax Tree (AST).
  2. Validation: The IR is validated to ensure logical consistency of the HDC operations.
  3. Retargetable Backend: The backend generates C code optimized for the target architecture. Currently, it focuses on generating "bare-metal" C code with zero external dependencies.

Optimization Strategies

To achieve high performance, HDCC implements several low-level optimizations:

  • SIMD Vectorization: The compiler automatically generates C intrinsics for Single Instruction Multiple Data (SIMD) operations, allowing the CPU to process multiple hypervector dimensions in parallel.
  • Multithreading: Utilizing POSIX threads, HDCC parallelizes training and inference tasks across available CPU cores.
  • Memory Fusion: Rather than creating large intermediate vectors during sequential encoding steps, HDCC fuses operations to aggregate data within a constant memory footprint.
  • Inference Refinement: By normalizing the learned associative memory after training, HDCC replaces expensive cosine similarity calculations with simple dot products during inference, significantly boosting speed on low-power hardware.

Experimental Results

We evaluated HDCC against the Torchhd library across four standard benchmarks: ISOLET (speech), EMG (gesture recognition), European Languages (text identification), and MNIST (digit classification). Testing was conducted on diverse hardware, including Apple M2 and Intel Xeon processors.

Performance comparison across datasets showing time, accuracy, and peak memory usage.

Key Findings

  • Speedup: HDCC achieved an average training and inference speedup of 25x compared to Python-based execution. On the EMG dataset, peak speedup reached 132x.
  • Memory Efficiency: Memory usage was reduced by an average of 5x for standard 10,240-dimensional vectors. For ultra-low-power configurations using 64-dimensional vectors, memory reduction reached a staggering 158x.
  • Accuracy Preservation: Crucially, the compiled C code maintains the exact mathematical logic of the original models, resulting in zero loss in classification accuracy.

Conclusion and Future Work

HDCC demonstrates that the inherent simplicity of Hyperdimensional Computing is often obscured by the heavy software frameworks used for prototyping. By providing a dedicated compiler, we enable HDC to reach its full potential on the edge. Future work will expand HDCC's capabilities to include support for alternative HDC frameworks like Binary Spatter Codes (BSC) and direct hardware backends for FPGAs via High-Level Synthesis (HLS).

Summary updated

BibTeX
@misc{verges2023hdcc,
  author = {Pere Vergés and Mike Heddes and Igor Nunes and Tony Givargis and Alexandru Nicolau},
  title = {{HDCC: A Hyperdimensional Computing compiler for classification on embedded systems and high-performance computing}},
  year = {2023},
  eprint = {2304.12398},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2304.12398},
}
Figure