Skip to main content
QUICK REVIEW

[論文レビュー] A Fast x86 Implementation of Select

Prashant Pandey, Michael A. Bender|arXiv (Cornell University)|Jun 3, 2017
Algorithms and Data Compression参考文献 10被引用数 4
ひとこと要約

本稿では、Intel Haswell固有の2命令(pdepおよびtzcnt)を含む4命令のみを用いて64ビットワード上のselect演算を高度に最適化したx86実装、PTSelectを提示する。従来の最先端のマシンワードselect実装よりも2倍から4倍の高速化を達成し、命令レベル並列性およびメモリアクセス効率の向上により、1回のビットベクトルselectあたり1回のマシンワードselectしか呼び出さないにもかかわらず、全ビットベクトルselect操作において20%から68%の性能向上を実現した。

ABSTRACT

Rank and select are fundamental operations in succinct data structures, that is, data structures whose space consumption approaches the information-theoretic optimal. The performance of these primitives is central to the overall performance of succinct data structures. Traditionally, the select operation is the harder to implement efficiently, and most prior implementations of select on machine words use 50--80 machine instructions. (In contrast, rank on machine words can be implemented in only a handful of instructions on machines that support POPCOUNT.) However, recently Pandey et al. gave a new implementation of machine-word select that uses only four x86 machine instructions; two of which were introduced in Intel's Haswell CPUs. In this paper, we investigate the impact of this new implementation of machine-word select on the performance of general bit-vector-select. We first compare Pandey et al.'s machine-word select to the state-of-the-art implementations of Zhou et al. (which is not specific to Haswell) and Gog et al. (which uses some Haswell-specific instructions). We exhibit a speedup of 2X to 4X. We then study the impact of plugging Pandey et al.'s machine-word select into two state-of-the-art bit-vector-select implementations. Both Zhou et al.'s and Gog et al.'s select implementations perform a single machine-word select operation for each bit-vector select. We replaced the machine-word select with the new implementation and compared performance. Even though there is only a single machine- word select operation, we still obtained speedups of 20% to 68%. We found that the new select not only reduced the number of instructions required for each bit-vector select, but also improved CPU instruction cache performance and memory-access parallelism.

研究の動機と目的

  • 要約データ構造におけるselect演算の性能を向上させること。これはその実用的効率にとって不可欠である。
  • 従来50~80命令も必要とされる遅いマシンワードselect実装が引き起こす性能ボトルネックを解消すること。
  • 新規に高度に最適化されたマシンワードselect実装(PTSelect)が、エンドツーエンドのビットベクトルselect性能に与える影響を評価すること。
  • 命令数とメモリレベル並列性が、大規模なビットベクトル操作における性能に与える影響を調査すること。

提案手法

  • Intel Haswellで導入されたpdep(並列ビット寄与)およびtzcnt(トレーリングゼロカウント)を用いて、x86命令を4命令のみでマシンワードselectを実装する。
  • 2つの最先端のビットベクトルselectライブラリ(CS-PoppyおよびSDSL)において、従来のブロードワードまたはSSEベースのselect実装をすべてPTSelectに置き換える。
  • ビットベクトルサイズを変化させることで、命令数、キャッシュミス、メモリレベル並列性の影響を分離して性能を測定する。
  • CPUの命令ウィンドウ利用率および同時に発生するメモリアクセスパターンを分析し、性能差の理由を説明する。
  • ZhouらのCS-Poppyに基づくカスタムベンチマークスイートを用いて、実行時間およびメモリ並列性を各実装間で比較する。
  • マシンワードselectおよび全ビットベクトルselectの両方の性能を評価し、最適化されたプリミティブの貢献度を分離する。

実験結果

リサーチクエスチョン

  • RQ1PTSelectは、従来のマシンワードselect実装と比較して、実行性能および命令数の点でどのように異なるか?
  • RQ2メモリ遅延が大規模なビットベクトルにおいて支配的であるにもかかわらず、なぜPTSelectは他の実装を上回る性能を発揮するのか?
  • RQ3マシンワードselectにおける命令数の削減が、全体のビットベクトルselect性能にどの程度向上をもたらすのか?
  • RQ4命令レベル並列性およびメモリレベル並列性は、大規模なデータ構造におけるselect演算の性能にどのように影響を与えるか?
  • RQ5マシンワードselectのような低レベルプリミティブにおいて、最小限の命令数が、上位レベルの要約データ構造における顕著な性能向上をもたらす可能性はどの程度か?

主な発見

  • PTSelectは、CS-PoppyおよびSDSLのマシンワードselectベンチマークにおいて、12命令というわずかな命令数で実現したにもかかわらず、それぞれ2倍から4倍の高速化を達成した。
  • CS-PoppyのデフォルトマシンワードselectをPTSelectに置き換えた場合、全ビットベクトルselectの性能向上は20%から68%にのぼった。
  • 1回のビットベクトルselectあたり1回のマシンワードselectしか呼び出さないにもかかわらず、ビットベクトルが大きくなるとメモリレベル並列性が増加するため、性能向上が顕著に現れた。
  • PTSelectは平均して8回の並列メモリアクセスを可能にしたのに対し、CS-Poppyは3回、SDSLは4回であった。これは、短い命令列がCPUの命令ウィンドウにより多くの命令を収容できるためである。
  • PTSelectの性能優位性は、命令数の削減だけでなく、現代CPUにおけるスループットを高めるメモリレベル並列性の向上にも起因している。
  • 結果から、命令数と並列性は、メモリ遅延が主なコスト要因であっても、低レベルプリミティブにおいて極めて重要な要因であることが示唆された。

より良い研究を、今すぐ始めましょう

論文の読解から最終レビューまで、研究時間を劇的に削減しましょう。

クレジットカード登録不要

このレビューはAIが作成し、人間の編集者が確認しました。