Skip to main content
QUICK REVIEW

[논문 리뷰] A Fast x86 Implementation of Select

Prashant Pandey, Michael A. Bender|arXiv (Cornell University)|2017. 06. 03.
Algorithms and Data Compression참고 문헌 10인용 수 4
한 줄 요약

이 논문은 Intel Haswell 전용 명령어인 pdep와 tzcnt를 사용하여 64비트 단어에서 select 연산을 수행하는 매우 최적화된 x86 구현인 PTSelect를 제안한다. 이는 기존 최상위 수준의 머신워드 select 구현 대비 2배에서 4배의 성능 향상을 이룩하며, 지정된 명령어 수가 적고 메모리 접근 효율성이 높아, 단 한 번의 머신워드 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(뒤이어 오는 0의 수 계산) 명령어를 사용하여 4개의 x86 명령어로만 머신워드 select를 구현하는 것.
  • CS-Poppy와 SDSL이라는 두 가지 최신 비트벡터 select 라이브러리에서 기존의 넓은 단어 또는 SSE 기반 select 구현을 PTSelect로 대체하는 것.
  • 지시어 수, 캐시 미스, 메모리 수준의 병렬성에 영향을 분리하기 위해 다양한 비트벡터 크기에서 성능을 측정하는 것.
  • 성능 차이를 설명하기 위해 CPU 지시어 창 활용도와 동시에 발생하는 메모리 접근 패턴을 분석하는 것.
  • Zhou 등(2022)의 CS-Poppy 기반 맞춤형 벤치마크 테스트 세트를 사용하여 구현 간 실행 시간과 메모리 병렬성의 차이를 비교하는 것.
  • 최적화된 기본 연산의 기여도를 분리하기 위해 머신워드 select와 전체 비트벡터 select 성능을 모두 평가하는 것.

실험 결과

연구 질문

  • RQ1PTSelect는 기존 머신워드 select 구현 대비 원시 성능과 지시어 수 측면에서 어떻게 비교되는가?
  • RQ2메모리 지연이 큰 비트벡터에서 지배적인 상황이라도 PTSelect가 왜 다른 구현보다 뛰어난 성능을 내는가?
  • RQ3머신워드 select에서 지시어 수를 줄이면 전체 비트벡터 select 성능에 어느 정도 향상되는가?
  • RQ4지시어 수준의 병렬성과 메모리 수준의 병렬성이 대규모 데이터 구조에서 select 연산의 성능에 어떻게 영향을 주는가?
  • RQ5머신워드 select와 같은 저수준 기본 연산에서 최소한의 지시어 수가 고수준의 유사한 데이터 구조에서 상당한 성능 향상을 이끌 수 있는가?

주요 결과

  • PTSelect는 CS-Poppy와 SDSL 대비 머신워드 select 벤치마크에서 2배에서 4배의 성능 향상을 기록했으며, 지시어 수는 12개로 줄였고, 기존의 80개와 49개에 비해 현저히 적다.
  • CS-Poppy의 기본 머신워드 select를 PTSelect로 대체했을 때 전체 비트벡터 select에서 20%에서 68%의 성능 향상이 이루어졌다.
  • 비트벡터가 커질수록 메모리 수준의 병렬성이 증가함에 따라, 비록 비트벡터 select당 한 번의 머신워드 select만 호출되더라도 성능 향상이 뚜렷하게 나타났다.
  • PTSelect는 평균적으로 8개의 동시 메모리 접근을 가능하게 했고, CS-Poppy는 3개, SDSL은 4개였으며, 이는 짧은 지시어 시퀀스가 CPU의 지시어 창에 더 많은 연산을 수용할 수 있게 해주었기 때문이다.
  • PTSelect의 성능 우월성은 지시어 수가 적다는 것 외에도, 현대 CPU에서 처리량을 높이는 데 기여하는 더 높은 메모리 수준의 병렬성 덕분이다.
  • 결과적으로, 지시어 수와 병렬성은 메모리 지연이 주요 비용이 되는 상황에서도 저수준 기본 연산에서 매우 중요한 요소임을 시사한다.

더 나은 연구,지금 바로 시작하세요

논문 읽기부터 검토까지, 연구 시간을 획기적으로 줄여보세요.

카드 등록 없음 · 무료 플랜 제공

이 리뷰는 AI가 만들고, 인간 에디터가 검토했습니다.