fix bugs in P2P implementation

- addPeers polarity reversed, would never add.
- check allow_access return value, pipe error to hipMalloc.


[ROCm/hip commit: 7886c9e3d9]
This commit is contained in:
Ben Sander
2016-04-09 04:10:57 -05:00
parent b98a6bd1cd
commit 70108729ba
3 changed files with 13 additions and 8 deletions
+3 -1
View File
@@ -214,7 +214,8 @@ template<>
bool ihipDeviceCriticalBase_t<DeviceMutex>::addPeer(ihipDevice_t *peer)
{
auto match = std::find(_peers.begin(), _peers.end(), peer);
if (match != std::end(_peers)) {
if (match == std::end(_peers)) {
// Not already a peer, let's update the list:
_peers.push_back(peer);
recomputePeerAgents();
return true;
@@ -230,6 +231,7 @@ bool ihipDeviceCriticalBase_t<DeviceMutex>::removePeer(ihipDevice_t *peer)
{
auto match = std::find(_peers.begin(), _peers.end(), peer);
if (match != std::end(_peers)) {
// Found a valid peer, let's remove it.
_peers.remove(peer);
recomputePeerAgents();
return true;