arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1911.02696cs.DS
收藏

使用SIMD指令高效计算位置布居计数

Efficient Computation of Positional Population Counts Using SIMD Instructions

Marcus D. R. Klarqvist, Wojciech Muła, Daniel Lemire

摘要:

在统计学、机器学习和生物信息学等领域,分类变量经常被表示为独热编码向量。例如,给定8个不同的值,我们将每个值映射到一个字节,其中只有一个位被设置。我们的动机是快速计算这种编码的统计数据。给定k位字的流,我们试图计算对应于索引0、1、2、.处的位值的k个不同和,k-1如果k位字是独热编码的,则总和对应于频率直方图。这个多和问题是人口计数问题的推广,在人口计数问题中,我们寻求所有位值的和。因此,我们将多和问题称为位置人口计数。使用SIMD(单指令,多数据)指令从最近的英特尔处理器,我们描述了算法计算16位的位置人口计数使用不到一半的CPU周期每16位字。对于足够大的输入,我们的最佳方法使用的指令最多减少400倍,比仅使用常规(非SIMD)指令的基线代码快50倍。

英文摘要:

In several fields such as statistics, machine learning, and bioinformatics, categorical variables are frequently represented as one-hot encoded vectors. For example, given 8 distinct values, we map each value to a byte where only a single bit has been set. We are motivated to quickly compute statistics over such encodings. Given a stream of k-bit words, we seek to compute k distinct sums corresponding to bit values at indexes 0, 1, 2, ..., k-1. If the k-bit words are one-hot encoded then the sums correspond to a frequency histogram. This multiple-sum problem is a generalization of the population-count problem where we seek the sum of all bit values. Accordingly, we refer to the multiple-sum problem as a positional population-count. Using SIMD (Single Instruction, Multiple Data) instructions from recent Intel processors, we describe algorithms for computing the 16-bit position population count using less than half of a CPU cycle per 16-bit word. Our best approach uses up to 400 times fewer instructions and is up to 50 times faster than baseline code using only regular (non-SIMD) instructions, for sufficiently large inputs.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑