This sample shows how to use the AMD_shader_ballot extension and mbcnt to perform a fast reduction within a wavefront.

For more information about Vulkan®, visit our dedicated page:

Vulkan®

Vulkan® gives software developers control over the performance, efficiency, and capabilities of AMD Radeon™ GPUs and multi-core CPUs.

Extension details

  • mbcnt computes the number of bits set in the provided argument, masked with a thread mask which contains 1 for all active threads less than the current thread within a wavefront.
  • ballot returns a 64-bit mask which contains 1 if that thread within the wavefront passed true into the instruction, and 0 otherwise.

Requirements

  • AMD Radeon™ GCN-based GPU (HD 7000 series or newer)
    • Or other Vulkan® compatible discrete GPU.
  • 64-bit Windows® 7 (SP1 with the Platform Update), Windows® 8.1, or Windows® 10.
  • Visual Studio® 2013 or Visual Studio® 2015.
  • Graphics driver with Vulkan® support
    • For example, AMD Radeon™ Software Crimson Edition 16.5.2 or later.
  • The Vulkan® SDK must be installed.