diff --git a/projects/rocr-runtime/libhsakmt/include/hsakmt/hsakmttypes.h b/projects/rocr-runtime/libhsakmt/include/hsakmt/hsakmttypes.h index ca8c2d709a..3ae8165b93 100644 --- a/projects/rocr-runtime/libhsakmt/include/hsakmt/hsakmttypes.h +++ b/projects/rocr-runtime/libhsakmt/include/hsakmt/hsakmttypes.h @@ -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 diff --git a/projects/rocr-runtime/libhsakmt/src/topology.c b/projects/rocr-runtime/libhsakmt/src/topology.c index 1bd3303db8..7cb8e754fc 100644 --- a/projects/rocr-runtime/libhsakmt/src/topology.c +++ b/projects/rocr-runtime/libhsakmt/src/topology.c @@ -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; diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp index 46a7af0b11..1b7fa8bc47 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp +++ b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp @@ -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.");