PC Sampling: Disable coredump when sessions active

When doing a coredump, we try to park the wave and save its PC in
ttmp7/ttmp11, but these registers will be overwritten by PC Sampling
requests.

Change-Id: I60fb734eb3bed4ee3cc8d8bba9ec4a527fff9671
Αυτή η υποβολή περιλαμβάνεται σε:
David Yat Sin
2024-03-28 18:45:28 +00:00
γονέας 49e56ce782
υποβολή 3443fdf665
4 αρχεία άλλαξαν με 16 προσθήκες και 4 διαγραφές
@@ -1272,8 +1272,11 @@ bool AqlQueue::ExceptionHandler(hsa_signal_value_t error_code, void* arg) {
// generated by hsa-runtime.
if (!core::Runtime::runtime_singleton_->KfdVersion().supports_core_dump &&
queue->agent_->isa()->GetMajorVersion() != 11) {
if (amd::coredump::dump_gpu_core())
debug_print("GPU core dump failed\n");
if (pcs::PcsRuntime::instance()->SessionsActive())
fprintf(stderr, "GPU core dump skipped because PC Sampling active\n");
else if (amd::coredump::dump_gpu_core())
fprintf(stderr, "GPU core dump failed\n");
// supports_core_dump flag is overwritten to avoid generate core dump file again
// caught by a different exception handler. Such as VMFaultHandler.
core::Runtime::runtime_singleton_->KfdVersion(
@@ -1804,8 +1804,11 @@ bool Runtime::VMFaultHandler(hsa_signal_value_t val, void* arg) {
// generated by hsa-runtime.
if (faulty_agent && faulty_agent->isa()->GetMajorVersion() != 11 &&
!runtime_singleton_->KfdVersion().supports_core_dump) {
if (amd::coredump::dump_gpu_core())
debug_print("GPU core dump failed\n");
if (pcs::PcsRuntime::instance()->SessionsActive())
fprintf(stderr, "GPU core dump skipped because PC Sampling active\n");
else if (amd::coredump::dump_gpu_core())
fprintf(stderr, "GPU core dump failed\n");
}
assert(false && "GPU memory access fault.");
std::abort();
@@ -100,6 +100,10 @@ void PcsRuntime::DestroySingleton() {
void ReleasePcSamplingRsrcs() { PcsRuntime::DestroySingleton(); }
bool PcsRuntime::SessionsActive() const {
return pc_sampling_.size() > 0;
}
PcsRuntime::PcSamplingSession::PcSamplingSession(
core::Agent* _agent, hsa_ven_amd_pcs_method_kind_t method, hsa_ven_amd_pcs_units_t units,
size_t interval, size_t latency, size_t buffer_size,
@@ -65,6 +65,8 @@ class PcsRuntime {
/// @brief Getter for the PcsRuntime singleton object.
static PcsRuntime* instance();
bool SessionsActive() const;
/// @brief Destroy singleton object.
static void DestroySingleton();