diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_cpu_agent.cpp b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_cpu_agent.cpp index cdbd9e13d0..c876a85c5a 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_cpu_agent.cpp +++ b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_cpu_agent.cpp @@ -367,6 +367,9 @@ hsa_status_t CpuAgent::GetInfo(hsa_agent_info_t attribute, void* value) const { return core::Runtime::runtime_singleton_->GetSystemInfo(HSA_SYSTEM_INFO_TIMESTAMP_FREQUENCY, value); break; + case HSA_AMD_AGENT_INFO_ASIC_FAMILY_ID: + *((uint32_t*)value) = static_cast(properties_.FamilyID); + break; default: return HSA_STATUS_ERROR_INVALID_ARGUMENT; break; 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 15c038e40a..83d570d2ce 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 @@ -1102,6 +1102,9 @@ hsa_status_t GpuAgent::GetInfo(hsa_agent_info_t attribute, void* value) const { case HSA_AMD_AGENT_INFO_TIMESTAMP_FREQUENCY: *((uint64_t*)value) = wallclock_frequency_; break; + case HSA_AMD_AGENT_INFO_ASIC_FAMILY_ID: + *((uint32_t*)value) = static_cast(properties_.FamilyID); + break; default: return HSA_STATUS_ERROR_INVALID_ARGUMENT; break; diff --git a/projects/rocr-runtime/runtime/hsa-runtime/image/device_info.cpp b/projects/rocr-runtime/runtime/hsa-runtime/image/device_info.cpp index 1c7fb7a2ef..55801e2e8c 100755 --- a/projects/rocr-runtime/runtime/hsa-runtime/image/device_info.cpp +++ b/projects/rocr-runtime/runtime/hsa-runtime/image/device_info.cpp @@ -79,150 +79,5 @@ hsa_status_t GetGPUAsicID(hsa_agent_t agent, uint32_t *chip_id) { return HSA_STATUS_SUCCESS; } -uint32_t DevIDToAddrLibFamily(uint32_t dev_id) { - uint32_t major_ver = MajorVerFromDevID(dev_id); - uint32_t minor_ver = MinorVerFromDevID(dev_id); - uint32_t step = StepFromDevID(dev_id); - - // FAMILY_UNKNOWN 0xFF - // FAMILY_SI - Southern Islands: Tahiti (P), Pitcairn (PM), Cape Verde (M), Bali (V) - // FAMILY_TN - Fusion Trinity: Devastator - DVST (M), Scrapper (V) - // FAMILY_CI - Sea Islands: Hawaii (P), Maui (P), Bonaire (M) - // FAMILY_KV - Fusion Kaveri: Spectre, Spooky; Fusion Kabini: Kalindi - // FAMILY_VI - Volcanic Islands: Iceland (V), Tonga (M) - // FAMILY_CZ - Carrizo, Nolan, Amur - // FAMILY_PI - Pirate Islands - // FAMILY_AI - Arctic Islands - // FAMILY_RV - Raven - // FAMILY_NV - Navi - switch (major_ver) { - case 6: - switch (minor_ver) { - case 0: - switch (step) { - case 0: - case 1: - return FAMILY_SI; - - default: - return FAMILY_UNKNOWN; - } - default: - return FAMILY_UNKNOWN; - } - - case 7: - switch (minor_ver) { - case 0: - switch (step) { - case 0: - case 1: - case 2: - return FAMILY_CI; - - case 3: - return FAMILY_KV; - - default: - return FAMILY_UNKNOWN; - } - - default: - return FAMILY_UNKNOWN; - } - - case 8: - switch (minor_ver) { - case 0: - switch (step) { - case 0: - case 2: - case 3: - case 4: - return FAMILY_VI; - - case 1: - return FAMILY_CZ; - - default: - return FAMILY_UNKNOWN; - } - default: - return FAMILY_UNKNOWN; - } - - case 9: - switch (minor_ver) { - case 0: - switch (step) { - case 0: - case 1: - case 4: // Vega12 - case 6: // Vega20 - case 8: // Arcturus - case 10: // Aldebaran - return FAMILY_AI; - - case 2: - case 3: - case 12: - return FAMILY_RV; - - default: - return FAMILY_UNKNOWN; - } - - default: - return FAMILY_UNKNOWN; - } - - case 10: - switch (minor_ver) { - case 0: - case 1: // Navi - case 3: - switch (step) { - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - return FAMILY_NV; - - default: - return FAMILY_UNKNOWN; - } - - default: - return FAMILY_UNKNOWN; - } - - case 11: - switch (minor_ver) { - case 0: - switch (step) { - case 0: - case 1: - case 2: - return FAMILY_GFX1100; - case 3: - return FAMILY_GFX1103; - default: - return FAMILY_UNKNOWN; - } - - default: - return FAMILY_UNKNOWN; - } - - default: - return FAMILY_UNKNOWN; - } - - assert(0); // We should have already returned -} - } // namespace image } // namespace rocr diff --git a/projects/rocr-runtime/runtime/hsa-runtime/image/device_info.h b/projects/rocr-runtime/runtime/hsa-runtime/image/device_info.h index c8b4a82231..fffd712cdf 100755 --- a/projects/rocr-runtime/runtime/hsa-runtime/image/device_info.h +++ b/projects/rocr-runtime/runtime/hsa-runtime/image/device_info.h @@ -52,7 +52,6 @@ namespace image { uint32_t MajorVerFromDevID(uint32_t dev_id); uint32_t MinorVerFromDevID(uint32_t dev_id); uint32_t StepFromDevID(uint32_t dev_id); -uint32_t DevIDToAddrLibFamily(uint32_t dev_id); hsa_status_t GetGPUAsicID(hsa_agent_t agent, uint32_t *chip_id); } // namespace image diff --git a/projects/rocr-runtime/runtime/hsa-runtime/image/image_manager_kv.cpp b/projects/rocr-runtime/runtime/hsa-runtime/image/image_manager_kv.cpp index 0b4fef8a72..e1b775bc3e 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/image/image_manager_kv.cpp +++ b/projects/rocr-runtime/runtime/hsa-runtime/image/image_manager_kv.cpp @@ -74,7 +74,9 @@ hsa_status_t ImageManagerKv::Initialize(hsa_agent_t agent_handle) { uint32_t major_ver = MajorVerFromDevID(chip_id_); assert(status == HSA_STATUS_SUCCESS); - family_type_ = DevIDToAddrLibFamily(chip_id_); + status = HSA::hsa_agent_get_info( + agent_, static_cast(HSA_AMD_AGENT_INFO_ASIC_FAMILY_ID), &family_type_); + assert(status == HSA_STATUS_SUCCESS); HsaGpuTileConfig tileConfig = {0}; unsigned int tc[40]; diff --git a/projects/rocr-runtime/runtime/hsa-runtime/inc/hsa_ext_amd.h b/projects/rocr-runtime/runtime/hsa-runtime/inc/hsa_ext_amd.h index b59642ea6c..926057924f 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/inc/hsa_ext_amd.h +++ b/projects/rocr-runtime/runtime/hsa-runtime/inc/hsa_ext_amd.h @@ -330,7 +330,13 @@ typedef enum hsa_amd_agent_info_s { * in the range 1-400MHz. * The type of this attribute is uint64_t. */ - HSA_AMD_AGENT_INFO_TIMESTAMP_FREQUENCY = 0xA016 + HSA_AMD_AGENT_INFO_TIMESTAMP_FREQUENCY = 0xA016, + /** + * Queries for the ASIC family ID of an agent. + * The type of this attribute is uint32_t. + */ + HSA_AMD_AGENT_INFO_ASIC_FAMILY_ID = 0xA107 + } hsa_amd_agent_info_t; typedef struct hsa_amd_hdp_flush_s {