Vcc, a Clang-based compiler designed to generate executable code in Vulkan

vcc

Vcc: the Vulkan Clang compiler

In the graphics API landscape, Shading languages ​​have faced a limitation, because despite the possibility of writing code in a common subset between GLSL, HLSL and C++, the current restrictions are present.

This is why Vcc was born (Vulkan Clang Compiler) the Vulkan Clang compiler, which is a project that was in development for 3 years, arises as a response to these limitations and challenges. This project seeks not only to overcome expressive restrictions, but to eliminate the very concept of shading languages.

By incorporating the complete language family C / C ++ to Vulkan, Vcc introduces features never before seen in Vulkan shaders, such as physical pointers, generic pointers, real function calls and a complete control flow.

This initiative seeks to bridge the software gap between graphics and compute APIs. By making Vulkan compatible with other GPU computing APIs, Vcc is presented as an important step towards unifying programming in graphics and computing, aligning with the mass adoption and implementation quality that Vulkan is known for.

About VCC

Vcc is a Clang-based compiler designed to generate executable code in Vulkan, its objective is to position itself as a compiler capable of translating C++ code in a representation that can run on GPU that support the Vulkan graphics API. Unlike GPU programming models based on the GLSL and HLSL shader languages, Vcc takes the idea of ​​completely eliminating the use of separate shader languages ​​and provides the ability to directly compile C/C++ code for Vulkan.

Although could be considered a competitor to GLSL and HLSL, The true intention behind this project goes further, since Vcc seeks to incorporate the C/C++ language family into Vulkan, introducing a number of features in Vulkan shaders.

Vcc is simply an interface to Shady, an IR, and a compiler designed to extend SPIR-V with support for the aforementioned constructs. Shady is presented as a relatively conventional IR and includes support for parsing LLVM IR. Handles reduction and emulation of all additional features not found in current versions of SPIR-V 3.

Of course, there are a number of unique features that are only found in shaders. These are exposed in Vcc using intrinsics and annotations, allowing you to write code that interacts with the various features of the Vulkan channel.

The compilation process in Vcc involves the use of the LLVM and Clang project components as interface. For execution on the GPU, Vcc develops its own intermediate shader representation "Shady", along with a dedicated compiler to convert the code to this representation. This approach allows compilation of standard C/C++ code and is complemented by specific built-in functions to take advantage of the capabilities of the GPU.

Vcc stands out for supporting native C/C++ functions to control program flow, even allowing the use of the "goto" instruction. Additionally, it provides the ability to call functions, execute functions recursively, and use various types of pointers, such as physical pointers, tagged pointers, and function pointers. Additionally, it makes it easier to perform arithmetic operations on pointers and determine type layouts in memory.

The Shady shader intermediate representation is based on SPIR-V 3 and is expanded to support special constructs that are inherent to C/C++ features. Emulation is used to implement advanced capabilities that are not directly applicable to SPIR-V. Vcc includes built-in functions and annotations to allow programs to efficiently use the specific capabilities of shaders, thus providing a versatile and powerful environment for developing GPU applications.

Finally, it is worth mentioning that not everything is rosy andIt is essential to take into account some limitations of the implementation. For example, Vcc does not support C++ exceptions, and malloc/free functionality is not available. Additionally, there is a restriction on the portability of functions and pointers between the host system and the GPU. These considerations are crucial when planning the development of applications that use Vcc to ensure an efficient and trouble-free deployment.

If you are interested in knowing more about it, you can consult the site and for those interested in the code, you should know that it is available here


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: AB Internet Networks 2008 SL
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.