libhsakmt: add OverrideEngineId property

When HSA_OVERRIDE_GFX_VERSION is used, save the overrided GFX
version to OverrideEngineId instead of original EngineId. There
are places where real GFX properties still needed, e.g. CWSR size
calculation.

Change-Id: I9d9149bae465b7cfe55604fc19e7ca34e48b7b1c
Signed-off-by: Yifan Zhang <yifan1.zhang@amd.com>


[ROCm/ROCR-Runtime commit: 3f1f68c8cb]
This commit is contained in:
Yifan Zhang
2024-08-15 17:10:38 +08:00
zatwierdzone przez David Yat Sin
rodzic 36a7120662
commit 45979fdfc7
3 zmienionych plików z 30 dodań i 11 usunięć
@@ -298,6 +298,7 @@ typedef struct _HsaNodeProperties
// may be 0 if HW has no restrictions
HSA_ENGINE_ID EngineId; // Identifier (rev) of the GPU uEngine or Firmware, may be 0
HSA_ENGINE_ID OverrideEngineId; // Identifier (rev) of the Overrided GPU uEngine or Firmware, may be 0
HSAuint16 VendorId; // GPU vendor id; 0 on latency (= CPU)-only nodes
HSAuint16 DeviceId; // GPU device id; 0 on latency (= CPU)-only nodes
@@ -1222,10 +1222,12 @@ static HSAKMT_STATUS topology_sysfs_get_node_props(uint32_t node_id,
ret = HSAKMT_STATUS_ERROR;
goto out;
}
props->EngineId.ui32.Major = major & 0x3f;
props->EngineId.ui32.Minor = minor & 0xff;
props->EngineId.ui32.Stepping = step & 0xff;
} else if (hsa_gfxip) {
props->OverrideEngineId.ui32.Major = major & 0x3f;
props->OverrideEngineId.ui32.Minor = minor & 0xff;
props->OverrideEngineId.ui32.Stepping = step & 0xff;
}
if (hsa_gfxip) {
props->EngineId.ui32.Major = hsa_gfxip->major & 0x3f;
props->EngineId.ui32.Minor = hsa_gfxip->minor & 0xff;
props->EngineId.ui32.Stepping = hsa_gfxip->stepping & 0xff;
@@ -127,10 +127,20 @@ GpuAgent::GpuAgent(HSAuint32 node, const HsaNodeProperties& node_props, bool xna
historical_clock_ratio_ = 0.0;
assert(err == HSAKMT_STATUS_SUCCESS && "hsaGetClockCounters error");
const core::Isa *isa_base = core::IsaRegistry::GetIsa(
core::Isa::Version(node_props.EngineId.ui32.Major,
node_props.EngineId.ui32.Minor,
node_props.EngineId.ui32.Stepping));
const core::Isa *isa_base;
if (node_props.OverrideEngineId.Value != 0) {
isa_base = core::IsaRegistry::GetIsa(
core::Isa::Version(node_props.OverrideEngineId.ui32.Major,
node_props.OverrideEngineId.ui32.Minor,
node_props.OverrideEngineId.ui32.Stepping));
} else {
isa_base = core::IsaRegistry::GetIsa(
core::Isa::Version(node_props.EngineId.ui32.Major,
node_props.EngineId.ui32.Minor,
node_props.EngineId.ui32.Stepping));
}
if (!isa_base) {
throw AMD::hsa_exception(HSA_STATUS_ERROR_INVALID_ISA, "Agent creation failed.\nThe GPU node has an unrecognized id.\n");
}
@@ -158,10 +168,16 @@ GpuAgent::GpuAgent(HSAuint32 node, const HsaNodeProperties& node_props, bool xna
: core::IsaFeature::Disabled;
}
if (node_props.OverrideEngineId.Value != 0) {
isa_ = (core::Isa*)core::IsaRegistry::GetIsa(
core::Isa::Version(node_props.OverrideEngineId.ui32.Major, node_props.OverrideEngineId.ui32.Minor,
node_props.OverrideEngineId.ui32.Stepping), sramecc, xnack);
} else {
// Set instruction set architecture via node property, only on GPU device.
isa_ = (core::Isa*)core::IsaRegistry::GetIsa(
core::Isa::Version(node_props.EngineId.ui32.Major, node_props.EngineId.ui32.Minor,
node_props.EngineId.ui32.Stepping), sramecc, xnack);
isa_ = (core::Isa*)core::IsaRegistry::GetIsa(
core::Isa::Version(node_props.EngineId.ui32.Major, node_props.EngineId.ui32.Minor,
node_props.EngineId.ui32.Stepping), sramecc, xnack);
}
assert(isa_ != nullptr && "ISA registry inconsistency.");