[LLVMdev] [cfe-dev] SPIR provisional specification is now available in the Khronos website
pekka.jaaskelainen at tut.fi
Thu Sep 27 00:41:29 PDT 2012
On 09/26/2012 08:21 PM, Villmow, Micah wrote:
> It is my view that this is an implementation detail and not an issue
> with the SPIR spec. As SPIR is just a representation of a program in a
> portable manner, it is up to the consumer of SPIR to correctly set up
> the kernels based on the devices calling convention/ABI when the SPIR
> binary is loaded for that specific device.
The question was not about implementing the automatic locals (which is
a device specific detail, like you correctly state), but enforcing LLVM IR
for the automatic locals that potentially leads to illegal optimizations
due to the inadequate semantics of global variables for this use.
If SPIR enforces this type of bitcode for the automatic locals, it means when
such optimizations do happen (the optimizations might be beneficial in
general so they cannot be just disabled due to the SPIR flaw), the
implementers have to work around them with kludges to implement the real
automatic local semantics. What's worse, at some point there might be
an optimization that is not easily worked around which makes this part of the
SPIR specs look bad.
Of course it's possible the constantGEP case was the only problem we will
ever get from this issue, but I wouldn't rely on it in an IR standard
specification if it's possible to avoid it.
More information about the llvm-dev