Skip to content

Commit be457b2

Browse files
mukjoshialexdeucher
authored andcommitted
drm/amdkfd: Update cache info for GFX 9.4.3
Update cache info reporting based on compute and memory partitioning modes. Signed-off-by: Mukul Joshi <[email protected]> Reviewed-by: Felix Kuehling <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 0ce8eda commit be457b2

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

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

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1602,10 +1602,13 @@ static int fill_in_l2_l3_pcache(struct kfd_cache_properties **props_ext,
16021602
unsigned int cu_sibling_map_mask;
16031603
int first_active_cu;
16041604
int i, j, k, xcc, start, end;
1605+
int num_xcc = NUM_XCC(knode->xcc_mask);
16051606
struct kfd_cache_properties *pcache = NULL;
1607+
enum amdgpu_memory_partition mode;
1608+
struct amdgpu_device *adev = knode->adev;
16061609

16071610
start = ffs(knode->xcc_mask) - 1;
1608-
end = start + NUM_XCC(knode->xcc_mask);
1611+
end = start + num_xcc;
16091612
cu_sibling_map_mask = cu_info->bitmap[start][0][0];
16101613
cu_sibling_map_mask &=
16111614
((1 << pcache_info[cache_type].num_cu_shared) - 1);
@@ -1624,7 +1627,18 @@ static int fill_in_l2_l3_pcache(struct kfd_cache_properties **props_ext,
16241627
pcache->processor_id_low = cu_processor_id
16251628
+ (first_active_cu - 1);
16261629
pcache->cache_level = pcache_info[cache_type].cache_level;
1627-
pcache->cache_size = pcache_info[cache_type].cache_size;
1630+
1631+
if (KFD_GC_VERSION(knode) == IP_VERSION(9, 4, 3))
1632+
mode = adev->gmc.gmc_funcs->query_mem_partition_mode(adev);
1633+
else
1634+
mode = UNKNOWN_MEMORY_PARTITION_MODE;
1635+
1636+
if (pcache->cache_level == 2)
1637+
pcache->cache_size = pcache_info[cache_type].cache_size * num_xcc;
1638+
else if (mode)
1639+
pcache->cache_size = pcache_info[cache_type].cache_size / mode;
1640+
else
1641+
pcache->cache_size = pcache_info[cache_type].cache_size;
16281642

16291643
if (pcache_info[cache_type].flags & CRAT_CACHE_FLAGS_DATA_CACHE)
16301644
pcache->cache_type |= HSA_CACHE_TYPE_DATA;

0 commit comments

Comments
 (0)