Skip to contentSkip to conversation

drm/amdkfd: Don't divide L2 cache by partition mode

PATCH In review Kent Russell 2 participants 3 messages Feb 6, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdkfd: Don't divide L2 cache by partition mode

Partition mode only affects L3 cache size. After removing the L2 check in the previous patch, make sure we aren't dividing all cache sizes by partition mode, just L3.

Fixes a75bfb3c4045 ("drm/amdkfd: Fix L2 cache size reporting in GFX9.4.3")
---
 drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_topology.c +4 -4
index 64bf2a56f010..533b8292b136 100644
@@ -1640,10 +1640,10 @@ static int fill_in_l2_l3_pcache(struct kfd_cache_properties **props_ext,
 		else
 			mode = UNKNOWN_MEMORY_PARTITION_MODE;
 
-		if (mode)
-			pcache->cache_size = pcache_info[cache_type].cache_size / mode;
-		else
-			pcache->cache_size = pcache_info[cache_type].cache_size;
+		pcache->cache_size = pcache_info[cache_type].cache_size;
+		/* Partition mode only affects L3 cache size */
+		if (mode && pcache->cache_level == 3)
+			pcache->cache_size /= mode;
 
 		if (pcache_info[cache_type].flags & CRAT_CACHE_FLAGS_DATA_CACHE)
 			pcache->cache_type |= HSA_CACHE_TYPE_DATA;
Signature · 1 line
2.34.1
maintainer
#1 lore raw
Quoted 5 lines · Kent Russell

Partition mode only affects L3 cache size. After removing the L2 check in the previous patch, make sure we aren't dividing all cache sizes by partition mode, just L3.

Fixes a75bfb3c4045 ("drm/amdkfd: Fix L2 cache size reporting in GFX9.4.3")

The fixes tag looks wrong. I can't find the commit a75bfb3c4045 anywhere. Did your previous patch actually make it into the branch yet? Maybe you can still abandon it in Gerrit.

Regards,
  Felix

Quoted 24 lines
---
  drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 8 ++++----
  1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_topology.c +4 -4
index 64bf2a56f010..533b8292b136 100644
@@ -1640,10 +1640,10 @@ static int fill_in_l2_l3_pcache(struct kfd_cache_properties **props_ext,
  		else
  			mode = UNKNOWN_MEMORY_PARTITION_MODE;
 
-		if (mode)
-			pcache->cache_size = pcache_info[cache_type].cache_size / mode;
-		else
-			pcache->cache_size = pcache_info[cache_type].cache_size;
+		pcache->cache_size = pcache_info[cache_type].cache_size;
+		/* Partition mode only affects L3 cache size */
+		if (mode && pcache->cache_level == 3)
+			pcache->cache_size /= mode;
 
  		if (pcache_info[cache_type].flags & CRAT_CACHE_FLAGS_DATA_CACHE)
  			pcache->cache_type |= HSA_CACHE_TYPE_DATA;
#2 lore raw

[AMD Official Use Only - General]

Oh excellent, it didn't get merged in yet. Time to squash!

Kent

Quoted 52 lines

-----Original Message-----
From: Kuehling, Felix <[email protected]>
Sent: Tuesday, February 6, 2024 4:29 PM
To: Russell, Kent <[email protected]>; [email protected]
Cc: Joshi, Mukul <[email protected]>
Subject: Re: [PATCH] drm/amdkfd: Don't divide L2 cache by partition mode

Quoted 5 lines · Kent Russell

Partition mode only affects L3 cache size. After removing the L2 check in the previous patch, make sure we aren't dividing all cache sizes by partition mode, just L3.

Fixes a75bfb3c4045 ("drm/amdkfd: Fix L2 cache size reporting in GFX9.4.3")

The fixes tag looks wrong. I can't find the commit a75bfb3c4045 anywhere. Did your previous patch actually make it into the branch yet? Maybe you can still abandon it in Gerrit.

Regards,
Felix

Review

Quoted 6 lines
---
  drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 8 ++++----
  1 file changed, 4 insertions(+), 4 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c

drivers/gpu/drm/amd/amdkfd/kfd_topology.c static int fill_in_l2_l3_pcache(struct

Quoted 4 lines

index 64bf2a56f010..533b8292b136 100644

drivers/gpu/drm/amd/amdkfd/kfd_topology.c +0 -0
@@ -1640,10 +1640,10 @@ static int fill_in_l2_l3_pcache(struct

kfd_cache_properties **props_ext,

drivers/gpu/drm/amd/amdkfd/kfd_topology.c static int fill_in_l2_l3_pcache(struct kfd_cache_properties **props_ext,

Quoted 5 lines
drivers/gpu/drm/amd/amdkfd/kfd_topology.c +0 -2
            else
                    mode = UNKNOWN_MEMORY_PARTITION_MODE;
 
-           if (mode)
-                   pcache->cache_size =

pcache_info[cache_type].cache_size / mode;

drivers/gpu/drm/amd/amdkfd/kfd_topology.c static int fill_in_l2_l3_pcache(struct · line 1646

Quoted 2 lines
drivers/gpu/drm/amd/amdkfd/kfd_topology.c +0 -2
-           else
-                   pcache->cache_size =

pcache_info[cache_type].cache_size;

drivers/gpu/drm/amd/amdkfd/kfd_topology.c static int fill_in_l2_l3_pcache(struct kfd_cache_properties **props_ext,

Quoted 6 lines
drivers/gpu/drm/amd/amdkfd/kfd_topology.c +4 -0
+           pcache->cache_size = pcache_info[cache_type].cache_size;
+           /* Partition mode only affects L3 cache size */
+           if (mode && pcache->cache_level == 3)
+                   pcache->cache_size /= mode;
 
            if (pcache_info[cache_type].flags &

CRAT_CACHE_FLAGS_DATA_CACHE)

Quoted 1 line
drivers/gpu/drm/amd/amdkfd/kfd_topology.c +0 -0
                    pcache->cache_type |= HSA_CACHE_TYPE_DATA;