libhsakmt: Fixed VGPR memory size for GFX11.0 and GFX11.1.

Fixed VGPR memory size, size was too small for some GPU, causing a memory overflow.
Refactored macro code into a function.
Thanks to Jay Cornwall for locating the problem and proposing the fix.

Change-Id: Iffedea1c4f341967f02c56d810ff048225b02c16
Signed-off-by: David Belanger <david.belanger@amd.com>


[ROCm/ROCR-Runtime commit: a847a7b80e]
This commit is contained in:
David Belanger
2023-01-24 09:55:04 -05:00
committed by David Belanger
parent b99bf7f3b6
commit dbf94b7dd3
3 changed files with 27 additions and 5 deletions
+23 -1
View File
@@ -45,7 +45,7 @@
(((gfxv) >= 0x80000) ? 4096 : 0))
#define WG_CONTEXT_DATA_SIZE_PER_CU(gfxv) \
(VGPR_SIZE_PER_CU(gfxv) + SGPR_SIZE_PER_CU + \
(get_vgpr_size_per_cu(gfxv) + SGPR_SIZE_PER_CU + \
LDS_SIZE_PER_CU + HWREG_SIZE_PER_CU)
#define CNTL_STACK_BYTES_PER_WAVE(gfxv) \
@@ -87,6 +87,28 @@ struct process_doorbells {
static unsigned int num_doorbells;
static struct process_doorbells *doorbells;
uint32_t get_vgpr_size_per_cu(uint32_t gfxv)
{
uint32_t vgpr_size = 0;
switch (gfxv)
{
case GFX_VERSION_ARCTURUS:
case GFX_VERSION_ALDEBARAN:
vgpr_size = 0x80000;
break;
case GFX_VERSION_PLUM_BONITO:
case GFX_VERSION_WHEAT_NAS:
vgpr_size = 0x60000;
break;
default:
vgpr_size = 0x40000;
break;
}
return vgpr_size;
}
HSAKMT_STATUS init_process_doorbells(unsigned int NumNodes)
{
unsigned int i;