Add global memory clock and width info on the agent attribute list and deprecate the ones in the memory region attribute list.

[git-p4: depot-paths = "//depot/stg/hsa/drivers/hsa/runtime/": change = 1256098]


[ROCm/ROCR-Runtime commit: 4ccc695b95]
This commit is contained in:
Besar Wicaksono (xN/A) TX [TEXT]
2016-04-08 16:29:10 -05:00
orang tua 6b9e626507
melakukan c8f0efbee1
3 mengubah file dengan 57 tambahan dan 3 penghapusan
@@ -134,6 +134,16 @@ class GpuAgentInt : public core::Agent {
//
// @retval HSA profile.
virtual hsa_profile_t profile() const = 0;
// @brief Query the agent memory bus width in bit.
//
// @retval Bus width in bit.
virtual uint32_t memory_bus_width() const = 0;
// @brief Query the agent memory maximum frequency in MHz.
//
// @retval Bus width in MHz.
virtual uint32_t memory_max_frequency() const = 0;
};
class GpuAgent : public GpuAgentInt {
@@ -255,6 +265,16 @@ class GpuAgent : public GpuAgentInt {
// @brief Override from amd::GpuAgentInt.
__forceinline hsa_profile_t profile() const override { return profile_; }
// @brief Override from amd::GpuAgentInt.
__forceinline uint32_t memory_bus_width() const override {
return memory_bus_width_;
}
// @brief Override from amd::GpuAgentInt.
__forceinline uint32_t memory_max_frequency() const override {
return memory_max_frequency_;
}
protected:
static const uint32_t minAqlSize_ = 0x1000; // 4KB min
static const uint32_t maxAqlSize_ = 0x20000; // 8MB max
@@ -344,6 +364,12 @@ class GpuAgent : public GpuAgentInt {
size_t trap_code_buf_size_;
// @brief The GPU memory bus width in bit.
uint32_t memory_bus_width_;
// @brief The GPU memory maximum frequency in MHz.
uint32_t memory_max_frequency_;
private:
// @brief Query the driver to get the region list owned by this agent.
void InitRegionList();
@@ -73,6 +73,8 @@ GpuAgent::GpuAgent(HSAuint32 node, const HsaNodeProperties& node_props)
is_kv_device_(false),
trap_code_buf_(NULL),
trap_code_buf_size_(0),
memory_bus_width_(0),
memory_max_frequency_(0),
ape1_base_(0),
ape1_size_(0) {
const bool is_apu_node = (properties_.NumCPUCores > 0);
@@ -226,6 +228,9 @@ void GpuAgent::InitRegionList() {
if (!is_apu_node) {
mem_props[mem_idx].VirtualBaseAddress = 0;
}
memory_bus_width_ = mem_props[mem_idx].Width;
memory_max_frequency_ = mem_props[mem_idx].MemoryClockMax;
case HSA_HEAPTYPE_GPU_LDS:
case HSA_HEAPTYPE_GPU_SCRATCH:
case HSA_HEAPTYPE_DEVICE_SVM: {
@@ -235,6 +240,12 @@ void GpuAgent::InitRegionList() {
regions_.push_back(region);
break;
}
case HSA_HEAPTYPE_SYSTEM:
if (is_apu_node) {
memory_bus_width_ = mem_props[mem_idx].Width;
memory_max_frequency_ = mem_props[mem_idx].MemoryClockMax;
}
break;
default:
continue;
}
@@ -626,6 +637,12 @@ hsa_status_t GpuAgent::GetInfo(hsa_agent_info_t attribute, void* value) const {
case HSA_AMD_AGENT_INFO_BDFID:
*((uint32_t*)value) = static_cast<uint32_t>(properties_.LocationId);
break;
case HSA_AMD_AGENT_INFO_MEMORY_WIDTH:
*((uint32_t*)value) = memory_bus_width_;
break;
case HSA_AMD_AGENT_INFO_MEMORY_MAX_FREQUENCY:
*((uint32_t*)value) = memory_max_frequency_;
break;
default:
return HSA_STATUS_ERROR_INVALID_ARGUMENT;
break;
@@ -99,7 +99,16 @@ typedef enum hsa_amd_agent_info_s {
* Agent BDF_ID, named LocationID in thunk. The type of this attribute is
* uint16_t.
*/
HSA_AMD_AGENT_INFO_BDFID = 0xA006
HSA_AMD_AGENT_INFO_BDFID = 0xA006,
/**
* Memory Interface width, the return value type is uint32_t.
* This attribute is deprecated. Use
*/
HSA_AMD_AGENT_INFO_MEMORY_WIDTH = 0xA007,
/**
* Max Memory Clock, the return value type is uint32_t.
*/
HSA_AMD_AGENT_INFO_MEMORY_MAX_FREQUENCY = 0xA008
} hsa_amd_agent_info_t;
/**
@@ -116,11 +125,13 @@ typedef enum hsa_amd_region_info_s {
*/
HSA_AMD_REGION_INFO_BASE = 0xA001,
/**
* Memory Interface width, the return value type is uint32_t
* Memory Interface width, the return value type is uint32_t.
* This attribute is deprecated. Use HSA_AMD_AGENT_INFO_MEMORY_WIDTH.
*/
HSA_AMD_REGION_INFO_BUS_WIDTH = 0xA002,
/**
* Max Memory Clock, the return value type is uint32_t
* Max Memory Clock, the return value type is uint32_t.
* This attribute is deprecated. Use HSA_AMD_AGENT_INFO_MEMORY_MAX_FREQUENCY.
*/
HSA_AMD_REGION_INFO_MAX_CLOCK_FREQUENCY = 0xA003
} hsa_amd_region_info_t;