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]
Этот коммит содержится в:
David Yat Sin
2024-09-27 18:19:53 +00:00
родитель e1ffd97abd
Коммит 298ec3d840
2 изменённых файлов: 3 добавлений и 26 удалений
-24
Просмотреть файл
@@ -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;
}
+3 -2
Просмотреть файл
@@ -3370,8 +3370,9 @@ typedef struct hsa_amd_memory_access_desc_s {
*
* Make previously mapped virtual address accessible to specific agents. @p size must be equal to
* size of previously mapped virtual memory handle.
* Calling hsa_amd_vmem_set_access multiple times on the same @p va will overwrite previous
* permissions for all agents
* Calling hsa_amd_vmem_set_access multiple times on the same @p va:
* - Will overwrite permissions for agents specified in @p desc
* - Will leave permissions unchanged for agents not specified in @p desc
*
* @param[in] va previously mapped virtual address
* @param[in] size of memory mapping