libhsakmt: Add gfx version defines, helpers
Add defines for converting between full gfx version (in decimal) to
major/minor/stepping values, and major/minor/stepping values to full gfx
version (in hex). The first is to be used when grabbing the gfx version
from sysfs, the second when returning the gfx version in
get_gfxv_by_node_id() for comparisions in Thunk.
Add enum for defines of full gfx versions for various cards. These are
to be used in conditionals to replace CHIP_*/asic_family comparisons. On
NPI bringup, addition to this enum will not be required for
functionality unless explicitly needed for a conditional. Most ASICs in
this enum simply for completeness.
Add get_gfxv_by_node_id(): returns full gfx version in hex.
Signed-off-by: Graham Sider <Graham.Sider@amd.com>
Change-Id: I9d1dba7fdd4a587a000eea2f4141a1d301bf4776
[ROCm/ROCR-Runtime commit: 8880610265]
Tento commit je obsažen v:
@@ -117,6 +117,44 @@ extern int hsakmt_debug_level;
|
||||
} \
|
||||
})
|
||||
|
||||
/* Expects gfxv (full) in decimal */
|
||||
#define HSA_GET_GFX_VERSION_MAJOR(gfxv) (((gfxv) / 10000) % 100)
|
||||
#define HSA_GET_GFX_VERSION_MINOR(gfxv) (((gfxv) / 100) % 100)
|
||||
#define HSA_GET_GFX_VERSION_STEP(gfxv) ((gfxv) % 100)
|
||||
|
||||
/* Expects HSA_ENGINE_ID.ui32, returns gfxv (full) in hex */
|
||||
#define HSA_GET_GFX_VERSION_FULL(ui32) \
|
||||
(((ui32.Major) << 16) | ((ui32.Minor) << 8) | (ui32.Stepping))
|
||||
|
||||
enum full_gfx_versions {
|
||||
GFX_VERSION_KAVERI = 0x070000,
|
||||
GFX_VERSION_HAWAII = 0x070001,
|
||||
GFX_VERSION_CARRIZO = 0x080001,
|
||||
GFX_VERSION_TONGA = 0x080002,
|
||||
GFX_VERSION_FIJI = 0x080003,
|
||||
GFX_VERSION_POLARIS10 = 0x080003,
|
||||
GFX_VERSION_POLARIS11 = 0x080003,
|
||||
GFX_VERSION_POLARIS12 = 0x080003,
|
||||
GFX_VERSION_VEGAM = 0x080003,
|
||||
GFX_VERSION_VEGA10 = 0x090000,
|
||||
GFX_VERSION_RAVEN = 0x090002,
|
||||
GFX_VERSION_RENOIR = 0x090002,
|
||||
GFX_VERSION_VEGA12 = 0x090004,
|
||||
GFX_VERSION_VEGA20 = 0x090006,
|
||||
GFX_VERSION_ARCTURUS = 0x090008,
|
||||
GFX_VERSION_ALDEBARAN = 0x090010,
|
||||
GFX_VERSION_NAVI10 = 0x100100,
|
||||
GFX_VERSION_NAVI12 = 0x100101,
|
||||
GFX_VERSION_NAVI14 = 0x100102,
|
||||
GFX_VERSION_CYAN_SKILLFISH = 0x100103,
|
||||
GFX_VERSION_SIENNA_CICHLID = 0x100300,
|
||||
GFX_VERSION_NAVY_FLOUNDER = 0x100301,
|
||||
GFX_VERSION_DIMGREY_CAVEFISH = 0x100302,
|
||||
GFX_VERSION_VANGOGH = 0x100303,
|
||||
GFX_VERSION_BEIGE_GOBY = 0x100304,
|
||||
GFX_VERSION_YELLOW_CARP = 0x100305,
|
||||
};
|
||||
|
||||
enum asic_family_type {
|
||||
CHIP_KAVERI = 0,
|
||||
CHIP_HAWAII, /* 1 */
|
||||
@@ -162,6 +200,7 @@ HSAKMT_STATUS init_kfd_version(void);
|
||||
|
||||
HSAKMT_STATUS validate_nodeid(uint32_t nodeid, uint32_t *gpu_id);
|
||||
HSAKMT_STATUS gpuid_to_nodeid(uint32_t gpu_id, uint32_t* node_id);
|
||||
uint32_t get_gfxv_by_node_id(HSAuint32 node_id);
|
||||
bool prefer_ats(HSAuint32 node_id);
|
||||
uint16_t get_device_id_by_node_id(HSAuint32 node_id);
|
||||
bool is_kaveri(HSAuint32 node_id);
|
||||
|
||||
@@ -1091,8 +1091,8 @@ HSAKMT_STATUS topology_sysfs_get_node_props(uint32_t node_id,
|
||||
props->EngineId.ui32.Stepping = step & 0xff;
|
||||
} else {
|
||||
props->EngineId.ui32.Major = hsa_gfxip->major & 0x3f;
|
||||
props->EngineId.ui32.Minor = hsa_gfxip->minor;
|
||||
props->EngineId.ui32.Stepping = hsa_gfxip->stepping;
|
||||
props->EngineId.ui32.Minor = hsa_gfxip->minor & 0xff;
|
||||
props->EngineId.ui32.Stepping = hsa_gfxip->stepping & 0xff;
|
||||
}
|
||||
|
||||
if (!hsa_gfxip->amd_name) {
|
||||
@@ -2271,6 +2271,11 @@ out:
|
||||
return err;
|
||||
}
|
||||
|
||||
uint32_t get_gfxv_by_node_id(HSAuint32 node_id)
|
||||
{
|
||||
return HSA_GET_GFX_VERSION_FULL(g_props[node_id].node.EngineId.ui32);
|
||||
}
|
||||
|
||||
uint16_t get_device_id_by_node_id(HSAuint32 node_id)
|
||||
{
|
||||
if (!g_props || !g_system || g_system->NumNodes <= node_id)
|
||||
|
||||
Odkázat v novém úkolu
Zablokovat Uživatele