From 2f261a8dab1ebc74bf09c627284084a8bc8fe9fb Mon Sep 17 00:00:00 2001 From: Graham Sider Date: Fri, 16 Jul 2021 15:48:01 -0400 Subject: [PATCH] libhsakmt: Deprecate is_gfx700() Condition generalized by (get_gfxv_by_node_id(NodeId) == GFX_VERSION_KAVERI) Signed-off-by: Graham Sider Change-Id: Iff4f77043e3ce8e48a9e84fbf257ebf59abf5bbb --- src/libhsakmt.h | 1 - src/memory.c | 10 +++++----- src/topology.c | 9 ++------- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/libhsakmt.h b/src/libhsakmt.h index c44df5c37f..d847003392 100644 --- a/src/libhsakmt.h +++ b/src/libhsakmt.h @@ -203,7 +203,6 @@ HSAKMT_STATUS gpuid_to_nodeid(uint32_t gpu_id, uint32_t* node_id); uint32_t get_gfxv_by_node_id(HSAuint32 node_id); bool prefer_ats(HSAuint32 node_id); uint16_t get_device_id_by_node_id(HSAuint32 node_id); -bool is_kaveri(HSAuint32 node_id); uint16_t get_device_id_by_gpu_id(HSAuint32 gpu_id); uint32_t get_direct_link_cpu(uint32_t gpu_node); int get_drm_render_fd_by_gpu_id(HSAuint32 gpu_id); diff --git a/src/memory.c b/src/memory.c index 63b88e4d5d..145aa0472a 100644 --- a/src/memory.c +++ b/src/memory.c @@ -51,7 +51,11 @@ HSAKMT_STATUS HSAKMTAPI hsaKmtSetMemoryPolicy(HSAuint32 Node, pr_debug("[%s] node %d; default %d; alternate %d\n", __func__, Node, DefaultPolicy, AlternatePolicy); - if (!is_kaveri(Node)) + result = validate_nodeid(Node, &gpu_id); + if (result != HSAKMT_STATUS_SUCCESS) + return result; + + if (get_gfxv_by_node_id(Node) != GFX_VERSION_KAVERI) /* This is a legacy API useful on Kaveri only. On dGPU * the alternate aperture is setup and used * automatically for coherent allocations. Don't let @@ -59,10 +63,6 @@ HSAKMT_STATUS HSAKMTAPI hsaKmtSetMemoryPolicy(HSAuint32 Node, */ return HSAKMT_STATUS_NOT_IMPLEMENTED; - result = validate_nodeid(Node, &gpu_id); - if (result != HSAKMT_STATUS_SUCCESS) - return result; - /* * We accept any legal policy and alternate address location. * You get CC everywhere anyway. diff --git a/src/topology.c b/src/topology.c index 91f8055831..38ef39742b 100644 --- a/src/topology.c +++ b/src/topology.c @@ -2154,7 +2154,8 @@ HSAKMT_STATUS HSAKMTAPI hsaKmtGetNodeMemoryProperties(HSAuint32 NodeId, * For dGPU the topology node contains Local Memory and it is added by * the for loop above */ - if (is_kaveri(NodeId) && i < NumBanks && g_props[NodeId].node.LocalMemSize > 0 && + if (get_gfxv_by_node_id(NodeId) == GFX_VERSION_KAVERI && i < NumBanks && + g_props[NodeId].node.LocalMemSize > 0 && fmm_get_aperture_base_and_limit(FMM_GPUVM, gpu_id, &MemoryProperties[i].VirtualBaseAddress, &aperture_limit) == HSAKMT_STATUS_SUCCESS) { MemoryProperties[i].HeapType = HSA_HEAPTYPE_FRAME_BUFFER_PRIVATE; @@ -2291,12 +2292,6 @@ bool prefer_ats(HSAuint32 node_id) && g_props[node_id].node.NumFComputeCores; } -bool is_kaveri(HSAuint32 node_id) -{ - return g_props[node_id].node.EngineId.ui32.Major == 7 - && g_props[node_id].node.EngineId.ui32.Minor == 0; -} - uint16_t get_device_id_by_gpu_id(HSAuint32 gpu_id) { unsigned int i;