From 47093a7f73d82164872ab39f461e49f04df0fd15 Mon Sep 17 00:00:00 2001 From: Yiannis Papadopoulos Date: Tue, 24 Jun 2025 16:06:46 -0400 Subject: [PATCH] rocr/aie: Remove redundant and unused functions. [ROCm/ROCR-Runtime commit: 2ca4d8f6d47eee89cecda022ad83393aaad84650] --- .../core/driver/kfd/amd_kfd_driver.cpp | 4 --- .../core/driver/xdna/amd_xdna_driver.cpp | 25 ------------------- .../hsa-runtime/core/inc/amd_aie_agent.h | 25 +++---------------- .../hsa-runtime/core/inc/amd_kfd_driver.h | 1 - .../hsa-runtime/core/inc/amd_xdna_driver.h | 1 - .../runtime/hsa-runtime/core/inc/driver.h | 7 ------ .../core/runtime/amd_aie_agent.cpp | 6 ----- 7 files changed, 4 insertions(+), 65 deletions(-) diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/driver/kfd/amd_kfd_driver.cpp b/projects/rocr-runtime/runtime/hsa-runtime/core/driver/kfd/amd_kfd_driver.cpp index 74f2c69f80..bc273985eb 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/core/driver/kfd/amd_kfd_driver.cpp +++ b/projects/rocr-runtime/runtime/hsa-runtime/core/driver/kfd/amd_kfd_driver.cpp @@ -174,10 +174,6 @@ hsa_status_t KfdDriver::GetEdgeProperties(std::vector& io_l return HSA_STATUS_SUCCESS; } -hsa_status_t KfdDriver::GetAgentProperties(core::Agent &agent) const { - return HSA_STATUS_SUCCESS; -} - hsa_status_t KfdDriver::GetMemoryProperties(uint32_t node_id, std::vector& mem_props) const { if (!mem_props.data()) return HSA_STATUS_ERROR_INVALID_ARGUMENT; diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/driver/xdna/amd_xdna_driver.cpp b/projects/rocr-runtime/runtime/hsa-runtime/core/driver/xdna/amd_xdna_driver.cpp index 47e04c31a7..77d0c92960 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/core/driver/xdna/amd_xdna_driver.cpp +++ b/projects/rocr-runtime/runtime/hsa-runtime/core/driver/xdna/amd_xdna_driver.cpp @@ -197,31 +197,6 @@ hsa_status_t XdnaDriver::GetEdgeProperties(std::vector& io_ return HSA_STATUS_SUCCESS; } -hsa_status_t XdnaDriver::GetAgentProperties(core::Agent &agent) const { - if (agent.device_type() != core::Agent::DeviceType::kAmdAieDevice) { - return HSA_STATUS_ERROR_INVALID_AGENT; - } - - auto& aie_agent = static_cast(agent); - - amdxdna_drm_query_aie_metadata aie_metadata = {}; - amdxdna_drm_get_info get_info_args = {}; - get_info_args.param = DRM_AMDXDNA_QUERY_AIE_METADATA; - get_info_args.buffer_size = sizeof(aie_metadata); - get_info_args.buffer = reinterpret_cast(&aie_metadata); - - if (ioctl(fd_, DRM_IOCTL_AMDXDNA_GET_INFO, &get_info_args) < 0) { - return HSA_STATUS_ERROR; - } - - // Right now can only target N-1 columns as that is the - // number of shim DMAs in npu1 devices. - aie_agent.SetNumCols(aie_metadata.cols - 1); - aie_agent.SetNumCoreRows(aie_metadata.core.row_count); - - return HSA_STATUS_SUCCESS; -} - hsa_status_t XdnaDriver::GetMemoryProperties(uint32_t node_id, std::vector& mem_props) const { return HSA_STATUS_SUCCESS; diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/inc/amd_aie_agent.h b/projects/rocr-runtime/runtime/hsa-runtime/core/inc/amd_aie_agent.h index a8998a76a0..a9c77fa18d 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/core/inc/amd_aie_agent.h +++ b/projects/rocr-runtime/runtime/hsa-runtime/core/inc/amd_aie_agent.h @@ -53,11 +53,11 @@ namespace AMD { class AieAgent : public core::Agent { public: - /// @brief AIE agent constructor. - /// @param [in] node Node id. + /// @brief AIE agent constructor. + /// @param [in] node Node id. + /// @param [in] node_props Node properties. AieAgent(uint32_t node, const HsaNodeProperties& node_props); - // @brief AIE agent destructor. ~AieAgent(); hsa_status_t VisitRegion(bool include_peer, @@ -79,7 +79,7 @@ public: uint32_t private_segment_size, uint32_t group_segment_size, core::Queue** queue) override; - // @brief Override from core::Agent. + /// @brief Override from core::Agent. const std::vector& supported_isas() const override { return supported_isas_; } const std::vector& regions() const override { return regions_; } @@ -94,15 +94,6 @@ public: const std::function& system_deallocator() const { return system_deallocator_; } const HsaNodeProperties& properties() const { return node_props_; } - // AIE agent methods. - /// @brief Get the number of columns on this AIE agent. - uint32_t GetNumCols() const { return num_cols_; } - void SetNumCols(uint32_t num_cols) { num_cols_ = num_cols; } - /// @brief Get the number of core tile rows on this AIE agent. - uint32_t GetNumCoreRows() const { return num_core_rows_; } - void SetNumCoreRows(uint32_t num_core_rows) { num_core_rows_ = num_core_rows; } - /// @brief Get the number of core tiles on this AIE agent. - uint32_t GetNumCores() const { return num_cols_ * num_core_rows_; } private: /// @brief Query the driver to get the region list owned by this agent. @@ -110,9 +101,6 @@ private: /// @brief Setup the memory allocators used by this agent. void InitAllocators(); - /// @brief Query the driver to get properties for this AIE agent. - void GetAgentProperties(); - std::vector regions_; std::function @@ -127,11 +115,6 @@ private: const uint32_t max_queues_ = 1; const HsaNodeProperties node_props_; - /// @brief Number of columns in the AIE array. - uint32_t num_cols_ = 0; - /// @brief Number of rows of core tiles in the AIE array. Not all rows in a - /// column are cores. Some can be memory or shim tiles. - uint32_t num_core_rows_ = 0; }; } // namespace AMD diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/inc/amd_kfd_driver.h b/projects/rocr-runtime/runtime/hsa-runtime/core/inc/amd_kfd_driver.h index befa19535e..5212089b30 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/core/inc/amd_kfd_driver.h +++ b/projects/rocr-runtime/runtime/hsa-runtime/core/inc/amd_kfd_driver.h @@ -87,7 +87,6 @@ public: hsa_status_t GetNodeProperties(HsaNodeProperties& node_props, uint32_t node_id) const override; hsa_status_t GetEdgeProperties(std::vector& io_link_props, uint32_t node_id) const override; - hsa_status_t GetAgentProperties(core::Agent &agent) const override; hsa_status_t GetMemoryProperties(uint32_t node_id, std::vector& mem_props) const override; hsa_status_t GetCacheProperties(uint32_t node_id, uint32_t processor_id, diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/inc/amd_xdna_driver.h b/projects/rocr-runtime/runtime/hsa-runtime/core/inc/amd_xdna_driver.h index 575873023f..96f7aee7ca 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/core/inc/amd_xdna_driver.h +++ b/projects/rocr-runtime/runtime/hsa-runtime/core/inc/amd_xdna_driver.h @@ -197,7 +197,6 @@ public: hsa_status_t GetNodeProperties(HsaNodeProperties& node_props, uint32_t node_id) const override; hsa_status_t GetEdgeProperties(std::vector& io_link_props, uint32_t node_id) const override; - hsa_status_t GetAgentProperties(core::Agent &agent) const override; hsa_status_t GetMemoryProperties(uint32_t node_id, std::vector& mem_props) const override; hsa_status_t GetCacheProperties(uint32_t node_id, uint32_t processor_id, diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/inc/driver.h b/projects/rocr-runtime/runtime/hsa-runtime/core/inc/driver.h index 15d0093795..8613a6170c 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/core/inc/driver.h +++ b/projects/rocr-runtime/runtime/hsa-runtime/core/inc/driver.h @@ -114,13 +114,6 @@ public: virtual hsa_status_t GetEdgeProperties(std::vector& io_link_props, uint32_t node_id) const = 0; - /// @brief Get the properties of a specific agent and initialize the agent - /// object. - /// @param agent Agent whose properties we're getting. - /// @retval HSA_STATUS_SUCCESS if the driver successfully returns the agent's - /// properties. - virtual hsa_status_t GetAgentProperties(Agent &agent) const = 0; - /// @brief Get the memory properties of a specific node. /// @param[in] node_id Node ID of the agent. /// @param[out] mem_props Memory properties of the node specified by @p node_id. diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_aie_agent.cpp b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_aie_agent.cpp index 07159453a5..628bcbb6f6 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_aie_agent.cpp +++ b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_aie_agent.cpp @@ -61,7 +61,6 @@ AieAgent::AieAgent(uint32_t node, const HsaNodeProperties& node_props) node_props_(node_props) { InitRegionList(); InitAllocators(); - GetAgentProperties(); } AieAgent::~AieAgent() { @@ -334,11 +333,6 @@ void AieAgent::InitRegionList() { other_mem_props)); } -void AieAgent::GetAgentProperties() { - auto &drv = static_cast(driver()); - drv.GetAgentProperties(*this); -} - void AieAgent::InitAllocators() { for (const auto *region : regions()) { const MemoryRegion *amd_mem_region(