From 11da1293de97a93772dc5b6005cae54e2ea8a937 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Mon, 26 May 2025 20:23:36 +0000 Subject: [PATCH] rocr:Fix compile warnings --- rocrtst/suites/functional/virtual_memory.cc | 2 +- runtime/hsa-runtime/core/inc/amd_gpu_agent.h | 5 +++-- runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp | 3 ++- runtime/hsa-runtime/core/runtime/amd_topology.cpp | 2 +- runtime/hsa-runtime/core/util/utils.h | 2 ++ 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/rocrtst/suites/functional/virtual_memory.cc b/rocrtst/suites/functional/virtual_memory.cc index 71aed9e8e1..4200d246d5 100644 --- a/rocrtst/suites/functional/virtual_memory.cc +++ b/rocrtst/suites/functional/virtual_memory.cc @@ -1101,7 +1101,7 @@ void VirtMemoryTestBasic::NonContiguousChunks(hsa_agent_t cpuAgent, hsa_agent_t ASSERT_SUCCESS(hsa_amd_vmem_set_access(addr, NUM_BUFFERS * alloc_size, permsAccess, ARRAY_SIZE(permsAccess))); - for (int i = 0; i < NUM_BUFFERS; i++) { + for (unsigned i = 0; i < NUM_BUFFERS; i++) { // TODO Map them in opposite order ASSERT_SUCCESS(hsa_amd_vmem_unmap(addr_chunks[i], alloc_size)); } diff --git a/runtime/hsa-runtime/core/inc/amd_gpu_agent.h b/runtime/hsa-runtime/core/inc/amd_gpu_agent.h index 69ce38dbdd..9d3fc4a9b3 100644 --- a/runtime/hsa-runtime/core/inc/amd_gpu_agent.h +++ b/runtime/hsa-runtime/core/inc/amd_gpu_agent.h @@ -447,6 +447,7 @@ class GpuAgent : public GpuAgentInt { *((uint8_t*)ptr + size - 1) = *((uint8_t*)ptr + size - 1); _mm_mfence(); auto readback = *(reinterpret_cast(ptr) + size - 1); + UNUSED(readback); } } @@ -845,9 +846,9 @@ class GpuAgent : public GpuAgentInt { pcs_data_t pcs_stochastic_data_; /// @brief XGMI CPU<->GPU - bool xgmi_cpu_gpu_ = false; + bool xgmi_cpu_gpu_; /// @brief Is PCIe large BAR enabled. - bool large_bar_enabled_ = false; + bool large_bar_enabled_; }; } // namespace amd diff --git a/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp b/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp index b1c5eac4bc..5be10ffc79 100644 --- a/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp +++ b/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp @@ -115,10 +115,11 @@ GpuAgent::GpuAgent(HSAuint32 node, const HsaNodeProperties& node_props, bool xna scratch_cache_( [this](void* base, size_t size, bool large) { ReleaseScratch(base, size, large); }), trap_handler_tma_region_(NULL), + rec_sdma_eng_override_(false), pcs_hosttrap_data_(), pcs_stochastic_data_(), xgmi_cpu_gpu_(false), - rec_sdma_eng_override_(false) { + large_bar_enabled_(false){ const bool is_apu_node = (properties_.NumCPUCores > 0); profile_ = (is_apu_node) ? HSA_PROFILE_FULL : HSA_PROFILE_BASE; diff --git a/runtime/hsa-runtime/core/runtime/amd_topology.cpp b/runtime/hsa-runtime/core/runtime/amd_topology.cpp index becb89f1c2..18bb7a00bc 100644 --- a/runtime/hsa-runtime/core/runtime/amd_topology.cpp +++ b/runtime/hsa-runtime/core/runtime/amd_topology.cpp @@ -443,7 +443,7 @@ bool BuildTopology() { // Using one pcie sdma for device to device copy with limited XGMI SDMA engine. // This will help improve all to all copy with limited XGMI SDMA engine. if (rec_sdma_engine_override) { - uint32_t sdma_engine_mask = (1 << ((AMD::GpuAgent*)src_gpu)->properties().NumSdmaEngines - 1); + uint32_t sdma_engine_mask = (1 << (((AMD::GpuAgent*)src_gpu)->properties().NumSdmaEngines - 1)); rec_sdma_eng_id_mask = !IsPowerOfTwo(rec_sdma_eng_id_mask) ? sdma_engine_mask : rec_sdma_eng_id_mask; } diff --git a/runtime/hsa-runtime/core/util/utils.h b/runtime/hsa-runtime/core/util/utils.h index 66c2028a24..aab828ee50 100644 --- a/runtime/hsa-runtime/core/util/utils.h +++ b/runtime/hsa-runtime/core/util/utils.h @@ -151,6 +151,8 @@ static __forceinline unsigned long long int strtoull(const char* str, rocr::log_printf(__FILENAME__, __LINE__, format, ##__VA_ARGS__); \ } while (false); +// A macro to remove unused variable warnings +#define UNUSED(x) (void)(x) // A macro to disallow the copy and move constructor and operator= functions #define DISALLOW_COPY_AND_ASSIGN(TypeName) \