Skip to content

Commit

Permalink
Isolation mapping policy
Browse files Browse the repository at this point in the history
  • Loading branch information
jefg89 committed Oct 14, 2021
1 parent 764c145 commit 5a957a1
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 4 deletions.
53 changes: 53 additions & 0 deletions common/scheduler/policies/mapSecureAlone.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#include "mapSecureAlone.h"
#include "scheduler_open.h"
#include "fixed_types.h"
#include <algorithm>
#include <iostream>
#include <map>
#include <set>

using namespace std;

MapSecureAlone::MapSecureAlone(unsigned int numTasks, unsigned int coreRows, unsigned int coreColumns, std::vector<int> preferredTile)
: m_core_rows(coreRows), m_core_columns(coreColumns), m_preferred_tile(preferredTile) {
int coresPerTile = Sim()->getConfig()->getCoresPerTile();
std::vector<int> cores0;
for (int core = 0; core < coresPerTile; core++)
cores0.push_back(m_preferred_tile.at(0) * coresPerTile + core);
m_preferred_cores_order.push_back(cores0);

for (size_t i = 1; i < numTasks; i++)
{
// If we have a preferred tile, add those cores
if (m_preferred_tile.at(i) > 0) {
std::vector<int> cores;
for (int core = 0; core < coresPerTile; core++)
cores.push_back(m_preferred_tile.at(i) * coresPerTile + core);
m_preferred_cores_order.push_back(cores);
}
//Otherwise add all cores except the ones on tile 0
else {
std::vector<int> cores;
for (size_t j = coresPerTile; j < coreRows * coreColumns; j++)
cores.push_back(j);
m_preferred_cores_order.push_back(cores);
}
}
}

std::vector<int> MapSecureAlone::map(UInt32 taskID, int taskCoreRequirement, const std::vector<bool> &availableCores, const std::vector<bool> &activeCores) {
std::vector<int> cores;

// try to fill with preferred cores
for (const int &c : m_preferred_cores_order.at(taskID)) {
if (availableCores.at(c)) {
cores.push_back(c);
if ((int)cores.size() == taskCoreRequirement) {
return cores;
}
}
}

std::vector<int> empty;
return empty;
}
23 changes: 23 additions & 0 deletions common/scheduler/policies/mapSecureAlone.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* This header implements the "map to specific tile" policy
*/

#ifndef __MAP_SECURE_ALONE_H
#define __MAP_SECURE_ALONE_H

#include "mappingpolicy.h"

class MapSecureAlone: public MappingPolicy {
public:
MapSecureAlone(unsigned int numTasks, unsigned int coreRows, unsigned int coreColumns, std::vector<int> preferredTile);
virtual std::vector<int> map(UInt32 taskID, int taskCoreRequirement, const std::vector<bool> &availableCores, const std::vector<bool> &activeCores);

private:
unsigned int m_core_rows;
unsigned int m_core_columns;
std::vector<int> m_preferred_tile;
std::vector<std::vector<int>> m_preferred_cores_order;

};

#endif
12 changes: 12 additions & 0 deletions common/scheduler/scheduler_open.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "policies/dvfsTestStaticPower.h"
#include "policies/mapFirstUnused.h"
#include "policies/mapOnTile.h"
#include "policies/mapSecureAlone.h"
#include "policies/migNextTile.h"
#include "policies/migRandom.h"
#include "policies/migFreeTile.h"
Expand Down Expand Up @@ -245,6 +246,17 @@ void SchedulerOpen::initMappingPolicy(String policyName) {
mappingPolicy = new MapOnTile(numberOfTasks, coreRows, coreColumns, preferredTiles);

}

else
if (policyName == "secure_alone"){
vector<int> preferredTiles;
for (int taskIterator = 0; taskIterator < numberOfTasks; taskIterator++) {
int preferredTile = Sim()->getCfg()->getIntArray("scheduler/open/preferred_tiles", taskIterator);
preferredTiles.push_back(preferredTile);
}
mappingPolicy = new MapSecureAlone(numberOfTasks, coreRows, coreColumns, preferredTiles);

}

//else if (policyName ="XYZ") {... } //Place to instantiate a new mapping logic. Implementation is put in "policies" package.

Expand Down
6 changes: 3 additions & 3 deletions config/base.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ suppress_stdout = false # Suppress the application's output to stdout
suppress_stderr = false # Suppress the application's output to stderr

# Total number of cores in the simulation
total_cores = 32
total_cores = 16

enable_icache_modeling = false

Expand Down Expand Up @@ -332,7 +332,7 @@ type = open

[scheduler/open]
migration = secure # Set the migration policy: secure, next_tile, random, free_tile
logic = first_unused #Set the scheduling algorithm used. Currently supported: on_tile, first_unused.
logic = secure_alone #Set the scheduling algorithm used. Currently supported: on_tile, first_unused.
epoch = 10000000 #10000000 #Set the scheduling epoch in ns; granularity at which open scheduler is called.
queuePolicy = FIFO #Set the queuing policy. Currently support: FIFO.
#distribution = explicit
Expand All @@ -343,7 +343,7 @@ arrivalInterval = 100000000 #Set the (expected) interval between two arrivals in
explicitArrivalTimes= 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 #0,0,0,10000000,0,0,0,0,0,0,0,0,0 #0,3000000,3000000,0,0,6000000,6000000
core_mask = 1 # Mask of cores on which threads can be scheduled (default: 1, all cores)
preferred_core = -1 # -1 is used to detect the end of the preferred order
preferred_tiles =0,1,2,3,4,5,6,7,8,9,10,11,12,13 #0,0,0,0,1,1,1,2,2,2,3,3,3 #used to to select the preferred tile for tasks
preferred_tiles = 0 #0,0,0,0,1,1,1,2,2,2,3,3,3 #used to to select the preferred tile for tasks

[scheduler/open/migration_function]
alpha = 8.5
Expand Down
2 changes: 1 addition & 1 deletion simulationcontrol/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
SNIPER = os.path.dirname(HERE)

RESULTS_FOLDER = os.path.join(SNIPER, 'results')
NUMBER_CORES = 32
NUMBER_CORES = 16
SNIPER_CONFIG = 'gainestown'

0 comments on commit 5a957a1

Please sign in to comment.