From 31e133ae49de072a9fc19eacb5e4d721f6271dd1 Mon Sep 17 00:00:00 2001 From: Flora Cui Date: Tue, 5 Nov 2024 13:23:58 +0800 Subject: [PATCH] wsl/hsakmt: drop duplicated MIN&MAX Signed-off-by: Flora Cui Reviewed-by: lyndonli Part-of: --- libhsakmt.h | 8 -------- topology.cpp | 5 +++-- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/libhsakmt.h b/libhsakmt.h index 4a97a9052d..7f14a1ca5d 100644 --- a/libhsakmt.h +++ b/libhsakmt.h @@ -163,14 +163,6 @@ void topology_setup_is_dgpu_param(HsaNodeProperties *props); HSAuint32 PageSizeFromFlags(unsigned int pageSizeFlags); -#define MIN(a, b) ({ \ - typeof(a) tmp1 = (a), tmp2 = (b); \ - tmp1 < tmp2 ? tmp1 : tmp2; }) - -#define MAX(a, b) ({ \ - typeof(a) tmp1 = (a), tmp2 = (b); \ - tmp1 > tmp2 ? tmp1 : tmp2; }) - uint32_t get_num_sysfs_nodes(void); bool is_forked_child(void); diff --git a/topology.cpp b/topology.cpp index 35c45d41f4..1eaec98c03 100644 --- a/topology.cpp +++ b/topology.cpp @@ -40,6 +40,7 @@ #include "libhsakmt.h" #include "inc/wddm/types.h" #include "inc/wddm/device.h" +#include "util/utils.h" /* Number of memory banks added by thunk on top of topology * This only includes static heaps like LDS, scratch and SVM, @@ -1522,7 +1523,7 @@ hsaKmtGetNodeMemoryProperties(HSAuint32 NodeId, HSAuint32 NumBanks, pthread_mutex_lock(&hsakmt_mutex); memset(MemoryProperties, 0, NumBanks * sizeof(HsaMemoryProperties)); - for (i = 0; i < MIN(g_props[NodeId].node.NumMemoryBanks, NumBanks); i++) { + for (i = 0; i < wsl::Min(g_props[NodeId].node.NumMemoryBanks, NumBanks); i++) { assert(g_props[NodeId].mem); MemoryProperties[i] = g_props[NodeId].mem[i]; } @@ -1576,7 +1577,7 @@ HSAKMT_STATUS HSAKMTAPI hsaKmtGetNodeCacheProperties( goto out; } - for (i = 0; i < MIN(g_props[NodeId].node.NumCaches, NumCaches); i++) { + for (i = 0; i < wsl::Min(g_props[NodeId].node.NumCaches, NumCaches); i++) { assert(g_props[NodeId].cache); CacheProperties[i] = g_props[NodeId].cache[i]; }