Both the level zero and the OpenCL implementations may support SPIR-V counterpart of __ballot() below SPIR-V v1.3 with appropriate extension.
However, there does not seem to be a way to produce SPIR-V with ballot instructions on version v1.2 and below without using chipStar's fork of the llvm-spirv. To get around this limitation the ballot() is put into separate source, compiled to SPIR-V v1.3 and linked at runtime if the device supports it. Consequently, this patch should make the llvm-spirv fork unneeded.
Both the level zero and the OpenCL implementations may support SPIR-V counterpart of __ballot() below SPIR-V v1.3 with appropriate extension.
However, there does not seem to be a way to produce SPIR-V with ballot instructions on version v1.2 and below without using chipStar's fork of the llvm-spirv. To get around this limitation the ballot() is put into separate source, compiled to SPIR-V v1.3 and linked at runtime if the device supports it. Consequently, this patch should make the llvm-spirv fork unneeded.