Lookup copy agent when blit is selected.

Disallow passing agent 0 to avoid any API change.

Change-Id: I704fb2e04cec50500fac41a405c8a7e83a3c9fb5
Este commit está contenido en:
Sean Keely
2022-05-09 17:04:37 -05:00
padre 3ebe99f96d
commit dd671b49e5
Se han modificado 2 ficheros con 20 adiciones y 20 borrados
+14 -15
Ver fichero
@@ -469,25 +469,24 @@ hsa_status_t Runtime::CopyMemory(void* dst, core::Agent* dst_agent, const void*
core::Agent* src_agent, size_t size,
std::vector<core::Signal*>& dep_signals,
core::Signal& completion_signal) {
auto lookupAgent = [this](core::Agent* agent, const void* ptr) {
if (agent == nullptr || flag().discover_copy_agents()) {
hsa_amd_pointer_info_t info;
PtrInfoBlockData block;
info.size = sizeof(info);
PtrInfo(ptr, &info, nullptr, nullptr, nullptr, &block);
// Limit to IPC and GFX types for now. These are the only types for which the application may
// not posess a proper agent handle.
if ((info.type != HSA_EXT_POINTER_TYPE_IPC) && (info.type != HSA_EXT_POINTER_TYPE_GRAPHICS)) {
return agent;
}
return block.agentOwner;
hsa_amd_pointer_info_t info;
PtrInfoBlockData block;
info.size = sizeof(info);
PtrInfo(ptr, &info, nullptr, nullptr, nullptr, &block);
// Limit to IPC and GFX types for now. These are the only types for which the application may
// not posess a proper agent handle.
if ((info.type != HSA_EXT_POINTER_TYPE_IPC) && (info.type != HSA_EXT_POINTER_TYPE_GRAPHICS)) {
return agent;
}
return agent;
return block.agentOwner;
};
dst_agent = lookupAgent(dst_agent, dst);
src_agent = lookupAgent(src_agent, src);
// Lookup owning agent if blit kernel is selected or if flag override is set.
if ((dst_agent == src_agent) || flag().discover_copy_agents()) {
dst_agent = lookupAgent(dst_agent, dst);
src_agent = lookupAgent(src_agent, src);
}
if (dst_agent == nullptr || src_agent == nullptr) return HSA_STATUS_ERROR_INVALID_AGENT;
// At least one agent must be available for operation in the current process.