Abstract
In recent years, the GPU (graphics processing unit) has evolved into an extremely powerful and flexible processor, with it now representing an attractive platform for general-purpose computation. Moreover, changes to the design and programmability of GPUs provide the opportunity to perform general-purpose computation on a GPU (GPGPU). Even though many programming languages, software tools, and libraries have been proposed to facilitate GPGPU programming, the unusual and specific programming model of the GPU remains a significant barrier to writing GPGPU programs. In this paper, we introduce a novel compiler-based approach for GPGPU programming. Compiler directives are used to label code fragments that are to be executed on the GPU. Our GPGPU compiler, Guru, converts the labeled code fragments into ISO-compliant C code that contains appropriate OpenGL and Cg APIs. A native C compiler can then be used to compile it into the executable code for GPU. Our compiler is implemented based on the Open64 compiler infrastructure. Preliminary experimental results from selected benchmarks show that our compiler produces significant performance improvements for programs that exhibit a high degree of data parallelism.
Similar content being viewed by others
References
Architecture review board, O, Shreiner D, Woo M, Neider J, Davis T (2003) OpenGL programming guide: the official guide to learning OpenGL, 4 edn. Addison-Wesley, Reading
Bhatt AV (2008) Creating a PCI express interconnect. Online available at www.pcisig.com/specifications/pciexpress/technical_library/pciexpress_whitepaper.pdf
Bison (2008) Gnu parser generator. Website. Online available at http://www.gnu.org/software/bison/
Brookgpu (2008) Website. Online available at http://graphics.stanford.edu/projects/brookgpu/
Buck I, Foley T, Horn D, Sugerman J, Fatahalian K, Houston M, Hanrahan P (2004) Brook for gpus: Stream computing on graphics hardware. In: SIGGRAPH ’04: ACM SIGGRAPH 2004 Papers, New York, NY, USA, 2004. ACM, New York, pp 777–786
Flex (2008) The fast lexical analyzer. Website. Online available at http://flex.sourceforge.net/
GPGPU (2008) General-purpose computation using graphics hardware. Website. Online available at http://www.gpgpu.org/
Galoppo N, Govindaraju NK, Henson M, Manocha D (2005) Lu-gpu: Efficient algorithm for solving dense linear systems on graphics hardware. In: ACM/IEEE super computing conference, 2005
Gress A, Zachmann G (2006) Gpu-abisort: Optimal parallel sorting on stream architectures. In: International parallel and distributed processing symposium (IPDPS), 2006
Hall JD, Carr NA, Hart JC (2003) Cache and bandwidth aware matrix multiplication on the gpu. Technical report, UIUCDCS-R-2003-2328, University of Illinois at Urbana-Champaign, April 2003. Online available at ftp://ftp.cs.uiuc.edu/pub/dept/tech_reports/2003/UIUCDCS-R-2003-2328.ps.gz
Harris M (2005) GPU Gems 2: programming techniques for high-performance graphics and general-purpose computation. Addison-Wesley, Reading. Chapter 31: Mapping Computational Concepts to GPUs
Kilgariff E, Fernando R (2005) GPU Gems 2: programming techniques for high-performance graphics and general-purpose computation. Addison-Wesley, Reading. Chapter 30: The GeForce 6 Series GPU Architecture
Lefohn A, Kniss J, Owens J (2005) GPU Gems 2: programming techniques for high-performance graphics and general-purpose computation. Addison-Wesley, Reading. Chapter 33: Implementing Efficient Parallel Data Structures on GPUs
Mark WR, Glanville RS, Akeley K, Kilgard MJ (2003) Cg: A system for programming graphics hardware in a c-like language. In: SIGGRAPH ’03: ACM SIGGRAPH 2003 Papers, New York, NY, USA, 2003. ACM, New York, pp 896–907
McCool M, Toit SD (2004) Metaprogramming GPUs with Sh. AK Peters, Wellesley
McCool MD, Qin Z, Popa TS (2002) Shader metaprogramming. In: HWWS ’02: Proceedings of the ACM SIGGRAPH/EUROGRAPHICS conference on graphics hardware, Aire-la-Ville, Switzerland, 2002, Eurographics Association, pp 57–68
McCormick P, Inman J, Ahrens J, Mohd-Yusof J, Roth G, Cummins S (2007) Scout: a data-parallel programming language for graphics processors. Parallel Comput 33(10–11):648–662
McMahon F (2008) Livermore benchmark. Online available at http://www.netlib.org/benchmark/livermore
Microsoft (2008) DirectX: high-level shading language. Website. Online available at http://www.microsoft.com/windows/directx
Microsoft (2008) Directx: multimedia application programming interfaces. Website. Online available at http://www.microsoft.com/windows/directx/default.mspx
NVIDIA (2008) Cg homepage. Website. Online available at http://developer.nvidia.com/page/cg_main.html
NVIDIA (2008) NVIDIA CUDA homepage. Website. Online available at http://developer.nvidia.com/object/cuda.html
Owens JD, Luebke D, Govindaraju N, Harris M, Kriiger J, Lefohn AE, Purcell TJ (2005) A survey of general-purpose computation on graphics hardware. In: Eurographics 2005, state of the art reports, August 2005, pp 21–51
Peeper C (2008) Introduction to the directx 9 high-level shader language. Website. Online available at http://msdn2.microsoft.com/en-us/library/ms810449.aspx
Peercy M, Segal M, Gerstmann D (2006) A performance-oriented data parallel virtual machine for gpus. In: SIGGRAPH ’06: ACM SIGGRAPH 2006 Sketches, New York, NY, USA, 2006. ACM, New York, p 184
Robert PC, Schoepke S, Bieri H (2007) Hybrid ray tracing—ray tracing using gpu-accelerated image-space methods. In: GRAPP (GM/R), 2007, pp 305–311
Stallman RM, the GCC Developer Community (2008) GNU compiler collection internals. GNU Press, Boston. Online available at http://gcc.gnu.org/onlinedocs
Stallman RM, the GCC Developer Community (2008) Using the GNU compiler collection. GNU Press, Boston. Online available at http://gcc.gnu.org/onlinedocs
Tarditi D, Puri S, Oglesby J (2006) Accelerator: using data parallelism to program gpus for general-purpose uses. In: The 12th international conference on architectural support for programming languages and operating systems, San Jose, California, USA, October 2006, pp 57–68
Author information
Authors and Affiliations
Corresponding author
Rights and permissions
About this article
Cite this article
Lin, YT., Chen, PS. Compiler support for general-purpose computation on GPUs. J Supercomput 50, 78–97 (2009). https://doi.org/10.1007/s11227-008-0252-7
Received:
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s11227-008-0252-7