2
0

Check for debug support after parsing topology

Thunk keeps an internal cache of system topology that can be used to
speed up subsequent calls to hsaKmtAcquireSystemProperties(). This cache
is cleared by calling hsaKmtReleaseSystemProperties() at the beginning
of BuildTopology().
hsaKmtRuntimeEnable() also calls hsaKmtAcquireSystemProperties() inside
Thunk. Move call to hsaKmtRuntimeEnable() after BuildTopology() so that
we can re-use Thunks internal cache.
Parsing of of topology can take ~150 ms on systems for large number of
nodes.

Change-Id: I741709d49d67d244f5fbd707fe8f01ab923bb153
Este cometimento está contido em:
David Yat Sin
2022-12-02 00:49:26 +00:00
ascendente 8751e65b79
cometimento e39ad34d9c
+9 -3
Ver ficheiro
@@ -374,15 +374,21 @@ bool Load() {
}
MAKE_NAMED_SCOPE_GUARD(kfd, [&]() { hsaKmtCloseKFD(); });
// Build topology table.
BuildTopology();
// Register runtime and optionally enable the debugger
// BuildTopology calls hsaKmtAcquireSystemProperties() causes libhsakmt to cache topology
// information. So we need to call hsaKmtRuntimeEnable() after calling BuildTopology() so that
// Thunk can re-use it's cached copy instead of re-parsing whole system topology. Otherwise
// BuildTopology will cause libhsakmt to destroyed cached copy because it calls
// hsaKmtReleaseSystemProperties() at the beginning.
HSAKMT_STATUS err =
hsaKmtRuntimeEnable(&_amdgpu_r_debug, core::Runtime::runtime_singleton_->flag().debug());
if ((err != HSAKMT_STATUS_SUCCESS) && (err != HSAKMT_STATUS_NOT_SUPPORTED)) return false;
core::Runtime::runtime_singleton_->KfdVersion(err != HSAKMT_STATUS_NOT_SUPPORTED);
// Build topology table.
BuildTopology();
kfd.Dismiss();
return true;
}