Add temporary errno implementation, refactor copy_to_host/copy_to_device to share some code blobs.
Add temporary errno implementation, refactor copy_to_host/copy_to_device to share some code blobs.


Former-commit-id: 906156d9c9cd925d664e13daf74d9206c243ae3d
darkbuck/Halide,Trass3r/Halide,darkbuck/Halide,darkbuck/Halide,darkbuck/Halide,Trass3r/Halide,darkbuck/Halide,Trass3r/Halide,Trass3r/Halide,darkbuck/Halide,darkbuck/Halide,Trass3r/Halide,Trass3r/Halide,Trass3r/Halide