On the choice of the best chunk size for the speculative execution of loops

PLoS One. 2022 May 17;17(5):e0267602. doi: 10.1371/journal.pone.0267602. eCollection 2022.

Abstract

Loops are a rich source of parallelism. Unfortunately, many loops cannot be safely parallelized at compile time because the compiler is not able to guarantee that there will be no dependence violations. Thread-Level Speculation (TLS) techniques, either hardware or software-based, allow the parallel execution of non-analyzable loops, issuing the execution of blocks of consecutive iterations (called chunks) while a hardware or software monitor ensures that no dependence violations arise. If such a dependence violation occurs, the chunk that was fed with incorrect values is discarded and re-started, in order to consume the correct information. In the speculative execution of non-analyzable loops, it is very important to correctly choose the chunk size, because this choice dramatically affects the performance of the parallel execution. Bigger chunks imply less scheduling overheads, but smaller chunks allow fewer calculations to be discarded in the event of a dependence violation. To find a good chunk size is not a simple task, because loops may present dependencies that cannot be detected at compile time. In this paper, we present a comprehensive evaluation of different scheduling methods to estimate the optimal chunk size in the speculative execution of non-analyzable loops. This evaluation ranges from the simple, classical methods originally devised to achieve load balancing in loops with no dependencies, to methods that make some assumptions on the distribution pattern of dependencies, such as Meseta and Just-in-Time scheduling. We also propose and evaluate a general, more complex method called Moody Scheduling, that does not require a-priori assumptions to achieve the highest performance.

Publication types

  • Research Support, Non-U.S. Gov't

MeSH terms

  • Computers
  • Memory*
  • Software*

Associated data

  • figshare/10.6084/m9.figshare.19646337.v1

Grants and funding

D. R. L: TIN2017-88614-R, Ministerio de Economıá, Industria y Competitividad (Spain), https://www.mineco.gob.es/. D. R. L: VA082P17, Junta de Castilla y León (Spain), https://www.jcyl.es D. R. L: VA226P20, Junta de Castilla y León (Spain), https://www.jcyl.es D. O.: PID2019-104129GB-I00 / AEI / 10.13039/501100011033, Ministerio de Ciencia e Innovación, (Spain), https://www.ciencia.gob.es/ The funders had no role in study design, data collection and analysis, decision to publish, or preparation of the manuscript.