P4 to Git Change 1587799 by vsytchen@vsytchen-win10 on 2018/07/31 14:47:31
P4 to Git Change 1587799 by vsytchen@vsytchen-win10 on 2018/07/31 14:47:31

	SWDEV-145570 - [HIP] refactor hipMemcpy* functions to correctly handle copies using prepinned memory

	The current implementation of hipMemcpy functions picks the copy type based on a flag that the user passes. However, one can use the hipMemcpyHostToDevice/hipMemcpyDeviceToHost flag in a combination with prepinned memory. By using the WriteMemoryCommand/ReadMemoyCommand in this case, we will pin the same host memory twice. This is fine on PAL/Linux, since pinning the same VA range is a noop, but this will start failing once we switch to using device memory with HIP/VDI/HSA.

	The solution is to ignore the hipMemcpyKind flag and let the runtime decide what kind of copy is best to do. Except for the case when hipMemcpyHostToHost is passed, since both host pointers may be prepinned.

	ReviewBoardURL = http://ocltc.amd.com/reviews/r/15482/diff/

Affected files ...

... //depot/stg/opencl/drivers/opencl/api/hip/hip_memory.cpp#37 edit

ROCm-Developer-Tools/HIP,ROCm-Developer-Tools/HIP,ROCm-Developer-Tools/HIP,ROCm-Developer-Tools/HIP,ROCm-Developer-Tools/HIP