@@ -1404,6 +1404,66 @@ static int kfd_fill_gpu_cache_info_from_gfx_config(struct kfd_dev *kdev,
1404
1404
return i ;
1405
1405
}
1406
1406
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
+
1407
1467
int kfd_get_gpu_cache_info (struct kfd_node * kdev , struct kfd_gpu_cache_info * * pcache_info )
1408
1468
{
1409
1469
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
1461
1521
num_of_cache_types = ARRAY_SIZE (vega20_cache_info );
1462
1522
break ;
1463
1523
case IP_VERSION (9 , 4 , 2 ):
1464
- case IP_VERSION (9 , 4 , 3 ):
1465
1524
* pcache_info = aldebaran_cache_info ;
1466
1525
num_of_cache_types = ARRAY_SIZE (aldebaran_cache_info );
1467
1526
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 ;
1468
1532
case IP_VERSION (9 , 1 , 0 ):
1469
1533
case IP_VERSION (9 , 2 , 2 ):
1470
1534
* pcache_info = raven_cache_info ;
0 commit comments