merge changes from local -- move gpu local* functions to top of file