rocr/aie: Add AIEAgent missing info

Change-Id: I32e9acc7b8b7dee4e9ff5524fec5c440bb8ece0e
This commit is contained in:
Yiannis Papadopoulos
2024-12-07 00:04:54 +00:00
committed by Jenkins Compute
parent c48e8a918e
commit c343a9dc60
@@ -3,7 +3,7 @@
// The University of Illinois/NCSA
// Open Source License (NCSA)
//
// Copyright (c) 2022-2023, Advanced Micro Devices, Inc. All rights reserved.
// Copyright (c) 2022-2024, Advanced Micro Devices, Inc. All rights reserved.
//
// Developed by:
//
@@ -42,7 +42,9 @@
#include "core/inc/amd_aie_agent.h"
#include <cstring>
#include <functional>
#include <string>
#include "core/inc/amd_aie_aql_queue.h"
#include "core/inc/amd_memory_region.h"
@@ -108,13 +110,19 @@ hsa_status_t AieAgent::GetInfo(hsa_agent_info_t attribute, void *value) const {
switch (attribute_) {
case HSA_AGENT_INFO_NAME: {
std::string name_info_("aie2");
std::strcpy(reinterpret_cast<char *>(value), name_info_.c_str());
const std::string name_info_("aie2");
assert(name_info_.size() < HSA_PUBLIC_NAME_SIZE);
std::memset(value, 0, HSA_PUBLIC_NAME_SIZE);
std::strncat(reinterpret_cast<char *>(value), name_info_.c_str(),
name_info_.size());
break;
}
case HSA_AGENT_INFO_VENDOR_NAME: {
std::string vendor_name_info_("AMD");
std::strcpy(reinterpret_cast<char *>(value), vendor_name_info_.c_str());
const std::string vendor_name_info_("AMD");
assert(vendor_name_info_.size() < HSA_PUBLIC_NAME_SIZE);
std::memset(value, 0, HSA_PUBLIC_NAME_SIZE);
std::strncat(reinterpret_cast<char *>(value), vendor_name_info_.c_str(),
vendor_name_info_.size());
break;
}
case HSA_AGENT_INFO_FEATURE:
@@ -123,14 +131,30 @@ hsa_status_t AieAgent::GetInfo(hsa_agent_info_t attribute, void *value) const {
case HSA_AGENT_INFO_MACHINE_MODEL:
*reinterpret_cast<hsa_machine_model_t *>(value) = HSA_MACHINE_MODEL_LARGE;
break;
case HSA_AGENT_INFO_BASE_PROFILE_DEFAULT_FLOAT_ROUNDING_MODES:
case HSA_AGENT_INFO_DEFAULT_FLOAT_ROUNDING_MODE:
// TODO: validate if this is true.
*reinterpret_cast<hsa_default_float_rounding_mode_t *>(value) =
HSA_DEFAULT_FLOAT_ROUNDING_MODE_NEAR;
break;
case HSA_AGENT_INFO_PROFILE:
*reinterpret_cast<hsa_profile_t *>(value) = profile_;
break;
case HSA_AGENT_INFO_WAVEFRONT_SIZE:
*reinterpret_cast<uint32_t *>(value) = 0;
break;
case HSA_AGENT_INFO_WORKGROUP_MAX_DIM:
std::memset(value, 0, sizeof(uint16_t) * 3);
break;
case HSA_AGENT_INFO_WORKGROUP_MAX_SIZE:
*reinterpret_cast<uint32_t *>(value) = 0;
break;
case HSA_AGENT_INFO_GRID_MAX_DIM:
std::memset(value, 0, sizeof(uint16_t) * 3);
break;
case HSA_AGENT_INFO_GRID_MAX_SIZE:
*reinterpret_cast<uint32_t *>(value) = 0;
break;
case HSA_AGENT_INFO_FBARRIER_MAX_SIZE:
*reinterpret_cast<uint32_t *>(value) = 0;
break;
@@ -161,6 +185,36 @@ hsa_status_t AieAgent::GetInfo(hsa_agent_info_t attribute, void *value) const {
case HSA_AGENT_INFO_VERSION_MINOR:
*reinterpret_cast<uint32_t *>(value) = 0;
break;
case HSA_AMD_AGENT_INFO_CHIP_ID:
*reinterpret_cast<uint32_t *>(value) = 0;
break;
case HSA_AMD_AGENT_INFO_CACHELINE_SIZE:
*reinterpret_cast<uint32_t *>(value) = 0;
break;
case HSA_AMD_AGENT_INFO_COMPUTE_UNIT_COUNT:
*reinterpret_cast<uint32_t *>(value) = 0;
break;
case HSA_AMD_AGENT_INFO_MAX_CLOCK_FREQUENCY:
*reinterpret_cast<uint32_t *>(value) = 0;
break;
case HSA_AMD_AGENT_INFO_DRIVER_NODE_ID:
*reinterpret_cast<uint32_t *>(value) = node_id();
break;
case HSA_AMD_AGENT_INFO_MAX_ADDRESS_WATCH_POINTS:
*reinterpret_cast<uint32_t *>(value) = 0;
break;
case HSA_AMD_AGENT_INFO_BDFID:
*reinterpret_cast<uint32_t *>(value) = 0;
break;
case HSA_AMD_AGENT_INFO_NUM_SIMDS_PER_CU:
*reinterpret_cast<uint32_t *>(value) = 0;
break;
case HSA_AMD_AGENT_INFO_NUM_SHADER_ENGINES:
*reinterpret_cast<uint32_t *>(value) = 0;
break;
case HSA_AMD_AGENT_INFO_NUM_SHADER_ARRAYS_PER_SE:
*reinterpret_cast<uint32_t *>(value) = 0;
break;
case HSA_EXT_AGENT_INFO_IMAGE_1D_MAX_ELEMENTS:
case HSA_EXT_AGENT_INFO_IMAGE_1DA_MAX_ELEMENTS:
case HSA_EXT_AGENT_INFO_IMAGE_1DB_MAX_ELEMENTS:
@@ -173,10 +227,29 @@ hsa_status_t AieAgent::GetInfo(hsa_agent_info_t attribute, void *value) const {
*reinterpret_cast<uint32_t *>(value) = 0;
break;
case HSA_AMD_AGENT_INFO_PRODUCT_NAME: {
std::string product_name_info_("AIE-ML");
std::strcpy(reinterpret_cast<char *>(value), product_name_info_.c_str());
const std::string product_name_info_("AIE-ML");
assert(product_name_info_.size() < HSA_PUBLIC_NAME_SIZE);
std::memset(value, 0, HSA_PUBLIC_NAME_SIZE);
std::strncat(reinterpret_cast<char *>(value), product_name_info_.c_str(),
product_name_info_.size());
break;
}
case HSA_AMD_AGENT_INFO_UUID: {
// At this point AIE devices do not support UUID's.
char uuid_tmp[] = "AIE-XX";
snprintf((char *)value, sizeof(uuid_tmp), "%s", uuid_tmp);
break;
}
case HSA_AMD_AGENT_INFO_ASIC_REVISION:
*reinterpret_cast<uint32_t *>(value) = 0;
break;
case HSA_AMD_AGENT_INFO_SVM_DIRECT_HOST_ACCESS:
assert(regions_.size() != 0 && "No device local memory found!");
*reinterpret_cast<bool *>(value) = true;
break;
case HSA_AMD_AGENT_INFO_MEMORY_PROPERTIES:
std::memset(value, 0, sizeof(uint8_t) * 8);
break;
default:
*reinterpret_cast<uint32_t *>(value) = 0;
return HSA_STATUS_ERROR_INVALID_ARGUMENT;