Skip to content

Commit 321048c

Browse files
hkasivisalexdeucher
authored andcommitted
drm/amdkfd: hard-code cacheline size for gfx11
This information is not available in ip discovery table. Signed-off-by: Harish Kasiviswanathan <[email protected]> Reviewed-by: David Belanger <[email protected]> Signed-off-by: Alex Deucher <[email protected]> Cc: [email protected]
1 parent a592bb1 commit 321048c

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

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

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1423,6 +1423,7 @@ int kfd_parse_crat_table(void *crat_image, struct list_head *device_list,
14231423

14241424

14251425
static int kfd_fill_gpu_cache_info_from_gfx_config(struct kfd_dev *kdev,
1426+
bool cache_line_size_missing,
14261427
struct kfd_gpu_cache_info *pcache_info)
14271428
{
14281429
struct amdgpu_device *adev = kdev->adev;
@@ -1437,6 +1438,8 @@ static int kfd_fill_gpu_cache_info_from_gfx_config(struct kfd_dev *kdev,
14371438
CRAT_CACHE_FLAGS_SIMD_CACHE);
14381439
pcache_info[i].num_cu_shared = adev->gfx.config.gc_num_tcp_per_wpg / 2;
14391440
pcache_info[i].cache_line_size = adev->gfx.config.gc_tcp_cache_line_size;
1441+
if (cache_line_size_missing && !pcache_info[i].cache_line_size)
1442+
pcache_info[i].cache_line_size = 128;
14401443
i++;
14411444
}
14421445
/* Scalar L1 Instruction Cache per SQC */
@@ -1449,6 +1452,8 @@ static int kfd_fill_gpu_cache_info_from_gfx_config(struct kfd_dev *kdev,
14491452
CRAT_CACHE_FLAGS_SIMD_CACHE);
14501453
pcache_info[i].num_cu_shared = adev->gfx.config.gc_num_sqc_per_wgp * 2;
14511454
pcache_info[i].cache_line_size = adev->gfx.config.gc_instruction_cache_line_size;
1455+
if (cache_line_size_missing && !pcache_info[i].cache_line_size)
1456+
pcache_info[i].cache_line_size = 128;
14521457
i++;
14531458
}
14541459
/* Scalar L1 Data Cache per SQC */
@@ -1460,6 +1465,8 @@ static int kfd_fill_gpu_cache_info_from_gfx_config(struct kfd_dev *kdev,
14601465
CRAT_CACHE_FLAGS_SIMD_CACHE);
14611466
pcache_info[i].num_cu_shared = adev->gfx.config.gc_num_sqc_per_wgp * 2;
14621467
pcache_info[i].cache_line_size = adev->gfx.config.gc_scalar_data_cache_line_size;
1468+
if (cache_line_size_missing && !pcache_info[i].cache_line_size)
1469+
pcache_info[i].cache_line_size = 64;
14631470
i++;
14641471
}
14651472
/* GL1 Data Cache per SA */
@@ -1472,7 +1479,8 @@ static int kfd_fill_gpu_cache_info_from_gfx_config(struct kfd_dev *kdev,
14721479
CRAT_CACHE_FLAGS_DATA_CACHE |
14731480
CRAT_CACHE_FLAGS_SIMD_CACHE);
14741481
pcache_info[i].num_cu_shared = adev->gfx.config.max_cu_per_sh;
1475-
pcache_info[i].cache_line_size = 0;
1482+
if (cache_line_size_missing)
1483+
pcache_info[i].cache_line_size = 128;
14761484
i++;
14771485
}
14781486
/* L2 Data Cache per GPU (Total Tex Cache) */
@@ -1484,6 +1492,8 @@ static int kfd_fill_gpu_cache_info_from_gfx_config(struct kfd_dev *kdev,
14841492
CRAT_CACHE_FLAGS_SIMD_CACHE);
14851493
pcache_info[i].num_cu_shared = adev->gfx.config.max_cu_per_sh;
14861494
pcache_info[i].cache_line_size = adev->gfx.config.gc_tcc_cache_line_size;
1495+
if (cache_line_size_missing && !pcache_info[i].cache_line_size)
1496+
pcache_info[i].cache_line_size = 128;
14871497
i++;
14881498
}
14891499
/* L3 Data Cache per GPU */
@@ -1569,6 +1579,7 @@ static int kfd_fill_gpu_cache_info_from_gfx_config_v2(struct kfd_dev *kdev,
15691579
int kfd_get_gpu_cache_info(struct kfd_node *kdev, struct kfd_gpu_cache_info **pcache_info)
15701580
{
15711581
int num_of_cache_types = 0;
1582+
bool cache_line_size_missing = false;
15721583

15731584
switch (kdev->adev->asic_type) {
15741585
case CHIP_KAVERI:
@@ -1692,10 +1703,17 @@ int kfd_get_gpu_cache_info(struct kfd_node *kdev, struct kfd_gpu_cache_info **pc
16921703
case IP_VERSION(11, 5, 0):
16931704
case IP_VERSION(11, 5, 1):
16941705
case IP_VERSION(11, 5, 2):
1706+
/* Cacheline size not available in IP discovery for gc11.
1707+
* kfd_fill_gpu_cache_info_from_gfx_config to hard code it
1708+
*/
1709+
cache_line_size_missing = true;
1710+
fallthrough;
16951711
case IP_VERSION(12, 0, 0):
16961712
case IP_VERSION(12, 0, 1):
16971713
num_of_cache_types =
1698-
kfd_fill_gpu_cache_info_from_gfx_config(kdev->kfd, *pcache_info);
1714+
kfd_fill_gpu_cache_info_from_gfx_config(kdev->kfd,
1715+
cache_line_size_missing,
1716+
*pcache_info);
16991717
break;
17001718
default:
17011719
*pcache_info = dummy_cache_info;

0 commit comments

Comments
 (0)