From f4fe7ddf477788ced96bd4fcbf52ca20bdd8f341 Mon Sep 17 00:00:00 2001 From: Sean Keely Date: Fri, 10 Jul 2020 00:19:03 -0500 Subject: [PATCH] Make explicit reference between init modules. Make explicit reference to hsa_api_trace.cpp from initialization of hsa_table_interface.cpp. Breaks the ability to use hsa_table_interface.cpp in plugins. Change-Id: I22a42d3a132512b0d9ec7a1ca629b169e7f8eba7 --- runtime/hsa-runtime/core/common/hsa_table_interface.cpp | 6 ++++++ runtime/hsa-runtime/core/inc/hsa_api_trace_int.h | 2 ++ runtime/hsa-runtime/core/runtime/hsa_api_trace.cpp | 9 ++++----- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/runtime/hsa-runtime/core/common/hsa_table_interface.cpp b/runtime/hsa-runtime/core/common/hsa_table_interface.cpp index 540919a5f1..11b1e4957a 100644 --- a/runtime/hsa-runtime/core/common/hsa_table_interface.cpp +++ b/runtime/hsa-runtime/core/common/hsa_table_interface.cpp @@ -57,6 +57,12 @@ const HsaApiTable* hsa_table_interface_get_table() { return hsaApiTable; } +class Init { + public: + Init() { rocr::core::LoadInitialHsaApiTable(); } +}; +static Init LinkAtLoadOrFirstTranslationUnitAccess; + // Pass through stub functions hsa_status_t HSA_API hsa_init() { return coreApiTable->hsa_init_fn(); } diff --git a/runtime/hsa-runtime/core/inc/hsa_api_trace_int.h b/runtime/hsa-runtime/core/inc/hsa_api_trace_int.h index c82abdf965..91f8cc3f15 100644 --- a/runtime/hsa-runtime/core/inc/hsa_api_trace_int.h +++ b/runtime/hsa-runtime/core/inc/hsa_api_trace_int.h @@ -71,6 +71,8 @@ namespace core { extern HsaApiTable hsa_api_table_; extern HsaApiTable hsa_internal_api_table_; + + void LoadInitialHsaApiTable(); } // namespace core } // namespace rocr diff --git a/runtime/hsa-runtime/core/runtime/hsa_api_trace.cpp b/runtime/hsa-runtime/core/runtime/hsa_api_trace.cpp index 7bd829d970..5a5c8bcd3c 100644 --- a/runtime/hsa-runtime/core/runtime/hsa_api_trace.cpp +++ b/runtime/hsa-runtime/core/runtime/hsa_api_trace.cpp @@ -392,10 +392,9 @@ void HsaApiTable::UpdateAmdExts() { amd_ext_api.hsa_amd_deregister_deallocation_callback_fn = AMD::hsa_amd_deregister_deallocation_callback; } -class Init { - public: - Init() { hsa_table_interface_init(&hsa_api_table_.hsa_api); } -}; -static Init LinkAtLoad; +void LoadInitialHsaApiTable() { + hsa_table_interface_init(&hsa_api_table_.hsa_api); +} + } // namespace core } // namespace rocr