cpu: Change thread assignments for heterogenous SMT
Trying to run an SE system with varying threads per core (SMT cores + Non-SMT cores) caused failures due to the CPU id assignment logic. The comment about thread assignment (worrying about core 0 not having tid 0) seems not to be valid given that our configuration scripts initialize them in order. This removes that constraint so a heterogenously threaded sytem can work.
This commit is contained in:
parent
c05d268cfa
commit
52d521e433
|
@ -436,21 +436,17 @@ BaseCPU::getMasterPort(const string &if_name, PortID idx)
|
||||||
void
|
void
|
||||||
BaseCPU::registerThreadContexts()
|
BaseCPU::registerThreadContexts()
|
||||||
{
|
{
|
||||||
|
assert(system->multiThread || numThreads == 1);
|
||||||
|
|
||||||
ThreadID size = threadContexts.size();
|
ThreadID size = threadContexts.size();
|
||||||
for (ThreadID tid = 0; tid < size; ++tid) {
|
for (ThreadID tid = 0; tid < size; ++tid) {
|
||||||
ThreadContext *tc = threadContexts[tid];
|
ThreadContext *tc = threadContexts[tid];
|
||||||
|
|
||||||
/** This is so that contextId and cpuId match where there is a
|
if (system->multiThread) {
|
||||||
* 1cpu:1context relationship. Otherwise, the order of registration
|
|
||||||
* could affect the assignment and cpu 1 could have context id 3, for
|
|
||||||
* example. We may even want to do something like this for SMT so that
|
|
||||||
* cpu 0 has the lowest thread contexts and cpu N has the highest, but
|
|
||||||
* I'll just do this for now
|
|
||||||
*/
|
|
||||||
if (numThreads == 1)
|
|
||||||
tc->setContextId(system->registerThreadContext(tc, _cpuId));
|
|
||||||
else
|
|
||||||
tc->setContextId(system->registerThreadContext(tc));
|
tc->setContextId(system->registerThreadContext(tc));
|
||||||
|
} else {
|
||||||
|
tc->setContextId(system->registerThreadContext(tc, _cpuId));
|
||||||
|
}
|
||||||
|
|
||||||
if (!FullSystem)
|
if (!FullSystem)
|
||||||
tc->getProcessPtr()->assignThreadContext(tc->contextId());
|
tc->getProcessPtr()->assignThreadContext(tc->contextId());
|
||||||
|
|
|
@ -99,6 +99,9 @@ class System(MemObject):
|
||||||
"Address to mask loading binaries with")
|
"Address to mask loading binaries with")
|
||||||
load_offset = Param.UInt64(0, "Address to offset loading binaries with")
|
load_offset = Param.UInt64(0, "Address to offset loading binaries with")
|
||||||
|
|
||||||
|
multi_thread = Param.Bool(False,
|
||||||
|
"Supports multi-threaded CPUs? Impacts Thread/Context IDs")
|
||||||
|
|
||||||
# Dynamic voltage and frequency handler for the system, disabled by default
|
# Dynamic voltage and frequency handler for the system, disabled by default
|
||||||
# Provide list of domains that need to be controlled by the handler
|
# Provide list of domains that need to be controlled by the handler
|
||||||
dvfs_handler = DVFSHandler()
|
dvfs_handler = DVFSHandler()
|
||||||
|
|
|
@ -80,6 +80,7 @@ int System::numSystemsRunning = 0;
|
||||||
System::System(Params *p)
|
System::System(Params *p)
|
||||||
: MemObject(p), _systemPort("system_port", this),
|
: MemObject(p), _systemPort("system_port", this),
|
||||||
_numContexts(0),
|
_numContexts(0),
|
||||||
|
multiThread(p->multi_thread),
|
||||||
pagePtr(0),
|
pagePtr(0),
|
||||||
init_param(p->init_param),
|
init_param(p->init_param),
|
||||||
physProxy(_systemPort, p->cache_line_size),
|
physProxy(_systemPort, p->cache_line_size),
|
||||||
|
|
|
@ -196,6 +196,7 @@ class System : public MemObject
|
||||||
|
|
||||||
std::vector<ThreadContext *> threadContexts;
|
std::vector<ThreadContext *> threadContexts;
|
||||||
int _numContexts;
|
int _numContexts;
|
||||||
|
const bool multiThread;
|
||||||
|
|
||||||
ThreadContext *getThreadContext(ContextID tid)
|
ThreadContext *getThreadContext(ContextID tid)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue