Fix HIP_INIT_API and ihipLogStatus calls

[ROCm/clr commit: fd6c09602f]
This commit is contained in:
Ben Sander
2016-09-22 10:37:54 -05:00
parent 03866f0ee5
commit e32f07802e
+11 -11
View File
@@ -65,13 +65,10 @@ hipError_t hipDeviceCanAccessPeer (int* canAccessPeer, hipCtx_t thisCtx, hipCtx_
// Remove this device from peer device peerlist.
hipError_t ihipDisablePeerAccess (hipCtx_t peerCtx)
{
HIP_INIT_API(peerCtx);
hipError_t err = hipSuccess;
auto thisCtx = ihipGetTlsDefaultCtx();
if ((thisCtx != NULL) && (peerCtx != NULL)) {
// Return true if thisCtx can access peerCtx's memory:
bool canAccessPeer = peerCtx->getDevice()->_acc.get_is_peer(thisCtx->getDevice()->_acc);
if (! canAccessPeer) {
@@ -92,16 +89,15 @@ hipError_t ihipDisablePeerAccess (hipCtx_t peerCtx)
err = hipErrorInvalidDevice;
}
return ihipLogStatus(err);
return err;
};
//---
// Allow the current device to see all memory allocated on peerDevice.
// Allow the current device to see all memory allocated on peerCtx.
// This should add this device to the peer-device peer list.
hipError_t ihipEnablePeerAccess (hipCtx_t peerCtx, unsigned int flags)
{
HIP_INIT_API(peerCtx, flags);
hipError_t err = hipSuccess;
if (flags != 0) {
@@ -112,6 +108,7 @@ hipError_t ihipEnablePeerAccess (hipCtx_t peerCtx, unsigned int flags)
err = hipErrorInvalidDevice; // Can't enable peer access to self.
} else if ((thisCtx != NULL) && (peerCtx != NULL)) {
LockedAccessor_CtxCrit_t peerCrit(peerCtx->criticalData());
// Add thisCtx to peerCtx's access list so that new allocations on peer will be made visible to this device:
bool isNewPeer = peerCrit->addPeer(thisCtx);
if (isNewPeer) {
am_memtracker_update_peers(peerCtx->getDevice()->_acc, peerCrit->peerCnt(), peerCrit->peerAgents());
@@ -123,7 +120,7 @@ hipError_t ihipEnablePeerAccess (hipCtx_t peerCtx, unsigned int flags)
}
}
return ihipLogStatus(err);
return err;
}
@@ -132,6 +129,7 @@ hipError_t hipMemcpyPeer (void* dst, hipCtx_t dstCtx, const void* src, hipCtx_t
{
HIP_INIT_API(dst, dstCtx, src, srcCtx, sizeBytes);
// TODO - move to ihip memory copy implementaion.
// HCC has a unified memory architecture so device specifiers are not required.
return hipMemcpy(dst, src, sizeBytes, hipMemcpyDefault);
};
@@ -141,6 +139,8 @@ hipError_t hipMemcpyPeer (void* dst, hipCtx_t dstCtx, const void* src, hipCtx_t
hipError_t hipMemcpyPeerAsync (void* dst, hipCtx_t dstDevice, const void* src, hipCtx_t srcDevice, size_t sizeBytes, hipStream_t stream)
{
HIP_INIT_API(dst, dstDevice, src, srcDevice, sizeBytes, stream);
// TODO - move to ihip memory copy implementaion.
// HCC has a unified memory architecture so device specifiers are not required.
return hipMemcpyAsync(dst, src, sizeBytes, hipMemcpyDefault, stream);
};
@@ -163,7 +163,7 @@ hipError_t hipDeviceDisablePeerAccess (int peerDeviceId)
{
HIP_INIT_API(peerDeviceId);
return ihipDisablePeerAccess(ihipGetPrimaryCtx(peerDeviceId));
return ihipLogStatus(ihipDisablePeerAccess(ihipGetPrimaryCtx(peerDeviceId)));
}
@@ -171,7 +171,7 @@ hipError_t hipDeviceEnablePeerAccess (int peerDeviceId, unsigned int flags)
{
HIP_INIT_API(peerDeviceId, flags);
return ihipEnablePeerAccess(ihipGetPrimaryCtx(peerDeviceId), flags);
return ihipLogStatus(ihipEnablePeerAccess(ihipGetPrimaryCtx(peerDeviceId), flags));
}
@@ -192,12 +192,12 @@ hipError_t hipCtxEnablePeerAccess (hipCtx_t peerCtx, unsigned int flags)
{
HIP_INIT_API(peerCtx, flags);
return ihipEnablePeerAccess(peerCtx, flags);
return ihipLogStatus(ihipEnablePeerAccess(peerCtx, flags));
}
hipError_t hipCtxDisablePeerAccess (hipCtx_t peerCtx)
{
HIP_INIT_API(peerCtx);
return ihipDisablePeerAccess(peerCtx);
return ihipLogStatus(ihipDisablePeerAccess(peerCtx));
}