计算机科学 ›› 2017, Vol. 44 ›› Issue (11): 114-119.doi: 10.11896/j.issn.1002-137X.2017.11.018

• 2016 年全国软件与应用学术会议 • 上一篇    下一篇

线程级猜测并行系统代码自动生成工具的设计与实现

王家龙,刘艳红,沈立   

  1. 国防科技大学高性能计算国家重点实验室 长沙410073国防科技大学计算机学院 长沙410073,国防科技大学高性能计算国家重点实验室 长沙410073国防科技大学计算机学院 长沙410073,国防科技大学高性能计算国家重点实验室 长沙410073国防科技大学计算机学院 长沙410073
  • 出版日期:2018-12-01 发布日期:2018-12-01
  • 基金资助:
    本文受国家自然科学基金项目(61272143,61472431)资助

Design and Implementation of Automatic Code Generator for TLS System

WANG Jia-long, LIU Yan-hong and SHEN Li   

  • Online:2018-12-01 Published:2018-12-01

摘要: 虽然线程级猜测(Thread Level Speculation,TLS)执行机制可以简化多线程编程模型接口,并能获得较高的性能加速,但其并行程序的开发仍然比较困难。面向一个高效的软件TLS模型HEUSPEC,研究了代码自动生成工具C2H的设计与实现方法。具体包括3部分内容:首先,为HEUSPEC设计简单的标注语句,标注出可并行段的一些特征;其次,提出将标注语句和可并行段转换为猜测线程函数的算法;最后,设计生成HEUSPEC并行代码的算法。该方法已在开源编译器Clang上实现。面向Rodinia,OmpScr等基准程序的测试结果表明,C2H能够将带有简单标注语句的串行C代码转换为HEUSPEC并行代码,且其性能与手工编写的HEUSPEC并行代码的性能十分接近。

关键词: 线程级猜测,HEUSPEC,源到源编译器,标注语句,Clang

Abstract: Although thread level speculation (TLS) mechanism can simplify the interface of multi-thread programming model and achieve high performance speedup,the development of its parallel program is still a tough task.Oriented to an effective software TLS model HEUSPEC,the design and implementation of automatic code generator C2H,which has three components.First,simple directives are designed for HEUSPEC,which indicates some key characteristics of parallel regions.Second,an algorithm is proposed to convert directives and parallel regions to speculative functions.At last,an algorithm is designed to generate HEUSPEC parallel codes.This method has been implemented on an open source compiler——Clang.Experimental results oriented to typical benchmarks from Rodinia and OmpSrc indicate that C2H can convert serial C codes with simple directives to HEUSPEC parallel codes,and the performance of automatic-generated parallel codes is very close to the codes developed by programmers manually.

Key words: Thread level speculation,HEUSPEC,Source-to-source compiler,Directive,Clang

[1] HAMMOND L,WILLEY M,OLUKOTUN K.Data Speculation Support for a Chip Multiprocessor[C]∥Proceedings of ASPLOS-VIII.1998.
[2] XU F,SHEN L,WANG Z Y.HEUSPEC:a software speculation parallel model [C]∥Proceedings of ICPP.2013.
[3] SHEN L,XU F,ZHANG Z Y.Optimization Strategies Oriented to Loop Characteristics in Software Thread Level Speculation Systems [J].Journal of Computer Science and Technology,2016,31(1):60-76.
[4] LOPES B C,AULER R.Getting Started with LLVM Core Libraries[M].First.35 Livery Street:Packt Publishing Ltd.,2014.
[5] BAE H,MUSTAFA D,LEE J W,et al.The Cetus Source-to-Source Compiler Infrastructure:Overview and Evaluation[J].International Journal of Parallel Programming,2013,1(6):753-767.
[6] CHRIS V.LLVM:An infrastructure for multi-stageoptimization[R].University of Illinois at Urbana-Champaign,2008.
[7] VOUFO L,ZALEWSKI M,LUMSDAINE A.ConceptClang:an implementation of C++ concepts in clang[C]∥Proceedings of 7th ACM SIG-PLAN Workshop on Generic Programming.2011:71-82.
[8] LATTNER C.LLVM and Clang:Next generation compiler tech-nology[C]∥Proceedings of the BSD Conference.2008.
[9] Clang:a C language family frontend for LLVM.http://clang.blvm.org.
[10] GUNTLI C.Architecture of clang[J/OL].www.docin.com/p-163698152m.html.
[11] STEVE N.Clang Internals[R].Apple.Inc.,2009.
[12] 张清泉.基于 Clang 的 C++代码混淆工具设计与实现[D].北京:北京邮电大学,2013.
[13] 张代远.基于 Clang 的 C 语言代码并行化转换工具的设计与实现[D].吉林:吉林大学,2015.
[14] 章磊.Clang 上的 C/C++过程间分析和漏洞挖掘[D].北京:中国科学技术大学,2009.
[15] 王燕燕.OpenMP-to-OpenCL 代码自动转换工具的设计与实现[D].吉林:吉林大学,2015.

No related articles found!
Viewed
Full text


Abstract

Cited

  Shared   
  Discussed   
No Suggested Reading articles found!