Discovered agent handles should only apply to copy routing, not to
copy device selection.  The user may not have mapped all allocations
to all GPUs so we must ensure that the copying device is one passed
by the user.

Change-Id: I2532e66d30e6842624e594f235dd144a186220d4
Этот коммит содержится в:
Sean Keely
2022-07-05 22:49:21 -05:00
родитель dec37625ed
Коммит a8603b9397
2 изменённых файлов: 8 добавлений и 11 удалений
+4 -2
Просмотреть файл
@@ -1609,8 +1609,10 @@ lazy_ptr<core::Blit>& GpuAgent::GetBlitObject(const core::Agent& dst_agent,
(dst_agent.device_type() == core::Agent::kAmdGpuDevice)) &&
("Both devices are CPU agents which is not expected"));
// Determine if Src and Dst devices are same
if ((src_agent.public_handle().handle) == (dst_agent.public_handle().handle)) {
// Determine if Src and Dst devices are same and are the copying device
// Such a copy is in the device local memory, which can only be saturated by a blit kernel.
if ((src_agent.public_handle().handle) == (dst_agent.public_handle().handle) &&
(dst_agent.public_handle().handle == public_handle_.handle)) {
// If the copy is very small then cache flush overheads can dominate.
// Choose a (potentially) SDMA enabled engine to avoid cache flushing.
if (size < core::Runtime::runtime_singleton_->flag().force_sdma_size()) {
+4 -9
Просмотреть файл
@@ -487,20 +487,15 @@ hsa_status_t Runtime::CopyMemory(void* dst, core::Agent* dst_agent, const void*
return block.agentOwner;
};
const bool dst_gpu = (dst_agent->device_type() == core::Agent::DeviceType::kAmdGpuDevice);
const bool src_gpu = (src_agent->device_type() == core::Agent::DeviceType::kAmdGpuDevice);
core::Agent* copy_agent = (src_gpu) ? src_agent : dst_agent;
// 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.
if (!dst_agent->Enabled() && !src_agent->Enabled()) return HSA_STATUS_ERROR_INVALID_AGENT;
const bool dst_gpu = (dst_agent->device_type() == core::Agent::DeviceType::kAmdGpuDevice);
const bool src_gpu = (src_agent->device_type() == core::Agent::DeviceType::kAmdGpuDevice);
core::Agent* copy_agent = (src_gpu) ? src_agent : dst_agent;
if (!copy_agent->Enabled()) copy_agent = (copy_agent == src_agent) ? dst_agent : src_agent;
return copy_agent->DmaCopy(dst, *dst_agent, src, *src_agent, size, dep_signals,
completion_signal);
}