SWDEV-299893 - Set preferred node affinity

Set affinity to the closest node of the current GPU. This reduces
the latency to fetch kernel args since device would query the CPU cache
of core which did the dispatch. This behavior is controlled with
AMD_CPU_AFFINITY env var(disabled by default)

Change-Id: I65afba62cb818ea25a311b88d1c0dd5c51330292
Este commit está contenido en:
Saleel Kudchadker
2021-11-09 03:12:19 -08:00
padre 6cf5089f37
commit b192beea52
Se han modificado 6 ficheros con 31 adiciones y 4 borrados
+3 -2
Ver fichero
@@ -170,7 +170,8 @@ Device::Device(hsa_agent_t bkendDevice)
, queuePool_(QueuePriority::Total)
, coopHostcallBuffer_(nullptr)
, queueWithCUMaskPool_(QueuePriority::Total)
, numOfVgpus_(0) {
, numOfVgpus_(0)
, preferred_numa_node_(0) {
group_segment_.handle = 0;
system_segment_.handle = 0;
system_coarse_segment_.handle = 0;
@@ -194,7 +195,7 @@ void Device::setupCpuAgent() {
}
}
}
preferred_numa_node_ = index;
cpu_agent_ = cpu_agents_[index].agent;
system_segment_ = cpu_agents_[index].fine_grain_pool;
system_coarse_segment_ = cpu_agents_[index].coarse_grain_pool;
+3
Ver fichero
@@ -534,6 +534,8 @@ class Device : public NullDevice {
virtual amd::Memory* GetArenaMemObj(const void* ptr, size_t& offset);
const uint32_t getPreferredNumaNode() const { return preferred_numa_node_; }
private:
bool create();
@@ -555,6 +557,7 @@ class Device : public NullDevice {
static std::vector<AgentInfo> cpu_agents_;
hsa_agent_t cpu_agent_;
uint32_t preferred_numa_node_;
std::vector<hsa_agent_t> p2p_agents_; //!< List of P2P agents available for this device
std::vector<Device*> enabled_p2p_devices_; //!< List of user enabled P2P devices for this device
mutable std::mutex lock_allow_access_; //!< To serialize allow_access calls