Support debugging hw exceptions.

Change-Id: I9780147294af2e9457fa54693580735452ee2ae6
This commit is contained in:
Sean Keely
2021-05-25 16:32:07 -05:00
parent 3d6a18b67c
commit 206e87d28b
6 changed files with 211 additions and 59 deletions
@@ -49,6 +49,7 @@
#include <map>
#include <string>
#include <sstream>
#include <link.h>
#ifndef NDBEUG
#include <iostream>
@@ -62,6 +63,8 @@
#include "core/inc/amd_memory_region.h"
#include "core/util/utils.h"
extern r_debug _amdgpu_r_debug;
namespace rocr {
namespace AMD {
// Minimum acceptable KFD version numbers
@@ -120,7 +123,7 @@ GpuAgent* DiscoverGpu(HSAuint32 node_id, HsaNodeProperties& node_prop, bool xnac
try {
gpu = new GpuAgent(node_id, node_prop, xnack_mode);
const HsaVersionInfo& kfd_version = core::Runtime::runtime_singleton_->KfdVersion();
const HsaVersionInfo& kfd_version = core::Runtime::runtime_singleton_->KfdVersion().version;
// Check for sramecc incompatibility due to sramecc not being reported correctly in kfd before
// 1.4.
@@ -358,6 +361,12 @@ bool Load() {
return false;
}
// Register runtime and optionally enable the debugger
HSAKMT_STATUS err =
hsaKmtRuntimeEnable(&_amdgpu_r_debug, core::Runtime::runtime_singleton_->flag().debug());
if (err != HSAKMT_STATUS_SUCCESS) return false;
core::Runtime::runtime_singleton_->KfdVersion(err != HSAKMT_STATUS_NOT_SUPPORTED);
// Build topology table.
BuildTopology();
@@ -365,6 +374,8 @@ bool Load() {
}
bool Unload() {
hsaKmtRuntimeDisable();
hsaKmtReleaseSystemProperties();
// Close connection to kernel driver.