[cfe-dev] OpenCL & SPIR specific types - proposal and patch
Chris Lattner
clattner at apple.com
Tue Oct 16 14:08:35 PDT 2012
On Oct 16, 2012, at 8:17 AM, "Villmow, Micah" <Micah.Villmow at amd.com> wrote:
> Mon Ping,
> I think you are misunderstanding the point of SPIR. Backends themselves should not be handling SPIR. SPIR should be lowered to valid LLVMIR for your platform, and then optimizations can be applied to the resulting LLVMIR. It is in this loading that you can convert from spir.sampler_t into an i32 and then constant propagation will work just like normal. One reason why sampler_t is an opaque type is that different vendors have different implementations and some do not want their implementations to be a i32, but want to represent it closer to their hardware.
Hi Micah,
I don't care or have any opinion about samplers, but we're not going to start disabling specific optimizations in LLVM based on type names.
If SPIR builds on top of LLVM, it will need to follow the design and approach of LLVM. Also, expecting a "loader" to swizzle types on something is just plain weird, because it will throw off all sorts of things in the optimizer. You can't expect to change a pointer to some other type after optimizations have run.
If your notion is that SPIR is not intended to be "valid IR" but that it is "lowered to" valid IR, then there is a bigger problem.
-Chris
More information about the cfe-dev
mailing list