Add Size of VGPR and SGPR to HsaNodeProperties

Signed-off-by: Mike Li <Tianxinmike.Li@amd.com>
Change-Id: I7e6c0c5b9fd90c0bb5f3b7d35362a073afdcf9b8


[ROCm/ROCR-Runtime commit: 47ccc6604d]
This commit is contained in:
Mike Li
2021-04-23 09:47:48 -04:00
parent 5c323f2611
commit a8ceb5c406
5 changed files with 21 additions and 4 deletions
+4 -1
View File
@@ -312,7 +312,10 @@ typedef struct _HsaNodeProperties
HSAuint32 Domain; // PCI domain of the GPU
HSAuint64 UniqueID; // Globally unique immutable id
HSAuint8 Reserved[20];
HSAuint32 VGPRSizePerCU; // VGPR size in bytes per CU
HSAuint32 SGPRSizePerCU; // SGPR size in bytes per CU
HSAuint8 Reserved[12];
} HsaNodeProperties;
+5
View File
@@ -212,4 +212,9 @@ void clear_process_doorbells(void);
uint32_t get_num_sysfs_nodes(void);
bool is_forked_child(void);
/* Calculate VGPR and SGPR register file size per CU */
#define VGPR_SIZE_PER_CU(asic_family) ((asic_family == CHIP_ARCTURUS || \
asic_family == CHIP_ALDEBARAN) ? 0x80000 : 0x40000)
#define SGPR_SIZE_PER_CU 0x4000
#endif
-3
View File
@@ -42,9 +42,6 @@
#define DOORBELL_SIZE_GFX9 8
#define DOORBELLS_PAGE_SIZE(ds) (1024 * (ds))
#define VGPR_SIZE_PER_CU(asic_family) ((asic_family == CHIP_ARCTURUS || \
asic_family == CHIP_ALDEBARAN) ? 0x80000 : 0x40000)
#define SGPR_SIZE_PER_CU 0x4000
#define LDS_SIZE_PER_CU 0x10000
#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)
+5
View File
@@ -1103,6 +1103,11 @@ HSAKMT_STATUS topology_sysfs_get_node_props(uint32_t node_id,
props->MarketingName[i] = name[i];
props->MarketingName[i] = '\0';
}
/* Get VGPR/SGPR size in byte per CU */
props->VGPRSizePerCU = VGPR_SIZE_PER_CU(hsa_gfxip->asic_family);
props->SGPRSizePerCU = SGPR_SIZE_PER_CU;
} else if (props->DeviceId)
/* still return success */
pr_err("device ID 0x%x is not supported in libhsakmt\n",
@@ -59,6 +59,13 @@ TEST_F(KFDTopologyTest , BasicTest) {
EXPECT_GE(pNodeProperties->EngineId.ui32.Major, 7) << "Major Version is less than 7";
EXPECT_LT(pNodeProperties->EngineId.ui32.Minor, 10) << "Minor Version is greater than 9";
EXPECT_GT(pNodeProperties->uCodeEngineVersions.uCodeSDMA, 0) << "sDMA firmware version is 0";
HSAuint32 VGPRSize = (FamilyIdFromNode(pNodeProperties) == FAMILY_AR ||
FamilyIdFromNode(pNodeProperties) == FAMILY_AL) ?
0x80000 : 0x40000;
EXPECT_EQ(pNodeProperties->VGPRSizePerCU, VGPRSize) << "VGPR Size Per CU is not correct";
EXPECT_EQ(pNodeProperties->SGPRSizePerCU, 0x4000) << "SGPR Size Per CU is not correct";
LOG() << "VGPR Size is " << pNodeProperties->VGPRSizePerCU <<
" SGPR Size is " << pNodeProperties->SGPRSizePerCU << std::endl;
}
EXPECT_GT(pNodeProperties->NumMemoryBanks, HSAuint32(0)) << "Node index: " << node << "No MemoryBanks.";
EXPECT_GT(pNodeProperties->NumCaches, HSAuint32(0)) << "Node index: " << node << "No Caches.";