compute 1.x: pass shapes of free arrays as kernel parameters
bug fix: permute launch configuration

thread launch configuration should be based on the size of the source array, not the defaults
roll our own context

store device properties and weak pointer so that we don't need to continually recreate these things on every invocation of 'run'.
cleanup some of the foreign function stuff

- don't do case handling inline with the pattern match
- trailing whitespace, wibbles
tidy codegen for foreign functions

- don't handle case matches inline
- collect foreign headers as we go instead of in a second pass