I have a few thoughts on this snippet (sorting):

* I think we should add a test that covers this sort. This will be really important for some OpenCL implementations that care about the alignment of local pointers. The particular issue I'm aware of is a performance issue, not correctness, so it might be somewhat difficult to test without simply asserting alignment.
* Sorting the array to ensure alignment relies on the alignment of the base pointer being sufficiently aligned for the largest type. I'm worried that the OpenCL compiler might align the local blob based on the type of the declared pointer in the kernel args, which is a uint8 for us. PTX probably won't have an issue here since it seems to always be zero.