Elamur Research

HPVM-HDC: A Heterogeneous Programming System for Accelerating Hyperdimensional Computing

Paper · 2024 · Russel Arbore; Xavier Routh; Abdul Rafae Noor; Akash Kothari; Haichao Yang; Weihong Xu; Sumukh Pinge; Minxuan Zhou; Tajana Rosing; and Vikram Adve

Summary

A program that runs well on a GPU can be difficult to move to a chip built specifically for the same kind of work. In hyperdimensional computing, a form of machine learning, that difficulty arises even when both devices spend much of their time comparing long vectors. A GPU can run a custom routine for almost any comparison the programmer can express. A specialized chip may offer an instruction that searches a stored set of vectors in one operation, using a particular distance measure. HPVM-HDC asks how to write a program that can make use of both kinds of hardware without maintaining a separate application for each.

The authors introduce HDC++, a C++-based language that lets programmers describe a computation at two levels. They can specify individual operations on vectors, such as projection and distance, and mark larger stages, such as inference over a collection of queries. A description of the larger stage gives the compiler a direct way to use an accelerator that implements it. The individual operations give the compiler enough detail to run the programmer’s own algorithm on a CPU or GPU. The same source can also express ordinary parallel work, which matters when only part of an application fits an accelerator.

The authors port five workloads and run all five on CPUs and GPUs. For the four GPU workloads with CUDA C++ reference implementations, the geometric mean speedup is 1.17x. Individual results range from 0.95x to 1.5x, so the contribution is competitive performance from a common source rather than a speed gain on every workload. Across the CPU and GPU implementations counted together, the authors report a geometric mean reduction factor of 1.6x in lines of code. They also run the supported stages of spoken-letter classification and clustering on a fabricated digital chip and evaluate them with a simulator for a resistive-memory accelerator. Those comparisons time the device computations against an edge GPU.

The compiler offers optional ways to shrink vector elements or skip some of the work in a calculation that combines them. In the GPU experiment on spoken-letter classification, inference speed improves by up to 3.4x across the settings tested, while reported accuracy ranges from 0.2 to 0.89 against a baseline of 0.82. Some settings improve both speed and accuracy. In this experiment, skipping work during the comparison with stored class vectors generally preserves accuracy better than skipping work during the initial encoding. The compiler carries out the transformations, and the application developer chooses where to use them.

Deep dive: HPVM-HDC: A Heterogeneous Programming System for Accelerating Hyperdimensional Computing

HPVM-HDC compiles hyperdimensional computing programs for CPUs, GPUs and custom accelerators, with optional speed and accuracy trade-offs. · about 31 minutes to read

The problem and its context

What an HDC program does

Hyperdimensional computing, or HDC, puts information into long arrays called hypervectors. An input begins as a collection of features. An encoding procedure maps those features to coordinates in a new space, typically with thousands of coordinates. A classifier can then compare the encoded input with a collection of representative hypervectors, one per class. The class whose representative is most similar to the query supplies the prediction.

This separates the work into parts with different jobs. Encoding determines the representation in which examples can be compared. Training builds the stored representatives from examples. Inference selects among the representatives for a new input. The paper describes training based on repeated element-wise addition and highlights how much of the computation can be parallelized. For example, comparisons with different class representatives can proceed independently. Within a comparison, the coordinate contributions can also be computed separately before they are combined.

The coordinates can be stored at different precisions. A similarity rule can use magnitudes, or it can count positions at which the query and the stored vector disagree. Those choices are part of the algorithm. A useful encoding for a spoken letter may have little in common with an encoding for a node in a graph, even though both eventually yield long arrays. The problem for a language designer is to capture the repeated structure without restricting every program to the same operations in the same order.

The authors motivate HDC through workloads whose memory, computation and energy requirements matter on edge devices. HDC is interesting in that setting because many of its operations are simple and because a result can sometimes tolerate errors in its coordinates or calculations. Neither property settles how to implement an application. Parallel work still has to be organized, and data still has to reach the units that process it. Whether a cheaper representation preserves accuracy depends on where the cheaper operation is used.

Why hardware portability is difficult

On a general-purpose processor, HDC may look like a collection of loops over examples, classes and vector coordinates. On a GPU, the same work can be expressed through parallel kernels or calls to libraries. A dedicated HDC accelerator may expose an interface built around entire stages. It may take an example as input, compare its encoding against representatives already stored on the device, and return a label. Its internal buffers and pipelines can be organized around precisely that operation.

Moving between these interfaces is harder than changing arithmetic instructions. Source code consisting of loops over arrays may contain all the steps of an inference algorithm, but a compiler needs to establish that those steps match the accelerator’s particular operation. The paper treats recovering an entire encoding, training or inference stage from low-level code as impractical in general. It gives the developer a way to name the stage explicitly while preserving the smaller operations that define a programmable implementation.

The boundaries of a stage also matter for moving data. Suppose a program runs comparisons for a collection of queries against the same class representatives. If the compiler can see the whole loop, it can arrange for the representatives to stay on the device throughout that sequence. Seeing an individual comparison supplies less information about whether later calls will reuse the same data. The authors use the stage interface to express the scope over which that reuse can occur.

An accelerator also has a fixed repertoire. The paper’s clustering example includes work that matches the accelerator interface, as well as steps such as updating cluster representatives that still require programmable hardware. A portable program therefore needs some way to describe where results flow between stages and ordinary computation. The choice is finer than assigning the entire program to a single device. That is where the paper’s discussion of heterogeneous systems intersects with GPU and parallel computing.

The starting point in earlier systems

As the authors describe it, much HDC research begins in Python or MATLAB, where an algorithm can be tried quickly. Code can use scalar operations or array libraries, and language extensions can provide access to a GPU. Other implementations start from CUDA, OpenCL or C++ with FPGA-specific features. Specialized code can make good use of the hardware. Maintaining an implementation in each environment, however, gives the developers several places to change and validate the same algorithm.

The paper distinguishes this situation from the problem addressed by an HDC library. TorchHD offers HDC facilities on CPUs and GPUs through a general learning framework. OpenHD and HDTorch use Python with CUDA extensions to support particular classes of GPU work. These libraries make hypervector programming more accessible, but the authors identify a gap at the interface to dedicated HDC accelerators. Their account of TorchHD connects it to PyTorch.

A closer precedent is HDCC. It compiles high-level HDC descriptions to C code with multithreading and vector extensions for multicore CPUs. In the authors’ account, it provides a fixed repertoire of encoding, training and inference algorithms. HPVM-HDC starts from a different requirement. A developer needs to be able to compose algorithms from operations on vectors and matrices and still identify larger stages when their meaning matches the device. Supporting a single CPU back end leaves that second problem largely outside the compiler’s scope.

The authors point to PyTorch and TensorFlow as examples of hardware-independent interfaces that make it easier to use accelerators. Their comparison with compilers for deep learning, including TVM, centers on what the program representation preserves. They argue that HDC developers need room to change the algorithm itself and that the compiler needs to retain parallelism at multiple levels, from groups of tasks down to loops within them. The earlier systems they discuss include TensorFlow and TVM.

The paper also describes the pressure to specialize in prior HDC work on mass spectra. Its examples are HyperSpec, which clusters spectra, and HyperOMS, which searches a spectral library. Both can incur repeated data movement as their collections grow. Earlier near-storage FPGA implementations addressed that issue through work on memory access, hardware interfaces and verification. This puts the programming problem in concrete terms. A portable description has to expose enough about the calculation to support a different hardware implementation while leaving the application recognizable to the person who maintains it.

The method, step by step

From input features to a label

The classification example starts with a vector of 617 input features. The programmer supplies a random projection matrix with 2048 rows and 617 columns. Each row produces a coordinate of the encoded hypervector by combining the input features. The result has 2048 coordinates, and the stored class representatives use those same coordinates. The class hypermatrix, a matrix whose rows are hypervectors, contains 26 representatives in this example.

In notation, the matrix multiplication in the example computes each encoded coordinate as follows.

zᵢ = Σⱼ Wᵢⱼ xⱼ

Here xⱼ is the input feature at position j, and Wᵢⱼ is the entry in row i and column j of the random projection matrix W. The sum Σⱼ runs over the input features. The result zᵢ is coordinate i of the encoded hypervector z. The index i ranges over the projection rows. The equation describes the operation requested in the classification example. The language also lets the programmer supply a different encoder.

The next operation compares the encoded query with each row of the class hypermatrix. The example uses Hamming distance, which counts the coordinates where two vectors differ. Each comparison returns a single dissimilarity.

dᵢ = Σⱼ [zⱼ ≠ Cᵢⱼ]

Here dᵢ is the distance to class i. The symbol zⱼ denotes query coordinate j, C is the class hypermatrix, and Cᵢⱼ is coordinate j of its row for class i. The sum Σⱼ runs over the coordinates of the encoded vectors. The brackets evaluate to 1 when the inequality ≠ holds and 0 when the coordinates agree. The compiler’s lowered code implements this counting procedure for each row.

With 26 class rows, the Hamming distance operation produces a vector of 26 distances. An operation called arg_min returns the position of the smallest entry.

ŷ = arg minᵢ dᵢ

Here ŷ is the predicted class index. The expression arg minᵢ selects an index i that minimizes the distance dᵢ, which is the dissimilarity to the representative at that index. This is the end of the inference example. The source describes the projection, comparison and selection directly, leaving the compiler to decide how a target will execute them.

The paper also uses cosine similarity, which evaluates alignment using the dot product normalized by the lengths of the vectors. The distinction has practical consequences for the approximation experiments. A change in coordinate magnitude can affect cosine similarity, while Hamming distance uses equality at each coordinate. Written out for a pair of vectors, the cosine comparison is as follows.

s(a, b) = (Σⱼ aⱼ bⱼ) / (‖a‖₂ ‖b‖₂)

The vectors being compared are a and b, with entries aⱼ and bⱼ at coordinate j. The sum Σⱼ adds products over their coordinates. The terms ‖a‖₂ and ‖b‖₂ are the vectors’ Euclidean lengths, and s(a, b) is the resulting similarity. A search using this score favors the larger value. The paper’s GPU experiment uses a cosine-based configuration as its reference and also tries Hamming-based alternatives.

What the developer writes

HDC++ builds on Hetero-C++, a parallel dialect of C++. Its hypervectors and hypermatrices have specified dimensions and element types. The paper’s list of 24 primitives covers creation and initialization, arithmetic, coordinate and row access, matrix operations, distance and similarity, and whole stages. A developer can create vectors with random values or supply an initialization function. A rotation moves coordinates around the end of a vector, while a sign operation maps values into a binary representation. These named operations make the application’s intent available to the compiler at the same point where the programmer specifies the data.

The larger operations are called encoding_loop, training_loop and inference_loop. An inference loop, for example, receives the query collection, the class representatives, a place to store predictions and a function that implements inference on general-purpose devices. That implementation function can combine HDC primitives to express whatever comparison and selection the application needs. On compatible dedicated hardware, the stage marker instead gives the compiler an entry to the device’s own inference interface.

Training has a corresponding way to express repeated work over data. Its interface includes queries, labels and the class storage to update, along with an epoch count for implementations that make repeated passes. This is an interface for stating the work and its inputs. The particular training computation can come from the function the programmer supplies or from the operation the accelerator implements. The two hardware accelerators in the paper support specific training procedures, so the stage name alone leaves an application and its target subject to an algorithm compatibility check.

Generic Hetero-C++ constructs supply another level of expression. An application may have an outer loop that processes many items independently, with individual iterations using HDC operations. HyperOMS provides the example. Its level ID encoder has parallelism around the encoding work that the HDC primitives alone do not capture. The outer loop is described using a general parallel construct. This lets the application keep its bespoke encoder while making the independence of its iterations visible.

The same combination helps with partial offload. In HD-Clustering, an accelerator can handle inference, while the program separately expresses updates to cluster representatives and the initial construction of the projection matrix. These pieces can use the CPU or GPU. A single language can describe the application even when the device interface covers only some of the work.

What survives compilation

How HDC++ becomes target code

The steps in order.

How HDC++ becomes target codeStep 1: Describe hypervector operations and parallel work1. Describe hypervector operations and parallel workStep 2: Mark complete encoding, training or inference stages2. Mark complete encoding, training or inference stagesStep 3: Preserve operations inside a hierarchical dataflow graph3. Preserve operations inside a hierarchical dataflow graphStep 4: Apply requested representation or reduction changes4. Apply requested representation or reduction changesStep 5: Lower operations through the selected back ends5. Lower operations through the selected back endsStep 6: Generate device code and host coordination6. Generate device code and host coordination

The intermediate representation, or IR, is the compiler’s description of a program between source code and executable output. HPVM-HDC extends the existing Heterogeneous Parallel Virtual Machine, or HPVM, which in turn uses LLVM. The extension keeps HDC primitives recognizable as LLVM intrinsics, operations with special meaning for the compiler. The HDC++ source marks them with function calls that survive the initial translation to LLVM, where the compiler can replace those calls with the corresponding intrinsics.

HPVM represents the parallel part of the application as a hierarchical directed acyclic graph. Computation sits in nodes, and edges describe where data passes. A node can contain another graph, or it can be a leaf that holds an LLVM function. This hierarchy allows one part of a program to express several parallel tasks while a smaller part expresses parallel work within a task. Edges indicate logical transfers. Whether an edge entails a memory copy depends on how the producer and consumer are placed.

Take the Hamming comparison from the classification example. The compiler can expand the single primitive into an outer loop over classes and an inner loop over coordinates. Each class comparison can proceed independently. HPVM expresses this independence through dynamic instances of the loop’s node function. The node instance identifier supplies the class index. The instance reads the query and the class data and writes the corresponding distance. The inner loop keeps the running mismatch count.

This expansion is useful when the back end needs the underlying loop structure. Other back ends benefit from seeing the original intrinsic. A library that already offers an optimized matrix multiplication can receive a direct call. A dedicated accelerator can receive a functional call for an entire stage. The compiler can therefore select the point at which to expand a primitive based on the target. Keeping an operation intact up to that point preserves information that would be difficult to recover after expansion.

Changing what the vectors store

The first optional transformation is automatic binarization. It starts from the HDC sign primitive, which maps elements to the two values +1 and -1. Representing those values in an ordinary numeric type can consume many more bits than their two states require. Packing them into a one-bit representation changes the format in memory and allows some calculations to use bit-vector logic. Making that change by hand also means updating allocation sizes, downstream operations and any other relevant uses of the data.

The compiler begins with a worklist of sign instructions. It uses an interprocedural analysis, meaning that it can follow the affected values across function boundaries. The analysis marks operations connected to values whose representation is changing. The authors call this taint analysis. The mark indicates that an instruction may need a representation change, and the worklist lets the compiler propagate the mark through other instructions before it rewrites them.

Element-wise operations can be marked on both their inputs and their outputs. A reduction combines multiple inputs into fewer outputs, and the default policy handles it differently. For reductions such as matrix multiplication, cosine similarity and Hamming distance, the analysis propagates the change through outputs by default. The more aggressive option also allows propagation through reduction inputs. That difference lets a programmer try keeping greater precision during a computation while using a narrower result, or try shrinking the representation that enters the computation as well.

After the analysis, the compiler replaces the marked instructions with versions for the chosen reduced bit width. It adjusts allocations where the new representation calls for a different size. For the one-bit case, the lowering uses logical operations on packed representations. This separates deciding to try binarization from finding and editing every affected instruction. The transformation is automatic once requested. Its starting points and the choice of how aggressively to propagate it are part of the configuration.

Changing how many coordinates a calculation visits

Reduction perforation is the other optional transformation. A reduction normally visits every coordinate along the dimension it combines. Perforation instructs the compiler to visit a selected part of that dimension. The programmer attaches red_perf to the value returned by an eligible operation. Its other arguments give the start, end and stride for the selected positions. A stride is the interval between successive visited positions.

The paper illustrates three ways to restrict Hamming distance on 2048-coordinate vectors. A segment can retain the range from 0 up to 1024 with stride 1. A strided comparison can use the full range up to 2048 with stride 2, visiting alternating coordinates. The choices can also be combined, using a stride of 2 within the range ending at 1024. In each case, the directive identifies the result whose calculation is to change. The original distance operation remains visible in the source.

The distance calculation then has the following form.

dᵢ(S) = Σⱼ∈S [zⱼ ≠ Cᵢⱼ]

Here S is the set of coordinates selected by the segment and stride, and j ∈ S means that j is one of those coordinates. The notation dᵢ(S) is the restricted distance to class i. The sum Σ adds the mismatch indicators for the query coordinate zⱼ and class coordinate Cᵢⱼ. As in the full distance, brackets return 1 for a mismatch and 0 for an agreement.

For Hamming distance and cosine similarity, the compiler leaves the resulting scores unscaled. The authors’ reasoning is that the comparisons they encounter use relative scores to choose among candidates. The outcome can still change because the coordinates left out may favor a different candidate. Rescaling every distance by the same positive factor would leave the ordering from the sampled coordinates as it was.

For matrix multiplication and the Euclidean norm, the authors regard the magnitudes as important to subsequent work. Their transformation divides accumulated quantities by the fraction of coordinates visited.

Aₛ = Aᵥ / p

In this expression Aᵥ is the accumulated value from the visited coordinates, p is the fraction of the original reduction coordinates visited, and Aₛ is the scaled accumulation. The rule accounts for the amount of work skipped. Its accuracy still depends on how representative the visited coordinates are for the operation in question. This matters when the approximate result becomes the input to another comparison or arithmetic operation.

Perforation and binarization address different costs. Perforation removes coordinate visits from a reduction. Binarization changes how much space each affected element occupies and which operations can be used on the representation. They can also be combined. A programmer can compare packed vectors in full or compare them on a subset of coordinates. Both transformations are supported on the CPU and GPU paths, whose operations have enough flexibility to change element types and loop ranges.

Turning stages into device calls

On the CPU path, HPVM-HDC expands HDC operations into HPVM subgraphs and uses the existing CPU back end to produce an executable. The expansion can coexist with the general parallel constructs used elsewhere in the application. The performance discussion describes the CPU lowering used in the evaluation as producing sequential machine code. The graph’s expression of available parallelism and the execution strategy used by a particular back end are separate parts of the system.

For NVIDIA GPUs, the compiler has several routes. It can map an HDC primitive to a CUDA kernel or to a routine in cuBLAS or Thrust. The paper describes cuBLAS routines for operations such as matrix multiplication, transposition and normalization, and Thrust routines for reductions. Generic parallel code from Hetero-C++ goes through HPVM’s GPU back end to OpenCL. A single application can use both routes. The difference matters when a computation expressed through the generic path could benefit from a specialized GPU instruction.

The accelerator path uses the whole-stage operations. The digital application-specific integrated circuit, or ASIC, has its own memory and communicates with an ARM host through an FPGA interface. It supports cyclic random projection and uses pipelined Hamming distance in training and inference. The generated host code can configure the device, put the projection and class information in device memory, supply examples and labels during training, and request classifications during inference. In the paper’s example, the shared projection and class data are set up around the loops, while individual examples are supplied inside them.

The resistive RAM, or ReRAM, accelerator has a broadly similar interface and a different implementation. It supports a tensorized form of random projection and summation-based training in one pass. It computes Hamming distances progressively and can stop once the candidates’ relative ordering can no longer change. A large ReRAM array supports the encoding and inference stages. The authors use a simulator that draws on timing and energy parameters extracted for commercial memory macros at the 40nm process node. The digital chip, also fabricated in 40nm technology, is timed directly.

In both cases, the stage marker supplies the boundary at which the compiler can issue the device’s commands and keep shared data in place. On a CPU or GPU, the implementation function supplies the operations for that same part of the application. An accelerator implementation can differ internally from the supplied function, so source portability rests on an agreed stage interface and on the suitability of the target algorithm for the application.

Experiments and results

Workloads, data and measurement

The evaluation asks whether the language can express existing HDC workloads, whether the generated code performs competitively, and what happens when the compiler changes an inference procedure for speed. Those questions use different comparisons. General-purpose performance is measured against existing implementations where they are available. Accelerator timings use the same HDC++ program on an edge GPU as the comparison. The approximation study holds the application fixed and changes the inference configuration.

HD-Classification and HD-Clustering use Isolet, a dataset of spoken letters. Classification predicts a letter using learned class representatives. Clustering uses HDC for a k-means workload. Both use random projection and comparisons with representative hypervectors. Training for classification fits the accelerator interface, and clustering can make use of the encoding and inference operations while retaining its own update procedure. These two workloads provide the comparison across general-purpose hardware and dedicated devices.

HyperOMS uses level ID encoding and inference to search mass spectra for possible matches. Both iPRG2012 and the Yeast and Human Spectral Library dataset are used to evaluate it. RelHD uses graph-neighbor encoding, training and inference for relationship analysis, evaluated on Cora, a collection of categorized scientific papers. HD-Hashtable uses a k-mer-based encoding for sequence search and is evaluated on an adapted Genomics dataset. These workloads broaden the range of encoders and surrounding work tested on the CPU and GPU. Their stages do not match the particular coarse operations that the evaluated accelerators expose.

The general-purpose setup pairs an Intel Xeon Silver 4216 CPU with an NVIDIA GeForce RTX 2080 Ti GPU. The CPU has 16 cores, 32 threads and 192GB of memory. The GPU has 11GB. The digital ASIC runs with its ARM host, while the ReRAM simulator runs on the Intel machine and estimates the latency of the ReRAM device. For the comparison with the accelerators, the authors also use the NVIDIA Jetson AGX Orin 64GB board. Its GPU is meant to represent the class of systems in which the authors expect dedicated HDC devices to be deployed.

The authors report the average wall-clock time across three runs on a system that was otherwise idle. They measure GPU speed relative to a reference implementation of the same application. In the inference study, classification accuracy is the share of predictions that agree with the labels. Counts of source lines serve a separate purpose. They measure the size of the implementations and, in the tuning exercise, the scope of edits needed for selected configuration changes.

Performance against existing CPU and GPU code

The CPU comparison has a difference in execution environment that limits its interpretation. Each available CPU reference uses Python and NumPy, while HPVM-HDC compiles its programs ahead of time. Interpreter overhead can contribute to the observed difference. HyperOMS has no suitable CPU baseline, although the authors compile and run the HDC++ program on the CPU. The paper uses these results to demonstrate coverage of the target and leaves the performance advantage over equivalent compiled CPU implementations unresolved.

The stronger performance comparison is with the four CUDA C++ reference implementations. Across those workloads, the speedup ranges from 0.95x to 1.5x, and the geometric mean is 1.17x. The largest speedup, 1.5x, is for HD-Classification on Isolet. These are results for ordinary compilation, with the approximation transformations disabled. They indicate the performance of the generated implementations relative to the existing tuned programs.

HyperOMS is the GPU case that loses performance. Its HDC++ implementation is 5% slower than the baseline on the evaluated spectral search workload. The authors locate the bottleneck in level ID encoding. The HDC++ version describes its outer work using generic parallel Hetero-C++ constructs, which lower to OpenCL through HPVM. The CUDA baseline uses optimized operations at warp level, coordinating the work of a group of GPU threads in a way the HPVM path cannot generate. This is the part of the application in which a portable expression leaves a specific hardware opportunity unused.

HD-Hashtable has a different GPU reference. That implementation uses Python with CuPy, so it shares the interpretive complication of the CPU comparisons. The authors keep it outside the 1.17x geometric mean for CUDA C++ baselines. They also attribute the performance gains in the CUDA C++ group mainly to differences between the tuning choices used by the compiler and those in the reference programs. The result supports the practical competitiveness of the generated code for this group of applications.

What the accelerator comparison times

For classification and clustering, the authors compare the dedicated devices with an Orin running code from the same HDC++ source. The measured scope is device computation corresponding to the HDC primitives. The host interface on the digital chip runs at roughly 10 kbps because of fabrication cost constraints, and the ReRAM simulator estimates the accelerator’s operation in isolation. Restricting the measurements to device work makes the comparison possible under those conditions.

The paper reports that both dedicated devices are faster than the Orin on the compared work for both Isolet workloads. The advantage is larger for classification. The authors attribute this to the time classification spends training its representatives, a stage for which the accelerators have specific support. Clustering uses the dedicated hardware for a narrower share of its algorithm. The authors also report a faster estimate for ReRAM than the measured digital ASIC result, which they associate with dense on-chip storage and fast reads in the resistive-memory design.

These results demonstrate a working route from the HDC++ description to the supported accelerator operations. They also illustrate why the scope of a timing matters. A large improvement on classification’s training stage and a more limited improvement on clustering’s supported stages reflect differences in the work assigned to the device. The results give device-level evidence for both applications, with direct chip timing for the digital ASIC and a latency estimate for ReRAM.

Speed and accuracy in spoken-letter inference

The approximation experiment uses a different classification setup from the small code example in the method. Here the encoding dimension is 10,240. The authors derive the class hypervectors offline with a single pass over the training data using cosine similarity. They then run GPU inference with different representations, scoring rules and reductions. The reported accuracy concerns predictions made at inference on Isolet. The baseline uses 32-bit floats and cosine similarity and has an accuracy of 0.82.

GPU inference accuracy on Isolet with HD-Classification

The highest reported accuracy among the tested settings exceeds the cosine baseline.

GPU inference accuracy on Isolet with HD-ClassificationCosine similarity baseline: 0.82Cosine similarity baseline0.82Highest reported optimization setting (this paper): 0.89Highest reported optimization setting(this paper)0.89
The numbers
System or settingaccuracy
Cosine similarity baseline0.82
Highest reported optimization setting (this paper)0.89

The sweep includes a result as low as 0.2. All alternative points in the paper’s speed-versus-accuracy plot improve inference speed, with a reported maximum improvement of 3.4x across the GPU inference experiment. Peak speed and peak accuracy are separate observations across the sweep. The numbered settings in the paper describe which operations change, and the authors identify several that improve both speed and accuracy over the reference. Their detailed discussion distinguishes which stage was approximated.

The reported baseline accuracy is on the inference scale from the paper, as are the endpoints 0.2 and 0.89. In discussing changes to encoding, the authors also report an accuracy band of 25-35% for that group of settings. The whole sweep and the encoding subgroup have different scopes. Keeping those scopes visible helps explain what the experiments support. Faster inference was common in the chosen settings, and acceptable accuracy depended on the particular changes.

Source size and the cost of changing an experiment

The aggregate source comparison combines the baseline implementations needed for CPU and GPU and compares them with one retargetable HDC++ program per application. The authors report a geometric mean reduction factor of 1.6x. The counts reflect the available implementations. HyperOMS contributes its GPU reference, and for HD-Hashtable the CPU and GPU reference paths share the same Python code. The paper notes that the HDC++ version can be longer than an individual baseline, particularly a compact Python baseline.

Source lines for Isolet HD-Clustering implementations

The HDC++ implementation is shorter than either device-specific baseline.

Source lines for Isolet HD-Clustering implementationsCPU Python baseline: 426CPU Python baseline426GPU CUDA baseline: 429GPU CUDA baseline429Retargetable HDC++ (this paper): 343Retargetable HDC++ (this paper)343
The numbers
System or settinglines of code
CPU Python baseline426
GPU CUDA baseline429
Retargetable HDC++ (this paper)343

For Isolet HD-Classification, the HDC++ implementation uses 410 lines, compared with 193 in the CPU Python baseline and 608 in the GPU CUDA baseline. The HyperOMS implementation for the spectral search evaluation is 560 lines in HDC++ and 1188 in the CUDA reference. The spread is informative because the comparison concerns different languages and different amounts of device-specific work. A programmer writing CUDA may have to express device memory handling and implement a kernel directly, work the HDC++ compiler can take over for the operations it supports.

The authors also implement selected inference changes manually in the HD-Classification GPU baseline. Changing from cosine similarity to Hamming distance in configuration II requires 25 lines and roughly 30 minutes of work. Implementing configuration III requires 33 lines and approximately 1 hour. That change covers packed class and query representations, the allocations that hold them, and a distance computation for the packed elements. Configuration X, which skips coordinates during cosine similarity, requires changes to 4 lines. These are examples of different kinds of editing, ranging from a loop change to a coordinated update of representation and computation.

For those same configurations, the authors say they could make the corresponding HDC++ changes in seconds with 1-2 source lines. The compiler then handles the associated changes for CPU and GPU. Across the larger sweep, the configuration table also lists settings that require 3 lines. The main advantage in the timed exercise comes from expressing a change at the level of the operation the developer wants to vary. The compiler can then apply it where that operation reaches allocations, executable loops or device routines.

What the ablations show

Changing the representation and the comparison rule

The controlled comparisons focus on GPU inference for HD-Classification. The authors use the same classification task and the same offline preparation of class representatives for the sweep, then vary what inference does with those representatives and its encoded queries. Some settings change one operation. Others bundle changes whose combined effect is meaningful, such as using a Hamming comparison with sign-binarized inputs. The baseline supplies the common point of comparison for both speed and accuracy.

Configuration II changes the metric from cosine similarity to Hamming distance while retaining 32-bit floating-point elements. Configuration III also binarizes the stored class vectors and encoded queries. This puts the smaller representation in a form that can be used by the Hamming computation. The authors report a negligible accuracy change for their discussion of this binarized Hamming approach and place configuration III among the plotted points that improve on baseline accuracy. Together, those observations indicate that the binary representation preserved useful discriminatory information in the evaluated classifier.

The comparison has two distinct questions. Configuration II asks what happens when the scoring rule changes with the element type held fixed. Configuration III supplies a packed representation in addition to the different rule. A difference between the baseline and configuration III therefore belongs to the combined configuration. The reported gains in memory footprint and data movement have a direct connection to packing, while the class predictions are produced by the entire representation and comparison procedure.

Configuration IV retains the binarized approach and casts the input features to 32-bit integers before the encoding step. It tests what happens when the change reaches an earlier boundary than in configuration III. This distinction matters in a compiler pass that can propagate changes through a program. Applying lower precision to a stored encoded vector and altering the features used to create that vector are different interventions, even if both can be described as representation changes. The paper reports the sweep as a collection of settings and identifies the configurations above the baseline, without assigning a separate quantitative contribution to every representation change in prose.

Skipping work before or after encoding

The reduction comparisons provide the clearest evidence about where approximation matters. Configurations V and VI use the binarized Hamming approach and perforate the matrix multiplication during encoding, with strides of 2 and 4, respectively. Configuration IX instead starts from the cosine baseline and perforates encoding with stride 2. In each of these cases, the approximation is made while constructing the query representation. The authors report inference accuracies of 25-35% for the settings they group under encoding perforation.

The similarity-stage settings use their coordinate budget in a different place. Configuration VII uses the binarized approach and visits alternating coordinates for Hamming distance. Configuration VIII uses the first half of the hypervector for Hamming distance. Both preserve the encoding procedure used in configuration III. The paper places both among the settings that exceed baseline accuracy and improve performance. The experiment shows that, under the tested setup, either of these restricted comparisons can retain enough information to make accurate class choices.

Configuration X perforates cosine similarity with stride 2, starting from the floating-point baseline. The authors describe it as producing a 13% accuracy drop with respect to that baseline, the largest drop among the configurations they group under similarity perforation. The stage comparison therefore has a degree of variation within it. Reducing comparison work tends to be more forgiving here, and the outcome still depends on the representation, scoring rule and subset of coordinates.

The structure of the classifier gives a way to read this result. A change in projection can affect the coordinates from which every later comparison is built. Skipping part of a distance calculation leaves the already encoded query and stored representatives intact and removes some terms from the matching score. The experiment establishes a difference in sensitivity for these choices on Isolet. It does not identify which omitted coordinates are responsible for individual errors or establish the same ordering of sensitivities for a different encoder.

The segmented and strided Hamming variants also separate two ways of visiting fewer positions. One takes an initial contiguous portion, and the other takes regularly spaced positions from across the vector. Their success in the experiment shows that the observed tolerance applies to both tested layouts. The comparison gives much less evidence about how to choose a layout for another application, because the tested variants use the same classifier and a particular representation.

What the performance comparisons explain

The general performance study offers two smaller forms of analysis alongside the inference sweep. The GPU slowdown in HyperOMS is traced to the generic path used by level ID encoding and the optimized warp operations in the CUDA reference. This connects the observed result to a concrete back-end difference. It is an implementation analysis, with both generated and handwritten software embodying other tuning choices.

The accelerator comparison links the larger gain in classification to the training work supported by the dedicated hardware. Clustering still benefits from supported operations, but its algorithm includes work outside that interface. This identifies why the coverage of the device interface matters alongside the speed of its operations. It leaves open how much total system time each application would save under a host interface and deployment configuration suited to that device.

The approximation study, by comparison, offers closely related settings within one application. That makes it the paper’s strongest evidence for a distinction between where a change is made and how much it costs. Reducing work in an encoder and reducing work in a final similarity calculation can both save arithmetic. The reported results show that this common implementation property says little by itself about the accuracy impact.

Limitations

Limits the authors state

The authors supply transformations and ways to configure them. Choosing approximations automatically is outside their scope. A programmer decides whether to request binarization, how aggressively to propagate it and which reductions to perforate. The inference sweep illustrates that choice through a collection of example settings. It supplies no exhaustive search for the best achievable speed and accuracy on Isolet. The two transformations are supported on the programmable CPU and GPU paths because those devices can execute the modified operations. The fixed operations of the evaluated dedicated devices leave those transformations outside the accelerator paths.

Accelerator coverage is also limited by algorithm compatibility. The source for all five workloads runs on CPU and GPU, while only classification and clustering match the particular stage operations offered by the two HDC devices. The stage primitives let a developer retain the general application structure and supply software implementations. An accelerator still needs to implement the encoding, training or inference operation the application intends to delegate. The paper demonstrates partial mapping of clustering as well as the more direct mapping of classification.

The device-only measurement is another explicit boundary. The digital device communicates with the ARM host over a link constrained to approximately 10 kbps, and the ReRAM simulator covers the accelerator in isolation. The reported speedups against Orin therefore describe computations on the devices. For the digital ASIC the time comes from measurements on the fabricated chip, whereas for ReRAM it comes from a simulation using extracted parameters. End-to-end accelerator latency, including communication and other host-side work, remains outside those comparisons.

The authors also distinguish the baseline families. Python references limit what they infer from the CPU timings. HD-Hashtable has the same complication on the GPU because its reference uses CuPy. For the CUDA C++ group, the authors attribute the observed advantage mainly to differences in tuning choices. The resulting evidence is a practical comparison with existing code on the evaluated applications and hardware. It leaves open how equivalent implementations would compare under a common tuning procedure.

Limits visible in the experimental setup

The approximation study measures inference for spoken-letter classification with representatives derived offline and with a specified encoding dimension. Different datasets, encoders and training procedures could change the outcome. The paper’s collection of application ports is wider than its accuracy sweep. Porting HyperOMS, RelHD and HD-Hashtable shows that the language handles more than the Isolet workloads. The accuracy evidence for approximation remains tied to the classification experiment.

The strongest stage comparison is also conditional on the particular way each operation is perforated. The settings differ in stride, in whether the selected coordinates form a segment, and in whether the similarity measure is Hamming distance or cosine similarity. The study can localize a large accuracy loss to the tested encoding changes and establish that some tested comparison changes preserve accuracy. It leaves open how much of the observed pattern would persist across other choices of encoding, representation and sampling.

The count of source lines captures a maintenance concern that matters when several hardware versions are needed. Its interpretation depends on what is counted. Separate device programs can include their own allocation and coordination code, and a Python implementation can express an operation more compactly than a C++ dialect. The aggregate count therefore compares the size of the particular sources used in the study. The timed edits offer direct examples of work saved on one GPU baseline and leave broader development costs, such as learning the language or validating a new target, open.

Finally, the timing method makes the evaluation understandable but gives a limited view of variability. The paper reports means of 3 wall-clock runs on an idle system. Its CPU, desktop GPU and edge comparison use particular devices and software paths. An edge deployment could put a different share of time into the host, transfers and surrounding computation. The benchmark results establish the reported comparisons for the chosen implementations. How far those results travel depends on both the hardware interface and the fraction of the application that can use it.

What came after

Subsequent work extending or citing HPVM-HDC remains undocumented here. The authors themselves identify a direction for extending the compiler. They point to proposed accelerators with hardware tuning parameters and suggest that a future back end could expose those parameters alongside the existing software approximations. In the evaluated system, changing element precision or reduction coverage is a CPU or GPU transformation. Extending the same interface to a tunable accelerator would require expressing the settings that its hardware actually supports and measuring their effect on the application’s predictions and runtime. The paper presents this as a direction for future work.

Cite

Cite as Russel Arbore; Xavier Routh; Abdul Rafae Noor; Akash Kothari; Haichao Yang; Weihong Xu; Sumukh Pinge; Minxuan Zhou; Tajana Rosing; and Vikram Adve. 2024. HPVM-HDC: A Heterogeneous Programming System for Accelerating Hyperdimensional Computing. arXiv:2410.15179.

The paper itself, not this page. BibTeX from the library's record of the work. DOI 10.48550/arxiv.2410.15179 · arXiv 2410.15179

@misc{rosing2024hpvm,
  title = {{HPVM-HDC: A Heterogeneous Programming System for Accelerating Hyperdimensional Computing}},
  author = {Russel Arbore; Xavier Routh; Abdul Rafae Noor; Akash Kothari; Haichao Yang; Weihong Xu; Sumukh Pinge; Minxuan Zhou; Tajana Rosing; and Vikram Adve},
  year = {2024},
  doi = {10.48550/arxiv.2410.15179},
  eprint = {2410.15179},
  archivePrefix = {arXiv},
  url = {https://doi.org/10.48550/arxiv.2410.15179}
}

↑ back to top

This page in Markdown https://md.research.elamur.ai/free/en/papers/arbore-2024-hpvm-hdc-heterogeneous-programming-system/