Actually, the standard indicates that if you omit the -cl-std
flag, the program will be compiled for the version of OpenCL C that the target device supports:
If the –cl-std build option is not specified, the CL_DEVICE_OPENCL_C_VERSION is used to select the version of OpenCL C to be used when compiling the program for each device.
If you are using an offline compiler, you are not necessarily targeting a specific device, and the default value is probably implementation defined. There is no OpenCL standard flag for compiling a program using OpenCL C 1.0.
Moreover, the -cl-std
flag indicates which OpenCL C language version should be used when compiling your program. This is completely independent from the format of the bitcode used to store that compiled program. A program could be compiled for 1.0, 1.1 and 1.2 and still generate the same bitcode. Whether it's possible to have a single bitcode that is compatible with all OpenCL devices from 1.0 onwards is not clear from Apple's documentation; they seem to suggest that bitcode is the most portable way of shipping OpenCL binaries, but don't say anything about this kind of compatibility explicitly.