rocr/vmm: Only modify permisions for specified agents

When hsa_amd_vmem_set_access is called, do not remove permissions for
unspecified agents. Also updating documentation in header to clarify
this.

Change-Id: I3bb4cf08ba399f85cc67b17fd13a4a40d862415f


[ROCm/ROCR-Runtime commit: 73f6bfa747]
This commit is contained in:
David Yat Sin
2024-09-27 18:19:53 +00:00
parent e1ffd97abd
commit 298ec3d840
2 changed files with 3 additions and 26 deletions
@@ -3388,30 +3388,6 @@ Runtime::VMemorySetAccessPerHandle(void *va, MappedHandle &mappedHandle,
}
}
}
// Remove agents that were previously allowed but not included in current list
for (auto agentPermsIt = mappedHandle.allowed_agents.begin();
agentPermsIt != mappedHandle.allowed_agents.end();) {
bool agent_removed = true;
for (int i = 0; i < desc_cnt; i++) {
Agent *checkAgent = Agent::Convert(desc[i].agent_handle);
if (agentPermsIt->first == checkAgent) {
agent_removed = false;
break;
}
}
if (agent_removed) {
if (agentPermsIt->second.RemoveAccess() != HSA_STATUS_SUCCESS)
throw AMD::hsa_exception(HSA_STATUS_ERROR, "Failed to remove access for memory handle.");
agentPermsIt = mappedHandle.allowed_agents.erase(agentPermsIt);
} else {
++agentPermsIt;
}
}
return HSA_STATUS_SUCCESS;
}