Cross-platform compatibility fixes - OpenCL for GPUs is quite particular about memory scoping