Skip to content

Commit 0ce8eda

Browse files
mukjoshialexdeucher
authored andcommitted
drm/amdkfd: Populate cache info for GFX 9.4.3
GFX 9.4.3 uses a new version of the GC info table which contains the cache info. This patch adds a new function to populate the cache info from IP discovery for GFX 9.4.3. Signed-off-by: Mukul Joshi <[email protected]> Reviewed-by: Felix Kuehling <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent ba0fb4b commit 0ce8eda

File tree

1 file changed

+65
-1
lines changed

1 file changed

+65
-1
lines changed

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

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1404,6 +1404,66 @@ static int kfd_fill_gpu_cache_info_from_gfx_config(struct kfd_dev *kdev,
14041404
return i;
14051405
}
14061406

1407+
static int kfd_fill_gpu_cache_info_from_gfx_config_v2(struct kfd_dev *kdev,
1408+
struct kfd_gpu_cache_info *pcache_info)
1409+
{
1410+
struct amdgpu_device *adev = kdev->adev;
1411+
int i = 0;
1412+
1413+
/* TCP L1 Cache per CU */
1414+
if (adev->gfx.config.gc_tcp_size_per_cu) {
1415+
pcache_info[i].cache_size = adev->gfx.config.gc_tcp_size_per_cu;
1416+
pcache_info[i].cache_level = 1;
1417+
pcache_info[i].flags = (CRAT_CACHE_FLAGS_ENABLED |
1418+
CRAT_CACHE_FLAGS_DATA_CACHE |
1419+
CRAT_CACHE_FLAGS_SIMD_CACHE);
1420+
pcache_info[i].num_cu_shared = 1;
1421+
i++;
1422+
}
1423+
/* Scalar L1 Instruction Cache per SQC */
1424+
if (adev->gfx.config.gc_l1_instruction_cache_size_per_sqc) {
1425+
pcache_info[i].cache_size =
1426+
adev->gfx.config.gc_l1_instruction_cache_size_per_sqc;
1427+
pcache_info[i].cache_level = 1;
1428+
pcache_info[i].flags = (CRAT_CACHE_FLAGS_ENABLED |
1429+
CRAT_CACHE_FLAGS_INST_CACHE |
1430+
CRAT_CACHE_FLAGS_SIMD_CACHE);
1431+
pcache_info[i].num_cu_shared = adev->gfx.config.gc_num_cu_per_sqc;
1432+
i++;
1433+
}
1434+
/* Scalar L1 Data Cache per SQC */
1435+
if (adev->gfx.config.gc_l1_data_cache_size_per_sqc) {
1436+
pcache_info[i].cache_size = adev->gfx.config.gc_l1_data_cache_size_per_sqc;
1437+
pcache_info[i].cache_level = 1;
1438+
pcache_info[i].flags = (CRAT_CACHE_FLAGS_ENABLED |
1439+
CRAT_CACHE_FLAGS_DATA_CACHE |
1440+
CRAT_CACHE_FLAGS_SIMD_CACHE);
1441+
pcache_info[i].num_cu_shared = adev->gfx.config.gc_num_cu_per_sqc;
1442+
i++;
1443+
}
1444+
/* L2 Data Cache per GPU (Total Tex Cache) */
1445+
if (adev->gfx.config.gc_tcc_size) {
1446+
pcache_info[i].cache_size = adev->gfx.config.gc_tcc_size;
1447+
pcache_info[i].cache_level = 2;
1448+
pcache_info[i].flags = (CRAT_CACHE_FLAGS_ENABLED |
1449+
CRAT_CACHE_FLAGS_DATA_CACHE |
1450+
CRAT_CACHE_FLAGS_SIMD_CACHE);
1451+
pcache_info[i].num_cu_shared = adev->gfx.config.max_cu_per_sh;
1452+
i++;
1453+
}
1454+
/* L3 Data Cache per GPU */
1455+
if (adev->gmc.mall_size) {
1456+
pcache_info[i].cache_size = adev->gmc.mall_size / 1024;
1457+
pcache_info[i].cache_level = 3;
1458+
pcache_info[i].flags = (CRAT_CACHE_FLAGS_ENABLED |
1459+
CRAT_CACHE_FLAGS_DATA_CACHE |
1460+
CRAT_CACHE_FLAGS_SIMD_CACHE);
1461+
pcache_info[i].num_cu_shared = adev->gfx.config.max_cu_per_sh;
1462+
i++;
1463+
}
1464+
return i;
1465+
}
1466+
14071467
int kfd_get_gpu_cache_info(struct kfd_node *kdev, struct kfd_gpu_cache_info **pcache_info)
14081468
{
14091469
int num_of_cache_types = 0;
@@ -1461,10 +1521,14 @@ int kfd_get_gpu_cache_info(struct kfd_node *kdev, struct kfd_gpu_cache_info **pc
14611521
num_of_cache_types = ARRAY_SIZE(vega20_cache_info);
14621522
break;
14631523
case IP_VERSION(9, 4, 2):
1464-
case IP_VERSION(9, 4, 3):
14651524
*pcache_info = aldebaran_cache_info;
14661525
num_of_cache_types = ARRAY_SIZE(aldebaran_cache_info);
14671526
break;
1527+
case IP_VERSION(9, 4, 3):
1528+
num_of_cache_types =
1529+
kfd_fill_gpu_cache_info_from_gfx_config_v2(kdev->kfd,
1530+
*pcache_info);
1531+
break;
14681532
case IP_VERSION(9, 1, 0):
14691533
case IP_VERSION(9, 2, 2):
14701534
*pcache_info = raven_cache_info;

0 commit comments

Comments
 (0)