推测多线程(Speculative Multithreading,SpMT)技术是一种实现非规则程序自动并行化的有效途径.然而,如何有效评估由诸如控制、数据依赖等因素导致的多种并行开销并实现最优线程划分一直是制约加速比性能提升的关键问题.基于启发式规则的传统划分方法虽然可以取得一定的加速效果,但由于启发式规则只能对多种并行开销进行定性评估,因而导致只能得到经验上较优的线程划分.针对传统划分方法的局限性,文中首次提出并实现了一种基于模糊聚类的线程划分方法.在该方法中,作者首先提出一种评估模型来定量评估各种并行开销,然后通过深入分析各种并行开销来确定最佳的线程解搜索空间,最终利用聚类方法实现有效线程解空间搜索以求取更优的线程划分.基于Olden程序集的测试结果表明,文中提出的线程划分方法可以有效地对非规则程序进行划分,其平均加速比可达到1.85.
Speculative multithreading (SpMT) technology is an effective mechanism for automatic parallelization of irregular programs. While speculative parallelization can potentially deliver significant speedup for irregular programs, several overheads associated with this technique can limit these speedups in practice. Because finding optimum thread partitioning results is NP-complete, most existing thread partitioning methods are still based on simple heuristics rules to select speculative threads. However, these heuristics rules can only be used to indirectly estimate the speculative multithreaded execution overheads and tackle individual overheads, these methods can only get the empirical optimal speculative thread solution. For the limitation of existing methods, in this paper, we first propose a fuzzy c-means (FCM) algorithm based thread partitioning method which can be used to effectively search the solution space of speculative threads and get the optimal solution. With combining the heuristic rules, we compress the solution space of speculative threads based on the analysis of several overheads. Meanwhile, in order to apply the FCM algorithm, we design and implement the cluster validity function by introducing a cost model. The experimental results show that the proposed method can effectively search the solution space of speculative threads and we can indeed get better performance. We achieve an average speedup of 1.85 on Olden benchmark suits.
Function calls in threads adopt the shared stack model in speculative multithreading based on Chip Multi-Processor.A separate stack model is presented to eliminate the locking problem in the shared stack model,in which one core is associated with one stack on a one-to-one basis and the cooperation of those stacks supports the function calls in speculative multithreading.The stack memory management is achieved by means of adding two instructions to the speculative multithreading simulator so that the locking problem can be effectively eliminated.The compiler is modified to generate appropriate code to ensure the semantic correctness of the program,and the two instructions,get and update,are added to the simulator that supports speculative multithreading to manage the corresponding stack memory.Since the locking problem in the separate stack model is eliminated,the number of determinate threads spawned increases in various degrees and the parallel speedup of the program is increased.Experimental results show that the average speedup of the Olden benchmark suite is increased by 3.85%.However,since factors that affect the parallel speedup are complex,there are some cases that the parallel speedup decreases in the separate stack model.
Speculative multithreading(SpMT) technology is an effective mechanism for automatic parallelization of irregular programs.However,just generating speculative threads based on the control flow graph which only contains branch probability information,it is inevitable that there may be excessive constraints resulting from control and data dependence in practice.Therefore,it is very important to understand the trade-offs between different speculative paths.In this paper,by introducing the data dependence model and discussing the trade-offs between different speculative paths,we propose a novel cost estimation based speculative path prediction method which comprehensively takes account of control-and data-dependence.By this method,we attempt to seek a speculative path which has the minimum cost overhead.The experimental results show that there are interesting trade-offs between different speculative paths and we can indeed get better performance.On average,we achieve 2.43% performance improvement.