From 3127d1ffdc76326be5c1ecdf6bdeab9e54f2eef8 Mon Sep 17 00:00:00 2001 From: Sean Keely Date: Mon, 19 Apr 2021 19:47:06 -0500 Subject: [PATCH] Ensure ROCr created threads have no CPU affinity. Change-Id: I53828dbaf055b65b61bdd11f0eadfcc806596821 --- runtime/hsa-runtime/core/util/lnx/os_linux.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/runtime/hsa-runtime/core/util/lnx/os_linux.cpp b/runtime/hsa-runtime/core/util/lnx/os_linux.cpp index e60036929a..6c27611519 100644 --- a/runtime/hsa-runtime/core/util/lnx/os_linux.cpp +++ b/runtime/hsa-runtime/core/util/lnx/os_linux.cpp @@ -74,7 +74,7 @@ void* __stdcall ThreadTrampoline(void* arg) { void* Data = ar->entry_args; delete ar; CallMe(Data); - return NULL; + return nullptr; } // Thread container allows multiple waits and separate close (destroy). @@ -99,7 +99,16 @@ class os_thread { assert(err == 0 && "pthread_attr_setstacksize failed."); } - int err = pthread_create(&thread, &attrib, ThreadTrampoline, args.get()); + int cores = get_nprocs_conf(); + cpu_set_t* cpuset = CPU_ALLOC(cores); + for(int i=0; i