[Paper Review] HDCC: A Hyperdimensional Computing compiler for classification on embedded systems and high-performance computing
HDCC is an open-source compiler that translates high-level Hyperdimensional Computing classification tasks into optimized self-contained C code, enabling multithreaded and SIMD-accelerated execution for embedded and HPC environments, with reproducible results and significant speedups over Torchhd.
Hyperdimensional Computing (HDC) is a bio-inspired computing framework that has gained increasing attention, especially as a more efficient approach to machine learning (ML). This work introduces the ame{} compiler, the first open-source compiler that translates high-level descriptions of HDC classification methods into optimized C code. The code generated by the proposed compiler has three main features for embedded systems and High-Performance Computing: (1) it is self-contained and has no library or platform dependencies; (2) it supports multithreading and single instruction multiple data (SIMD) instructions using C intrinsics; (3) it is optimized for maximum performance and minimal memory usage. ame{} is designed like a modern compiler, featuring an intuitive and descriptive input language, an intermediate representation (IR), and a retargetable backend. This makes ame{} a valuable tool for research and applications exploring HDC for classification tasks on embedded systems and High-Performance Computing. To substantiate these claims, we conducted experiments with HDCC on several of the most popular datasets in the HDC literature. The experiments were run on four different machines, including different hyperparameter configurations, and the results were compared to a popular prototyping library built on PyTorch. The results show a training and inference speedup of up to 132x, averaging 25x across all datasets and machines. Regarding memory usage, using 10240-dimensional hypervectors, the average reduction was 5x, reaching up to 14x. When considering vectors of 64 dimensions, the average reduction was 85x, with a maximum of 158x less memory utilization.
Motivation & Objective
- Provide a self-contained, dependency-free C implementation of HDC classification suitable for embedded systems and HPC.
- Offer a modern compiler pipeline (tokenizer, grammar, IR, retargetable backend) for HDC learning tasks.
- Enable multithreading and SIMD via C intrinsics to maximize performance and minimize memory usage.
- Ensure open-source availability with reproducible experiments and data.
Proposed method
- HDCC accepts a high-level description of an HDC learning task as input and translates it into an HDC learning model with encoding, training, and inference components.
- The compiler uses the MAP (Multiply-Add-Permute) hyperspace with bundling and binding operations for encoding and processing.
- Embeddings can be random or level-initialized, with encoding patterns such as MULTIBUNDLE, NGRAM, and BATCHBIND; implementations optimize encoding for memory and speed.
- Training updates an associative memory by bundling encoded samples; inference compares the query hypervector to the class prototypes using cosine similarity, with post-training normalization to speed up inference.
- It supports SIMD vector intrinsics, multithreading via POSIX threads, and a memory-efficient approach that reads data in a streaming fashion and reduces encoding-induced memory usage.
- The backend is retargetable to generate C code and can be extended to FPGAs/GPUs via OpenCL/OpenGL backends.
Experimental results
Research questions
- RQ1Can an open-source compiler generate efficient, self-contained C code for HDC classification tasks with embedded-system constraints?
- RQ2How do HDCC-generated implementations compare to Torchhd in training/inference speed and memory usage across multiple datasets and hyperspace dimensions?
- RQ3What impact do multithreading and SIMD have on performance and memory footprint for HDCC-generated HDC classifiers?
- RQ4How transferable is the approach to different datasets (ISOLET, EMG, language recognition, MNIST) and hardware platforms?
- RQ5What are the practical steps to reproduce results and extend the compiler to other vector symbolic architectures?
Key findings
- HDCC achieves training and inference speedups up to 132x and an average of 25x across datasets and machines when using 10240-dimension hypervectors versus Torchhd.
- Memory usage is reduced on average by 5x and up to 14x with 10240 dimensions, and by as much as 85x average and 158x maximum for 64-dimensional vectors when compared to Torchhd.
- HDCC-generated code is self-contained (no external dependencies) and optimized for low memory and high throughput, suitable for embedded CPUs and HPC systems.
- Compared to Torchhd, HDCC shows similar accuracy across ISOLET, EMG, European languages, and MNIST datasets, while delivering substantial speed and memory advantages.
- Experiments were conducted on four machines (including Apple M2 and Intel Xeon platforms) with multiple dimension settings (64–10240), demonstrating robustness across hardware.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.