Skip to contentSkip to conversation

drm/amdkfd: Fix L2 cache size reporting in GFX9.4.3

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

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

PATCH v2 1/1 drm/amdkfd: Fix L2 cache size reporting in GFX9.4.3

Its currently incorrectly multiplied by number of XCCs in the partition

Fixes 6b537864925e ("drm/amdkfd: Update cache info for GFX 9.4.3")
---
 drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_topology.c +4 -6
index 3df2a8ad86fb..533b8292b136 100644
@@ -1640,12 +1640,10 @@ static int fill_in_l2_l3_pcache(struct kfd_cache_properties **props_ext,
 		else
 			mode = UNKNOWN_MEMORY_PARTITION_MODE;
 
-		if (pcache->cache_level == 2)
-			pcache->cache_size = pcache_info[cache_type].cache_size * num_xcc;
-		else 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
#1 lore raw

[AMD Official Use Only - General]

Looks fine by me

Regards,
Ramesh

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Kent Russell
Sent: Wednesday, February 7, 2024 3:02 AM
To: [email protected]
Cc: Joshi, Mukul <[email protected]>; Russell, Kent <[email protected]>
Subject: [PATCH v2] drm/amdkfd: Fix L2 cache size reporting in GFX9.4.3

Its currently incorrectly multiplied by number of XCCs in the partition

Fixes 6b537864925e ("drm/amdkfd: Update cache info for GFX 9.4.3")
---
 drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_topology.c +4 -6
index 3df2a8ad86fb..533b8292b136 100644
@@ -1640,12 +1640,10 @@ static int fill_in_l2_l3_pcache(struct kfd_cache_properties **props_ext,
                else
                        mode = UNKNOWN_MEMORY_PARTITION_MODE;
 
-               if (pcache->cache_level == 2)
-                       pcache->cache_size = pcache_info[cache_type].cache_size * num_xcc;
-               else 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.34.1

Reviewed-by on v2 1/1
#2 lore raw
In reply to Kent Russell

[AMD Official Use Only - General]

Quoted 45 lines

-----Original Message-----
From: Russell, Kent <[email protected]>
Sent: Tuesday, February 6, 2024 4:32 PM
To: [email protected]
Cc: Joshi, Mukul <[email protected]>; Russell, Kent <[email protected]>
Subject: [PATCH v2] drm/amdkfd: Fix L2 cache size reporting in GFX9.4.3

Its currently incorrectly multiplied by number of XCCs in the partition

Fixes 6b537864925e ("drm/amdkfd: Update cache info for GFX 9.4.3")
---
 drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_topology.c +0 -6
index 3df2a8ad86fb..533b8292b136 100644
@@ -1640,12 +1640,10 @@ static int fill_in_l2_l3_pcache(struct
 kfd_cache_properties **props_ext,
              else
                      mode = UNKNOWN_MEMORY_PARTITION_MODE;
 
-             if (pcache->cache_level == 2)
-                     pcache->cache_size =
 pcache_info[cache_type].cache_size * num_xcc;
-             else if (mode)
-                     pcache->cache_size =
 pcache_info[cache_type].cache_size / mode;
-             else
-                     pcache->cache_size =

pcache_info[cache_type].cache_size;

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)

                      pcache->cache_type |= HSA_CACHE_TYPE_DATA;

--
2.34.1