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.

ronen/Halide,psuriana/Halide,ronen/Halide,ronen/Halide,jiawen/Halide,jiawen/Halide,kgnk/Halide,ronen/Halide,ronen/Halide,psuriana/Halide,jiawen/Halide,ronen/Halide,psuriana/Halide,kgnk/Halide,psuriana/Halide,psuriana/Halide,psuriana/Halide,ronen/Halide,psuriana/Halide,kgnk/Halide,kgnk/Halide,jiawen/Halide,kgnk/Halide,jiawen/Halide,ronen/Halide,jiawen/Halide,kgnk/Halide,jiawen/Halide,kgnk/Halide,kgnk/Halide