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.
翻译:现代统一编程模式(如CUDA和SYCL)将主机代码和 GPU 代码合并成相同的编程语言、相同文档和相同的词汇范围,对于GPU代码专业化缺乏足够的支持,而GPU代码专业化是实时图形中的关键优化。此外,目前用于实施专业化的方法没有转化为统一的环境。在本文件中,我们在 C++ 中创建了统一的阴暗编程环境,通过共同选择 C++的属性和虚拟功能功能功能,并用其他的语义来重新实施它们来表达所需的服务,为专业化提供一流的支持。我们通过将现有的功能相互选用,使程序员能够使用熟悉的 C++ 编程技术共同写主机代码和 GPU代码,同时通过我们的源到源翻译实现高效生成的 C++ 和 HLSLSL代码。