Finding out Compute version from OpenCL


I’m doing some inline PTX in an OpenCL kernel, using funnel shift. Therefore Compute 3.5 and up is required.

The only thing I can think of now is to just try and compile it (opencl does this at runtime), and roll back to a non-asm optimized version if compilation fails for devices < Compute 3.5.

But is there a more elegant way of figuring out the Compute version in OpenCL, either host or device-side?