Enable D2D SDMA Ganging over xGMI

Use all available SDMA engines capped by xGMI bandwith for
all D2D copies within a hive.

By default, set the latency boundary copy size as 4KB and below.
Any copy size in within this boundary will not gang.

Avoid oversubscribing engines by not ganging on engines with
pending non-ganged work.

An enviroment variable HSA_ENABLE_SDMA_GANG has been provided
to override default ganging behaviour.

Change-Id: Iccde76aa1af1d47ea2a151789432c9db4f0ffa8d
This commit is contained in:
Jonathan Kim
2022-11-21 10:34:43 -05:00
کامیت شده توسط Jonathan Kim
والد c5dbb93e59
کامیت 7df0167821
9فایلهای تغییر یافته به همراه248 افزوده شده و 30 حذف شده
@@ -365,6 +365,28 @@ void BuildTopology() {
maxCu = Max(maxCu, cus);
}
const_cast<Flag&>(core::Runtime::runtime_singleton_->flag()).parse_masks(maxGpu, maxCu);
// Register destination agents that can SDMA gang copy for source agents
for (auto& src_gpu : core::Runtime::runtime_singleton_->gpu_agents()) {
uint32_t src_id = src_gpu->node_id();
for (auto& dst_gpu : core::Runtime::runtime_singleton_->gpu_agents()) {
uint32_t dst_id = dst_gpu->node_id();
if (src_id == dst_gpu->node_id())
continue;
auto linfo = core::Runtime::runtime_singleton_->GetLinkInfo(src_id, dst_id);
// Min Bandwidth < Max Bandwidth if source and destination GPUs are a
// single hop way and there exists more than a single xGMI link between
// them. Otherwise, destination GPU is not a gang candidate.
if (linfo.info.link_type != HSA_AMD_LINK_INFO_TYPE_XGMI ||
linfo.info.min_bandwidth == linfo.info.max_bandwidth)
continue;
((AMD::GpuAgent*)src_gpu)->RegisterGangPeer(*dst_gpu, linfo.info.max_bandwidth/linfo.info.min_bandwidth);
}
}
}
bool Load() {