Large refactor of GPU backends.

Pull out all the logic involving:
- shared memory
- fusing together loops over thread indices and injecting for loops instead
- synchronization between blocks of code on the gpu

and put it earlier in lowering.

Not entirely working yet.
thread-local allocations no longer erroneously treated as shared.
Add missing cache flush on stores in C backend
Fix bug in dimensionality normalization for gpu loops
Add simplification rules min(x, 0) when x > 0 and same for max
Add some more gpu tests

gpu_thread_barrier tests for race conditions

gpu_mixed_dimensionality tries a complex nested schedule on gpu
with a mix of scalar for loops and thread-parallelism
Fix bug where extracted block size bounds depend on inner lets
Add sdiv and mod to OpenCL c
Add correct typecasts for Loads in OpenCL C
Allow renaming of fused variables
Add gpu transpose test

It mostly tests a creative schedule that involves div and mod.
Var("blockidx") -> Var::gpu_blocks()
Take the maximum shared allocation size across block indices.

Is usually waaaay too conservative, but at least it's correct.
Handle thread blocks with a size that depends on the block index.

Takes a max across all possible values of blockidx. Often over-conservative.
Test for shared allocations and thread blocks that depend on blockidx
Comment fixes.
Reorder how max thread count is computed

This simplifies better, and prevents over-conservative bounds.
A test which exercises most types in shared mem
Made the types test test a wider range of values
custom_do_par_for was not respected on osx

Bug popped up while testing opencl backend