From a1aec2cc1924ff57bb2a522e462b2d740af700a6 Mon Sep 17 00:00:00 2001 From: Oak Zeng Date: Tue, 1 Sep 2020 21:29:22 -0700 Subject: [PATCH] CWSR control stack size calculation for gfx10 Gfx10 need 12bytes/wave control stack Change-Id: I6c6f2819572e6b43aa3140d4dbe79d930e4c1c9c Signed-off-by: Oak Zeng Signed-off-by: Jay Cornwall [ROCm/ROCR-Runtime commit: 3d3b28b670bd4ee7713ff561cc8a1413780179f1] --- projects/rocr-runtime/src/queues.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/rocr-runtime/src/queues.c b/projects/rocr-runtime/src/queues.c index a2e59900a9..539b06b139 100644 --- a/projects/rocr-runtime/src/queues.c +++ b/projects/rocr-runtime/src/queues.c @@ -48,7 +48,7 @@ #define HWREG_SIZE_PER_CU 0x1000 #define WG_CONTEXT_DATA_SIZE_PER_CU(asic_family) (VGPR_SIZE_PER_CU(asic_family) + SGPR_SIZE_PER_CU + LDS_SIZE_PER_CU + HWREG_SIZE_PER_CU) #define WAVES_PER_CU 32 -#define CNTL_STACK_BYTES_PER_WAVE 8 +#define CNTL_STACK_BYTES_PER_WAVE(asic_family) (asic_family >= CHIP_NAVI10 ? 12 : 8) struct device_info { enum asic_family_type asic_family; @@ -425,7 +425,7 @@ static bool update_ctx_save_restore_size(uint32_t nodeid, struct queue *q) uint32_t ctl_stack_size, wg_data_size; uint32_t cu_num = node.NumFComputeCores / node.NumSIMDPerCU; - ctl_stack_size = cu_num * WAVES_PER_CU * CNTL_STACK_BYTES_PER_WAVE + 8; + ctl_stack_size = cu_num * WAVES_PER_CU * CNTL_STACK_BYTES_PER_WAVE(q->dev_info->asic_family) + 8; wg_data_size = cu_num * WG_CONTEXT_DATA_SIZE_PER_CU(q->dev_info->asic_family); q->ctl_stack_size = PAGE_ALIGN_UP(ctl_stack_size + sizeof(HsaUserContextSaveAreaHeader));