Remove unnecessary functions, keep it simple for testing
# Explain what has been changed # Explain why this change is being made # Provide links to any relevant tickets, articles or other resources
This commit is contained in:
@@ -8,13 +8,13 @@ void SMS::schedule(gp *payload)
|
||||
|
||||
Thread thread = DramExtension::getExtension(payload).getThread();
|
||||
// update memory request counter
|
||||
memrequestcounter[thread]++;
|
||||
// memrequestcounter[thread]++;
|
||||
inFlightMemRequestCounter[thread]++;
|
||||
|
||||
// update memory request intensity
|
||||
sc_time lastrequestTimeOfGeneration = GenerationExtension::getExtension(payload).TimeOfGeneration();
|
||||
sc_time memClk = Configuration::getInstance().memSpec.clk;
|
||||
memoryIntensity[thread] = (memrequestcounter[thread] * 1000.0 * memClk) / lastrequestTimeOfGeneration; // in MPKC
|
||||
// sc_time lastrequestTimeOfGeneration = GenerationExtension::getExtension(payload).TimeOfGeneration();
|
||||
// sc_time memClk = Configuration::getInstance().memSpec.clk;
|
||||
// memoryIntensity[thread] = (memrequestcounter[thread] * 1000.0 * memClk) / lastrequestTimeOfGeneration; // in MPKC
|
||||
}
|
||||
|
||||
std::pair<Command, gp*> SMS::getNextRequest(Bank bank)
|
||||
@@ -39,16 +39,16 @@ std::pair<Command, gp*> SMS::getNextRequest(Bank bank)
|
||||
|
||||
}
|
||||
|
||||
unsigned int SMS::totalMemoryRequests()
|
||||
{
|
||||
//TODO: recheck this? how about total in-flight requests instead?
|
||||
unsigned int totalSize = 0;
|
||||
for (auto &reqQueue : buffer)
|
||||
{
|
||||
totalSize += reqQueue.second.size();
|
||||
}
|
||||
return totalSize;
|
||||
}
|
||||
//unsigned int SMS::totalMemoryRequests()
|
||||
//{
|
||||
// //TODO: recheck this? how about total in-flight requests instead?
|
||||
// unsigned int totalSize = 0;
|
||||
// for (auto &reqQueue : buffer)
|
||||
// {
|
||||
// totalSize += reqQueue.second.size();
|
||||
// }
|
||||
// return totalSize;
|
||||
//}
|
||||
|
||||
bool SMS::batchFormation()
|
||||
{
|
||||
@@ -80,25 +80,10 @@ void SMS::batchScheduler()
|
||||
bool isSJF = (rand() % 100) < SJFprobability;
|
||||
if (!existReadyBatch())
|
||||
{
|
||||
if (totalMemoryRequests() == 0)
|
||||
// pick & drain a ready batch
|
||||
if (batchFormation())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (totalMemoryRequests() <= 16 && totalMemoryRequests() > 0)
|
||||
{
|
||||
// bypass if system is lightly load
|
||||
bypassRequests();
|
||||
}
|
||||
else if (totalMemoryRequests() > 16)
|
||||
{
|
||||
// bypass low memory intensity thread
|
||||
bypassLowMemoryIntensity();
|
||||
|
||||
// pick & drain a ready batch
|
||||
if (batchFormation())
|
||||
{
|
||||
isSJF ? selectSJF() : selectRR();
|
||||
}
|
||||
isSJF ? selectSJF() : selectRR();
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -207,33 +192,33 @@ bool SMS::batchFormation(Thread thread)
|
||||
}
|
||||
}
|
||||
|
||||
void SMS::bypassRequests()
|
||||
{
|
||||
for (auto& thread_requests : buffer)
|
||||
{
|
||||
for (auto request = thread_requests.second.begin(); request != thread_requests.second.end(); request++)
|
||||
{
|
||||
Bank bank = DramExtension::getExtension(*request).getBank();
|
||||
bankbuffer[bank].emplace_back(*request);
|
||||
thread_requests.second.erase(request);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SMS::bypassLowMemoryIntensity()
|
||||
{
|
||||
unsigned int totalNumThreads = Configuration::getInstance().NumberOfTracePlayers;
|
||||
for (unsigned int threadID = 1; threadID <= totalNumThreads; threadID++)
|
||||
{
|
||||
if (memoryIntensity[Thread(threadID)] < 1 && memoryIntensity[Thread(threadID)] > 0)
|
||||
{
|
||||
for (auto request = buffer[Thread(threadID)].begin();
|
||||
request != buffer[Thread(threadID)].end(); request++)
|
||||
{
|
||||
Bank bank = DramExtension::getExtension(*request).getBank();
|
||||
bankbuffer[bank].emplace_back(*request);
|
||||
buffer[Thread(threadID)].erase(request);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//void SMS::bypassRequests()
|
||||
//{
|
||||
// for (auto& thread_requests : buffer)
|
||||
// {
|
||||
// for (auto request = thread_requests.second.begin(); request != thread_requests.second.end(); request++)
|
||||
// {
|
||||
// Bank bank = DramExtension::getExtension(*request).getBank();
|
||||
// bankbuffer[bank].emplace_back(*request);
|
||||
// thread_requests.second.erase(request);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//void SMS::bypassLowMemoryIntensity()
|
||||
//{
|
||||
// unsigned int totalNumThreads = Configuration::getInstance().NumberOfTracePlayers;
|
||||
// for (unsigned int threadID = 1; threadID <= totalNumThreads; threadID++)
|
||||
// {
|
||||
// if (memoryIntensity[Thread(threadID)] < 1 && memoryIntensity[Thread(threadID)] > 0)
|
||||
// {
|
||||
// for (auto request = buffer[Thread(threadID)].begin();
|
||||
// request != buffer[Thread(threadID)].end(); request++)
|
||||
// {
|
||||
// Bank bank = DramExtension::getExtension(*request).getBank();
|
||||
// bankbuffer[bank].emplace_back(*request);
|
||||
// buffer[Thread(threadID)].erase(request);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
Reference in New Issue
Block a user