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
这个提交包含在:
1 父节点
6cf5089f37
当前提交
b192beea52
6 个文件已更改
+31
-4
没有与搜索条件相匹配的文件
+18
-2
@@ -48,6 +48,10 @@
|
||||
#define DT_GNU_HASH 0x6ffffef5
|
||||
#endif // DT_GNU_HASH
|
||||
|
||||
#ifdef ROCCLR_SUPPORT_NUMA_POLICY
|
||||
#include <numa.h>
|
||||
#endif // ROCCLR_SUPPORT_NUMA_POLICY
|
||||
|
||||
#include <atomic>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
@@ -60,7 +64,6 @@
|
||||
#include <algorithm>
|
||||
#include <mutex>
|
||||
|
||||
|
||||
namespace amd {
|
||||
|
||||
static struct sigaction oldSigAction;
|
||||
@@ -121,7 +124,6 @@ static void divisionErrorHandler(int sig, siginfo_t* info, void* ptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
std::cerr << "Unhandled signal in divisionErrorHandler()" << std::endl;
|
||||
::abort();
|
||||
}
|
||||
@@ -306,6 +308,20 @@ void Os::currentStackInfo(address* base, size_t* size) {
|
||||
|
||||
void Os::setCurrentThreadName(const char* name) { ::prctl(PR_SET_NAME, name); }
|
||||
|
||||
void Os::setPreferredNumaNode(uint32_t node) {
|
||||
if (AMD_CPU_AFFINITY) {
|
||||
// Set preferred node affinity mask
|
||||
int num_cpus = numa_num_configured_cpus();
|
||||
bitmask* bm = numa_bitmask_alloc(num_cpus);
|
||||
|
||||
numa_node_to_cpus(node, bm);
|
||||
if (numa_sched_setaffinity(0, bm) < 0) {
|
||||
assert(0 && "failed to set affinity");
|
||||
}
|
||||
|
||||
numa_free_cpumask(bm);
|
||||
}
|
||||
}
|
||||
|
||||
void* Thread::entry(Thread* thread) {
|
||||
sigset_t set;
|
||||
|
||||
在新工单中引用
屏蔽一个用户