Add query for agent memory and aql ext properties
Add query to return flags for GPU agent memory properties and AQL extensions. Implement flag to determine that GPU agent is an APU Change-Id: Ic04c51290b2b9763e14989c117f35a2e22297453
このコミットが含まれているのは:
@@ -609,6 +609,8 @@ class GpuAgent : public GpuAgentInt {
|
||||
// @brief initialize libdrm handle
|
||||
void InitLibDrm();
|
||||
|
||||
void GetInfoMemoryProperties(uint8_t value[8]) const;
|
||||
|
||||
// @brief Alternative aperture base address. Only on KV.
|
||||
uintptr_t ape1_base_;
|
||||
|
||||
|
||||
@@ -392,6 +392,12 @@ hsa_status_t CpuAgent::GetInfo(hsa_agent_info_t attribute, void* value) const {
|
||||
case HSA_AMD_AGENT_INFO_NEAREST_CPU:
|
||||
((hsa_agent_t*)value)->handle = 0;
|
||||
break;
|
||||
case HSA_AMD_AGENT_INFO_MEMORY_PROPERTIES:
|
||||
memset(value, 0, sizeof(uint8_t) * 8);
|
||||
break;
|
||||
case HSA_AMD_AGENT_INFO_AQL_EXTENSIONS:
|
||||
memset(value, 0, sizeof(uint8_t) * 8);
|
||||
break;
|
||||
default:
|
||||
return HSA_STATUS_ERROR_INVALID_ARGUMENT;
|
||||
break;
|
||||
|
||||
@@ -1200,6 +1200,28 @@ hsa_status_t GpuAgent::EnableDmaProfiling(bool enable) {
|
||||
return HSA_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
void GpuAgent::GetInfoMemoryProperties(uint8_t value[8]) const {
|
||||
auto setFlag = [&](uint32_t bit) {
|
||||
assert(bit < 8 * 8 && "Flag value exceeds input parameter size");
|
||||
|
||||
uint index = bit / 8;
|
||||
uint subBit = bit % 8;
|
||||
((uint8_t*)value)[index] |= 1 << subBit;
|
||||
};
|
||||
|
||||
// Fill the HSA_AMD_MEMORY_PROPERTY_AGENT_IS_APU flag
|
||||
switch (properties_.DeviceId) {
|
||||
case 0x15DD: /* gfx902 - Raven Ridge */
|
||||
case 0x15D8: /* gfx909 - Raven Ridge 2 */
|
||||
case 0x1636: /* gfx90c - Renoir */
|
||||
case 0x74A0: /* gfx940 and gfx942-APU */
|
||||
setFlag(HSA_AMD_MEMORY_PROPERTY_AGENT_IS_APU);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
hsa_status_t GpuAgent::GetInfo(hsa_agent_info_t attribute, void* value) const {
|
||||
// agent, and vendor name size limit
|
||||
const size_t attribute_u = static_cast<size_t>(attribute);
|
||||
@@ -1521,6 +1543,14 @@ hsa_status_t GpuAgent::GetInfo(hsa_agent_info_t attribute, void* value) const {
|
||||
case HSA_AMD_AGENT_INFO_NEAREST_CPU:
|
||||
*((hsa_agent_t*)value) = GetNearestCpuAgent()->public_handle();
|
||||
break;
|
||||
case HSA_AMD_AGENT_INFO_MEMORY_PROPERTIES:
|
||||
memset(value, 0, sizeof(uint8_t) * 8);
|
||||
GetInfoMemoryProperties((uint8_t*)value);
|
||||
break;
|
||||
case HSA_AMD_AGENT_INFO_AQL_EXTENSIONS:
|
||||
memset(value, 0, sizeof(uint8_t) * 8);
|
||||
/* Not yet implemented */
|
||||
break;
|
||||
default:
|
||||
return HSA_STATUS_ERROR_INVALID_ARGUMENT;
|
||||
break;
|
||||
|
||||
@@ -66,6 +66,17 @@ extern "C" {
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Macro to use to determine that a flag is set when querying flags within uint8_t[8]
|
||||
* types
|
||||
*/
|
||||
static __inline__ __attribute__((always_inline)) bool hsa_flag_isset64(uint8_t* value,
|
||||
uint32_t bit) {
|
||||
unsigned int index = bit / 8;
|
||||
unsigned int subBit = bit % 8;
|
||||
return ((uint8_t*)value)[index] & (1 << subBit);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief A fixed-size type used to represent ::hsa_signal_condition_t constants.
|
||||
*/
|
||||
@@ -405,9 +416,28 @@ typedef enum hsa_amd_agent_info_s {
|
||||
* Returns the hsa_agent_t of the nearest CPU agent
|
||||
* The type of this attribute is hsa_agent_t.
|
||||
*/
|
||||
HSA_AMD_AGENT_INFO_NEAREST_CPU = 0xA113
|
||||
HSA_AMD_AGENT_INFO_NEAREST_CPU = 0xA113,
|
||||
/**
|
||||
* Bit-mask indicating memory properties of this agent. A memory property is set if the flag bit
|
||||
* is set at that position. User may use the hsa_flag_isset64 macro to verify whether a flag
|
||||
* is set. The type of this attribute is uint8_t[8].
|
||||
*/
|
||||
HSA_AMD_AGENT_INFO_MEMORY_PROPERTIES = 0xA114,
|
||||
/**
|
||||
* Bit-mask indicating AQL Extensions supported by this agent. An AQL extension is set if the flag
|
||||
* bit is set at that position. User may use the hsa_flag_isset64 macro to verify whether a flag
|
||||
* is set. The type of this attribute is uint8_t[8].
|
||||
*/
|
||||
HSA_AMD_AGENT_INFO_AQL_EXTENSIONS = 0xA115 /* Not implemented yet */
|
||||
} hsa_amd_agent_info_t;
|
||||
|
||||
/**
|
||||
* @brief Agent memory properties attributes
|
||||
*/
|
||||
typedef enum hsa_amd_agent_memory_properties_s {
|
||||
HSA_AMD_MEMORY_PROPERTY_AGENT_IS_APU = (1 << 0),
|
||||
} hsa_amd_agent_memory_properties_t;
|
||||
|
||||
/**
|
||||
* @brief SDMA engine IDs unique by single set bit position.
|
||||
*/
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする