From 147abb6ca0b99859d97ee24518eaa344e060e959 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Mon, 25 Nov 2024 18:27:00 +0000 Subject: [PATCH] rocr: Move _loader_debug_state to rocr namespace This avoids exposing the symbol to the default namespace Change-Id: I2fe5fbab4b59f271effacab93eeb2d95c236ae02 --- runtime/hsa-runtime/core/runtime/runtime.cpp | 2 +- runtime/hsa-runtime/loader/executable.cpp | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/runtime/hsa-runtime/core/runtime/runtime.cpp b/runtime/hsa-runtime/core/runtime/runtime.cpp index 83d303471a..e3d4794ca5 100644 --- a/runtime/hsa-runtime/core/runtime/runtime.cpp +++ b/runtime/hsa-runtime/core/runtime/runtime.cpp @@ -101,9 +101,9 @@ ROCPROFILER_REGISTER_DEFINE_IMPORT(hsa, ROCP_REG_VERSION) const char rocrbuildid[] __attribute__((used)) = "ROCR BUILD ID: " STRING(ROCR_BUILD_ID); extern r_debug _amdgpu_r_debug; -extern void _loader_debug_state(); namespace rocr { +extern void _loader_debug_state(); namespace core { bool g_use_interrupt_wait; bool g_use_mwaitx; diff --git a/runtime/hsa-runtime/loader/executable.cpp b/runtime/hsa-runtime/loader/executable.cpp index 36b285beac..807402969c 100644 --- a/runtime/hsa-runtime/loader/executable.cpp +++ b/runtime/hsa-runtime/loader/executable.cpp @@ -66,12 +66,6 @@ using namespace rocr::amd::hsa; using namespace rocr::amd::hsa::common; -// Having a side effect prevents call site optimization that allows removal of a noinline function call -// with no side effect. -__attribute__((noinline)) void _loader_debug_state() { - static volatile int function_needs_a_side_effect = 0; - function_needs_a_side_effect ^= 1; -} // r_version history: // 1: Initial debug protocol // 2: New trap handler ABI. The reason for halting a wave is recorded in ttmp11[8:7]. @@ -92,6 +86,13 @@ static __forceinline link_map*& r_debug_tail() { } namespace rocr { + // Having a side effect prevents call site optimization that allows removal of a noinline function call + // with no side effect. +__attribute__((noinline)) void _loader_debug_state() { + static volatile int function_needs_a_side_effect = 0; + function_needs_a_side_effect ^= 1; +} + namespace amd { namespace hsa { namespace loader {