Skip to main content

Khronos Blog

Getting Started with Vulkan Compute Acceleration

Background to Compute in Vulkan

Graphics processors have come a long way from simple framebuffer-based 2D display cards to fully programmable high performance devices. One of the most groundbreaking changes in this evolution was the addition of freely programmable compute units, paving the way for general-purpose computations on the GPU (aka “GPGPU”) and leveraging graphics processors for a host of use cases that have traditionally been the domain of CPUs. Today even the lowest-spec GPUs can perform general-purpose computations, running in parallel to other on-chip workloads such as graphics rendering and transfer operations. Compute acceleration has become a central facet of GPU functionality, widely used in software ranging from games to digital content creation to scientific applications.

Vulkan was designed with compute support as a mandatory feature: if a device can run Vulkan, it can run compute shaders. Compute shaders in Vulkan have first class support in the API and can be used for pure computational workloads without any graphical output, aka “headless compute.”

Vulkan brings compute support to a wide diversity of devices and platforms, including:

  • Desktop systems including Windows, Linux and (thanks to MoltenVK ) macOS
  • Mobile platforms such as Android and iOS
  • Embedded systems and industrial safety critical systems via Vulkan SC
  • Select consoles and Raspberry Pi

With Vulkan, GPU compute acceleration is available everywhere!

A New Vulkan Compute Chapter for Vulkan-Tutorial.com

Leveraging a GPU for general-purpose compute acceleration involves quite different programming techniques compared to graphics rendering. To help developers get started with leveraging Vulkan for parallel computing, we have contributed a new chapter on compute shaders to Vulkan-Tutorial.com. This chapter is aimed at both beginners with little to no experience with compute shaders and experienced graphics programmers who want to see how compute acceleration works in Vulkan in practice.

The new Vulkan Compute tutorial steps through how to build a GPU-accelerated particle system simulation, providing insights into:

  • Writing compute shaders that issue compute commands to the GPU
  • Using new object types needed for compute such as shader storage buffer objects and storage images
  • Combining accelerated compute with graphics rendering to display computed results..

The tutorial also covers basic computing-related terms such as compute space, workgroups, invocations, and more. The chapter is filled with easy-to-follow diagrams and code examples and includes a complete working code project to run and modify.

The new chapter is available at this link.

Additional resources

For more advanced samples on how to use compute shaders in Vulkan, check out the official samples repository. Compute capabilities for Vulkan devices can be checked at the community-driven Vulkan hardware database.

Comments