Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
research-article
Open access

Supporting Unified Shader Specialization by Co-opting C++ Features

Published: 27 July 2022 Publication History

Abstract

Modern unified programming models (such as CUDA and SYCL) that combine host (CPU) code and GPU code into the same programming language, same file, and same lexical scope lack adequate support for GPU code specialization, which is a key optimization in real-time graphics. Furthermore, current methods used to implement specialization do not translate to a unified environment. In this paper, we create a unified shader programming environment in C++ that provides first-class support for specialization by co-opting C++'s attribute and virtual function features and reimplementing them with alternate semantics to express the services required. By co-opting existing features, we enable programmers to use familiar C++ programming techniques to write host and GPU code together, while still achieving efficient generated C++ and HLSL code via our source-to-source translator.

Supplementary Material

seitz (seitz.zip)
Supplemental movie, appendix, image and software files for, Supporting Unified Shader Specialization by Co-opting C++ Features

References

[1]
Amazon Web Services, Inc. 2021. Amazon Lumberyard. https://aws.amazon.com/lumberyard/.
[2]
Apple Inc. 2014. Metal. https://developer.apple.com/documentation/metal.
[3]
Apple Inc. 2021. Metal Shading Language Specification Version 2.3. https://developer.apple.com/metal/Metal-Shading-Language-Specification.pdf
[4]
Sean Baxter. 2021. Circle C++ Shaders. https://github.com/seanbaxter/shaders/blob/master/README.md.
[5]
Lewis Crawford and Michael O'Boyle. 2019. Specialization Opportunities in Graphical Workloads. In Proceedings of the 28th International Conference on Parallel Architectures and Compilation Techniques (Seattle, WA, USA) (PACT 2019). 272--283. https://doi.org/10.1109/PACT.2019.00029
[6]
Al Danial. 2006--2022. cloc. https://github.com/AlDanial/cloc.
[7]
Zachary DeVito, James Hegarty, Alex Aiken, Pat Hanrahan, and Jan Vitek. 2013. Terra: A Multi-Stage Language for High-Performance Computing. In Proceedings of the 34th ACM SIGPLAN Conference on Programming Language Design and Implementation (Seattle, Washington, USA) (PLDI 2013). 105--116. https://doi.org/10.1145/2491956.2462166
[8]
Ramy El Garawany. 2016. Deferred Lighting in Uncharted 4. In ACM SIGGRAPH 2016 Courses (Anaheim, CA, USA) (SIGGRAPH 2016). https://doi.org/10.1145/2897826.2940291 Part of the course: Advances in Real-Time Rendering, Part I.
[9]
Electronic Arts Inc. 2021. Frostbite Engine. https://www.ea.com/frostbite.
[10]
Embark Studios. 2021. Rust GPU. https://github.com/EmbarkStudios/rust-gpu.
[11]
Epic Games, Inc. 2015. Infiltrator Demo. https://www.unrealengine.com/marketplace/en-US/product/infiltrator-demo.
[12]
Epic Games, Inc. 2019. Unreal Engine 4 Documentation. https://docs.unrealengine.com/en-us/.
[13]
T. Foley and Pat Hanrahan. 2011. Spark: Modular, Composable Shaders for Graphics Hardware. ACM Transactions on Graphics 30, 4, Article 107 (July 2011), 12 pages. https://doi.org/10.1145/2010324.1965002
[14]
Yoshihiko Futamura. 1983. Partial Computation of Programs. In RIMS Symposium on Software Science and Engineering (Kyoto, Japan). 1--35. https://doi.org/10.1007/3-540-11980-9_13
[15]
Pat Hanrahan and Jim Lawson. 1990. A Language for Shading and Lighting Calculations. In Computer Graphics (Proceedings of SIGGRAPH 90). 289--298.
[16]
Yong He, Kayvon Fatahalian, and T. Foley. 2018. Slang: Language Mechanisms for Extensible Real-time Shading Systems. ACM Transactions on Graphics 37, 4, Article 141 (July 2018), 13 pages. https://doi.org/10.1145/3197517.3201380
[17]
John Kessenich, Dave Baldwin, and Randi Rost. 2017. The OpenGL© Shading Language (Version 4.50). The Khronos Group Inc. https://www.khronos.org/registry/OpenGL/specs/gl/GLSLangSpec.4.50.pdf
[18]
Roland Kuck and Gerold Wesche. 2009. A Framework for Object-Oriented Shader Design. In Advances in Visual Computing (ISVC 2009). 1019--1030. https://doi.org/10.1007/978-3-642-10331-5_95
[19]
Juan Linietsky, Ariel Manzur, and contributors. 2021. Godot Engine. https://godotengine.org/.
[20]
Emilio López. 2017--2022. hlslpp. https://github.com/redorav/hlslpp.
[21]
Michael D. McCool, Zheng Qin, and Tiberiu S. Popa. 2002. Shader Metaprogramming. In Proceedings of the ACM SIGGRAPH/EUROGRAPHICS Conference on Graphics Hardware (Saarbrucken, Germany) (HWWS '02). 57--68. http://dl.acm.org/citation.cfm?id=569046.569055
[22]
Microsoft. 2014. Shader Model 5.1. https://msdn.microsoft.com/en-us/library/windows/desktop/dn933277(v=vs.85).aspx.
[23]
Microsoft. 2018. Interfaces and Classes. https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/overviews-direct3d-11-hlsl-dynamic-linking-class.
[24]
Microsoft. 2020. Direct3D. https://docs.microsoft.com/en-us/windows/win32/direct3d.
[25]
NVIDIA Corporation. 2007. NVIDIA CUDA Compute Unified Device Architecture Programming Guide. (Jan. 2007). http://developer.nvidia.com/cuda.
[26]
NVIDIA Corporation. 2022. cuda-samples: reduction_kernel.cu. https://github.com/NVIDIA/cuda-samples/blob/b312abaa07ffdc1ba6e3d44a9bc1a8e89149c20b/Samples/2_Concepts_and_Techniques/reduction/reduction_kernel.cu#L633-L1025.
[27]
Arsène Pérard-Gayot, Richard Membarth, Roland Leißa, Sebastian Hack, and Philipp Slusallek. 2019. Rodent: Generating Renderers Without Writing a Generator. ACM Transactions on Graphics 38, 4, Article 40 (July 2019), 12 pages. https://doi.org/10.1145/3306346.3322955
[28]
Matt Pharr. 2004. An Introduction to Shader Interfaces. In GPU Gems, Randima Fernando (Ed.). Addison Wesley, Chapter 32, 537--550.
[29]
Kekoa Proudfoot, William R. Mark, Svetoslav Tzvetkov, and Pat Hanrahan. 2001. A Real-Time Procedural Shading System for Programmable Graphics Hardware. In Proceedings of the 28th Annual Conference on Computer Graphics and Interactive Techniques (SIGGRAPH 2001). 159--170. https://doi.org/10.1145/383259.383275
[30]
Adrian Sampson, Kathryn S. McKinley, and Todd Mytkowicz. 2017. Static Stages for Heterogeneous Programming. Proceedings of the ACM on Programming Languages 1, OOPSLA, Article 71 (Oct. 2017), 27 pages. https://doi.org/10.1145/3133895
[31]
Mark Segal, Kurt Akeley, Chris Frazier, Jon Leech, and Pat Brown. 2017. The OpenGL© Graphics System: A Specification (Version 4.5 (Core Profile) - June 29, 2017). The Khronos Group Inc. https://www.khronos.org/registry/OpenGL/specs/gl/glspec45.core.pdf
[32]
Kerry A. Seitz, Jr., T. Foley, Serban D. Porumbescu, and John D. Owens. 2019. Staged Metaprogramming for Shader System Development. ACM Transactions on Graphics 38, 6 (Nov. 2019), 202:1--202:15. https://doi.org/10.1145/3355089.3356554
[33]
The Clang Team. 2007--2022. LibTooling. https://clang.llvm.org/docs/LibTooling.html.
[34]
The Khronos® SYCL™ Working Group. 2021. SYCL™ 2020 Specification (revision 4). The Khronos Group Inc. https://www.khronos.org/registry/SYCL/specs/sycl-2020/pdf/sycl-2020.pdf
[35]
The Khronos® Vulkan Working Group. 2016. Vulkan 1.0.12 - A Specification. The Khronos Group Inc. https://www.khronos.org/registry/vulkan/specs/1.0/pdf/vkspec.pdf
[36]
Unity Technologies. 2019. Unity User Manual (2019.1). https://docs.unity3d.com/Manual/index.html.

Recommendations

Comments

Information & Contributors

Information

Published In

cover image Proceedings of the ACM on Computer Graphics and Interactive Techniques
Proceedings of the ACM on Computer Graphics and Interactive Techniques  Volume 5, Issue 3
July 2022
198 pages
EISSN:2577-6193
DOI:10.1145/3552302
Issue’s Table of Contents
This work is licensed under a Creative Commons Attribution International 4.0 License.

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 27 July 2022
Published in PACMCGIT Volume 5, Issue 3

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. Heterogeneous Programming
  2. Real-Time Rendering
  3. Shaders
  4. Shading Languages
  5. Unified Programming

Qualifiers

  • Research-article
  • Research
  • Refereed

Funding Sources

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • 0
    Total Citations
  • 306
    Total Downloads
  • Downloads (Last 12 months)115
  • Downloads (Last 6 weeks)13
Reflects downloads up to 04 Oct 2024

Other Metrics

Citations

View Options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Get Access

Login options

Full Access

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media