From eded014abcb29c814bb0419fa4a134072548e871 Mon Sep 17 00:00:00 2001 From: Alex Voicu Date: Fri, 11 May 2018 11:31:46 +0100 Subject: [PATCH] Don't use magic constants, they're evil. Also clarify that the register count cannot be queried at the moment. --- hipamd/src/hip_module.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/hipamd/src/hip_module.cpp b/hipamd/src/hip_module.cpp index 59831958bd..b174b7ad5b 100644 --- a/hipamd/src/hip_module.cpp +++ b/hipamd/src/hip_module.cpp @@ -483,14 +483,17 @@ namespace hipDeviceProp_t prop{}; hipGetDeviceProperties( &prop, ihipGetTlsDefaultCtx()->getDevice()->_deviceId); - + // TODO: at the moment there is no way to query the count of registers + // available per CU, therefore we hardcode it to 64 KiRegisters. + prop.regsPerBlock = prop.regsPerBlock ? prop.regsPerBlock : 64 * 1024. + r.localSizeBytes = header.workitem_private_segment_byte_size; r.sharedSizeBytes = header.workgroup_group_segment_byte_size; r.maxDynamicSharedSizeBytes = prop.sharedMemPerBlock - r.sharedSizeBytes; r.numRegs = header.workitem_vgpr_count; - r.maxThreadsPerBlock = r.numRegs ? // TODO: proper query. - std::min(prop.maxThreadsPerBlock, 64 * 1024 / r.numRegs) : + r.maxThreadsPerBlock = r.numRegs ? + std::min(prop.maxThreadsPerBlock, prop.regsPerBlock / r.numRegs) : prop.maxThreadsPerBlock; r.binaryVersion = header.amd_machine_version_major * 10 +