Merge pull request #601 from sarunyap/fix-shareWithAll-mem-dev-mapping
Remove device mapping from shareWithAll memory
[ROCm/clr commit: ad44a77ed4]
This commit is contained in:
@@ -1808,7 +1808,7 @@ bool ihipStream_t::canSeeMemory(const ihipCtx_t* copyEngineCtx, const hc::AmPoin
|
|||||||
// TODO - pointer-info stores a deviceID not a context,may have some unusual side-effects here:
|
// TODO - pointer-info stores a deviceID not a context,may have some unusual side-effects here:
|
||||||
if (dstPtrInfo->_sizeBytes == 0) {
|
if (dstPtrInfo->_sizeBytes == 0) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else if (dstPtrInfo->_appId != -1) {
|
||||||
#if USE_APP_PTR_FOR_CTX
|
#if USE_APP_PTR_FOR_CTX
|
||||||
ihipCtx_t* dstCtx = static_cast<ihipCtx_t*>(dstPtrInfo->_appPtr);
|
ihipCtx_t* dstCtx = static_cast<ihipCtx_t*>(dstPtrInfo->_appPtr);
|
||||||
#else
|
#else
|
||||||
@@ -1831,7 +1831,7 @@ bool ihipStream_t::canSeeMemory(const ihipCtx_t* copyEngineCtx, const hc::AmPoin
|
|||||||
// TODO - pointer-info stores a deviceID not a context,may have some unusual side-effects here:
|
// TODO - pointer-info stores a deviceID not a context,may have some unusual side-effects here:
|
||||||
if (srcPtrInfo->_sizeBytes == 0) {
|
if (srcPtrInfo->_sizeBytes == 0) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else if (srcPtrInfo->_appId != -1) {
|
||||||
#if USE_APP_PTR_FOR_CTX
|
#if USE_APP_PTR_FOR_CTX
|
||||||
ihipCtx_t* srcCtx = static_cast<ihipCtx_t*>(srcPtrInfo->_appPtr);
|
ihipCtx_t* srcCtx = static_cast<ihipCtx_t*>(srcPtrInfo->_appPtr);
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -61,19 +61,20 @@ int sharePtr(void* ptr, ihipCtx_t* ctx, bool shareWithAll, unsigned hipFlags) {
|
|||||||
|
|
||||||
auto device = ctx->getWriteableDevice();
|
auto device = ctx->getWriteableDevice();
|
||||||
|
|
||||||
#if USE_APP_PTR_FOR_CTX
|
|
||||||
hc::am_memtracker_update(ptr, device->_deviceId, hipFlags, ctx);
|
|
||||||
#else
|
|
||||||
hc::am_memtracker_update(ptr, device->_deviceId, hipFlags);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (shareWithAll) {
|
if (shareWithAll) {
|
||||||
|
// shareWithAll memory is not mapped to any device
|
||||||
|
hc::am_memtracker_update(ptr, -1, hipFlags);
|
||||||
hsa_status_t s = hsa_amd_agents_allow_access(g_deviceCnt + 1, g_allAgents, NULL, ptr);
|
hsa_status_t s = hsa_amd_agents_allow_access(g_deviceCnt + 1, g_allAgents, NULL, ptr);
|
||||||
tprintf(DB_MEM, " allow access to CPU + all %d GPUs (shareWithAll)\n", g_deviceCnt);
|
tprintf(DB_MEM, " allow access to CPU + all %d GPUs (shareWithAll)\n", g_deviceCnt);
|
||||||
if (s != HSA_STATUS_SUCCESS) {
|
if (s != HSA_STATUS_SUCCESS) {
|
||||||
ret = -1;
|
ret = -1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
#if USE_APP_PTR_FOR_CTX
|
||||||
|
hc::am_memtracker_update(ptr, device->_deviceId, hipFlags, ctx);
|
||||||
|
#else
|
||||||
|
hc::am_memtracker_update(ptr, device->_deviceId, hipFlags);
|
||||||
|
#endif
|
||||||
int peerCnt = 0;
|
int peerCnt = 0;
|
||||||
{
|
{
|
||||||
LockedAccessor_CtxCrit_t crit(ctx->criticalData());
|
LockedAccessor_CtxCrit_t crit(ctx->criticalData());
|
||||||
|
|||||||
Verwijs in nieuw issue
Block a user