8111fd3b8b
When shareWithAll memory (e.g., host memory) is allocated, set appId in hc::AmPointerInfo to -1 to indicate that this memory is not mapped to any device. Peer checking in ihipStream_t::canSeeMemory is not necessary if memory is shared with all devices. Thus, it is skipped. Note that earlier host memory is always mapped to device 0 and HIP always performs peer checking for all kinds of hipMemcpy. Since the peer checking process requires context locking, hipMemcpy from/to host memory always grabs device 0's context lock. Therefore, if there is another thread holding the context lock of device 0 (e.g., hipDeviceSynchronize on device 0), hipMemcpy will have to wait for the lock until it can actually perform memcpy. This can significantly deteriorate execution performance. Signed-off-by: Sarunya Pumma <sarunya.pumma@amd.com>