Basic SVM profiler.

Mostly a demo at this point.  Logs SVM (aka HMM) info to
HSA_SVM_PROFILE if set.

Example: HSA_SVM_PROFILE=log.txt SomeApp

Change-Id: Ib6fd688f661a21b2c695f586b833be93662a15f4
This commit is contained in:
Sean Keely
2022-03-28 23:34:37 -05:00
parent e7fc301aa7
commit 965df6eef7
7 changed files with 459 additions and 0 deletions
@@ -158,6 +158,8 @@ void Runtime::RegisterAgent(Agent* agent, bool Enabled) {
if (agent->device_type() == Agent::DeviceType::kAmdCpuDevice) {
cpu_agents_.push_back(agent);
agents_by_gpuid_[0] = agent;
// Add cpu regions to the system region list.
for (const core::MemoryRegion* region : agent->regions()) {
if (region->fine_grain()) {
@@ -202,6 +204,8 @@ void Runtime::RegisterAgent(Agent* agent, bool Enabled) {
if (Enabled) {
gpu_agents_.push_back(agent);
gpu_ids_.push_back(agent->node_id());
agents_by_gpuid_[((AMD::GpuAgent*)agent)->KfdGpuID()] = agent;
// Assign the first discovered gpu agent as region gpu.
if (region_gpu_ == NULL) region_gpu_ = agent;
} else
@@ -1380,10 +1384,15 @@ hsa_status_t Runtime::Load() {
// Load tools libraries
LoadTools();
// Load svm profiler
svm_profile_.reset(new AMD::SvmProfileControl);
return HSA_STATUS_SUCCESS;
}
void Runtime::Unload() {
svm_profile_.reset(nullptr);
UnloadTools();
UnloadExtensions();