Commit 2e1e7b4e authored by Anirudh's avatar Anirudh
Browse files

Tweaks for multiple instances

parent 0dba194a
......@@ -56,14 +56,14 @@ PROCESS_TYPE EntryFunctionContainer::getProcessType ()
return _procType;
}
SuspensionAutomata::susCFGVectorType EntryFunctionContainer::getSusCFG(int numInstance) {
//return _susCFG;
return _instanceSusCFGMap[numInstance];
SuspensionAutomata::susCFGVectorType EntryFunctionContainer::getSusCFG() {
return _susCFG;
//return _instanceSusCFGMap[numInstance];
}
SuspensionAutomata::transitionVectorType EntryFunctionContainer::getSusAuto(int numInstance) {
//return _susAuto;
return _instanceSautoMap[numInstance];
SuspensionAutomata::transitionVectorType EntryFunctionContainer::getSusAuto() {
return _susAuto;
//return _instanceSautoMap[numInstance];
}
///////////////////////////////////////////////////////////////////////////////////////////////
void EntryFunctionContainer::setName (string n)
......@@ -103,15 +103,17 @@ void EntryFunctionContainer::addWaits (FindWait & f)
}
void EntryFunctionContainer::addSusCFGAuto(SuspensionAutomata &s, int numInstance) {
//_susCFG = s.getSusCFG();
//_susAuto = s.getSauto();
void EntryFunctionContainer::addSusCFGAuto(SuspensionAutomata &s) {
_susCFG = s.getSusCFG();
_susAuto = s.getSauto();
/*
if (_instanceSusCFGMap.find(numInstance) == _instanceSusCFGMap.end() && _instanceSautoMap.find(numInstance) == _instanceSautoMap.end()) {
_instanceSusCFGMap.insert(instanceSusCFGPairType(numInstance, s.getSusCFG()));
_instanceSautoMap.insert(instanceSautoPairType(numInstance, s.getSauto()));
}
*/
}
void EntryFunctionContainer::addNotifys( FindNotify& f) {
......@@ -131,53 +133,47 @@ void EntryFunctionContainer::addNotifys( FindNotify& f) {
///////////////////////////////////////////////////////////////////////////////////////////////
void EntryFunctionContainer::dumpSusCFG(raw_ostream & os)
{
for (instanceSusCFGMapType::iterator it = _instanceSusCFGMap.begin(), eit = _instanceSusCFGMap.end();
it != eit;
it++) {
os << "\n#############################################";
SuspensionAutomata::susCFGVectorType susCFGVector = it->second;
for (unsigned int i = 0; i < susCFGVector.size(); i++) {
os << "\n Block ID : " << susCFGVector.at(i)->getBlockID();
os << "\n Is Wait Block : " << susCFGVector.at(i)->isWaitBlock();
if (susCFGVector.at(i)->getParentBlockID()) {
os << "\n Parent ID : " << susCFGVector.at(i)->getParentBlockID();
SusCFG *parentBlock = susCFGVector.at(i)->getParentSusCFGBlock();
os << "\n Parent Block ID : " << parentBlock->getBlockID();
os << "\n Size of Children : " << parentBlock->getChildBlockList().size();
os << "\n#############################################";
SuspensionAutomata::susCFGVectorType susCFGVector = _susCFG;
for (unsigned int i = 0; i < susCFGVector.size(); i++) {
os << "\n Block ID : " << susCFGVector.at(i)->getBlockID();
os << "\n Is Wait Block : " << susCFGVector.at(i)->isWaitBlock();
if (susCFGVector.at(i)->getParentBlockID()) {
os << "\n Parent ID : " << susCFGVector.at(i)->getParentBlockID();
SusCFG *parentBlock = susCFGVector.at(i)->getParentSusCFGBlock();
os << "\n Parent Block ID : " << parentBlock->getBlockID();
os << "\n Size of Children : " << parentBlock->getChildBlockList().size();
}
vector < SusCFG * >predBlocks = susCFGVector.at(i)->getPredBlocks();
vector < SusCFG * >succBlocks = susCFGVector.at(i)->getSuccBlocks();
os << "\n Predecessor Blocks : ";
for (unsigned int j = 0; j < predBlocks.size(); j++) {
if (predBlocks.at(j)) {
os << predBlocks.at(j)->getBlockID() << " ";
}
vector < SusCFG * >predBlocks = susCFGVector.at(i)->getPredBlocks();
vector < SusCFG * >succBlocks = susCFGVector.at(i)->getSuccBlocks();
os << "\n Predecessor Blocks : ";
for (unsigned int j = 0; j < predBlocks.size(); j++) {
if (predBlocks.at(j)) {
os << predBlocks.at(j)->getBlockID() << " ";
}
}
os << "\n Successor Blocks : ";
for (unsigned int j = 0; j < succBlocks.size(); j++) {
if (succBlocks.at(j)) {
os << succBlocks.at(j)->getBlockID() << " ";
}
os << "\n Successor Blocks : ";
for (unsigned int j = 0; j < succBlocks.size(); j++) {
if (succBlocks.at(j)) {
os << succBlocks.at(j)->getBlockID() << " ";
}
}
}
}
}
}
}
void EntryFunctionContainer::dumpSauto(raw_ostream & os)
{
for (instanceSautoMapType::iterator it = _instanceSautoMap.begin(), eit = _instanceSautoMap.end();
it != eit;
it++) {
vector < Transition * >transitionVector = it->second;
os << "\n Size of transitionVector : " << transitionVector.size();
for (unsigned int i = 0; i < transitionVector.size(); i++) {
Transition *t = transitionVector.at(i);
t->dump(os);
}
}
}
vector < Transition * >transitionVector = _susAuto;
os << "\n Size of transitionVector : " << transitionVector.size();
for (unsigned int i = 0; i < transitionVector.size(); i++) {
Transition *t = transitionVector.at(i);
t->dump(os);
}
}
void EntryFunctionContainer::dump (raw_ostream & os, int tabn)
......
......@@ -56,8 +56,8 @@ namespace scpar {
waitContainerListType getWaitCalls ();
notifyContainerListType getNotifyCalls();
FindSensitivity::senseMapType getSenseMap();
SuspensionAutomata::susCFGVectorType getSusCFG(int);
SuspensionAutomata::transitionVectorType getSusAuto(int);
SuspensionAutomata::susCFGVectorType getSusCFG();
SuspensionAutomata::transitionVectorType getSusAuto();
instanceSautoMapType getInstanceSautoMap();
instanceSusCFGMapType getInstanceSusCFGMap();
......@@ -65,7 +65,7 @@ namespace scpar {
void addSensitivityInfo(FindSensitivity &);
void addWaits (FindWait &);
void addNotifys(FindNotify &);
void addSusCFGAuto(SuspensionAutomata &, int);
void addSusCFGAuto(SuspensionAutomata &);
//void setConstructorStmt (Stmt *);
void setName (string);
......@@ -85,8 +85,8 @@ namespace scpar {
waitContainerListType _waitCalls;
notifyContainerListType _notifyCalls;
FindSensitivity::senseMapType _senseMap;
instanceSautoMapType _instanceSautoMap;
instanceSusCFGMapType _instanceSusCFGMap;
vector<Transition*> _susAuto;
vector<SusCFG*> _susCFG;
};
}
#endif
......@@ -31,6 +31,10 @@ void Model::addModuleDecl(ModuleDecl * md)
_modules.insert(Model::modulePairType(md->getName(), md));
}
void Model::addModuleDeclInstances(ModuleDecl* md, vector<ModuleDecl*> mdVec){
_moduleInstanceMap.insert(moduleInstancePairType(md, mdVec));
}
void Model::addSimulationTime(FindSimTime::simulationTimeMapType simTime)
{
_simTime = simTime;
......@@ -106,6 +110,10 @@ Model::moduleMapType Model::getModuleDecl()
return _modules;
}
Model::moduleInstanceMapType Model::getModuleInstanceMap() {
return _moduleInstanceMap;
}
Model::eventMapType Model::getEventMapType()
{
return _eventMap;
......
......@@ -25,13 +25,16 @@ namespace scpar {
typedef pair < string, EventContainer * >eventPairType;
typedef map < string, EventContainer * >eventMapType;
typedef pair<ModuleDecl*, vector<ModuleDecl*> >moduleInstancePairType;
typedef map<ModuleDecl*, vector<ModuleDecl*> >moduleInstanceMapType;
Model();
~Model();
void addSCModules(SCModules *);
void addModuleDecl(ModuleDecl *);
void addModuleDecl(ModuleDecl *);
void addModuleDeclInstances(ModuleDecl*, vector<ModuleDecl*>);
void addSimulationTime(FindSimTime::simulationTimeMapType);
void addGlobalEvents(FindGlobalEvents::globalEventMapType);
void addNetlist(FindNetlist &);
......@@ -40,6 +43,7 @@ namespace scpar {
moduleMapType getModuleDecl();
eventMapType getEventMapType();
moduleInstanceMapType getModuleInstanceMap();
unsigned int getNumEvents();
void dump(raw_ostream &);
......@@ -49,6 +53,7 @@ namespace scpar {
protected:
moduleMapType _modules;
moduleInstanceMapType _moduleInstanceMap;
FindSimTime::simulationTimeMapType _simTime;
eventMapType _eventMap;
FunctionDecl *_scmainFcDecl;
......
......@@ -72,9 +72,10 @@ void GPUMacro::dump(raw_ostream& os) {
}
///////////////////////////////////////////////////////
FindGPUMacro::FindGPUMacro(CXXMethodDecl* entryFunction, llvm::raw_ostream& os):
_entryFunction(entryFunction),
_os(os)
FindGPUMacro::FindGPUMacro(CXXMethodDecl* entryFunction, int instanceNum, llvm::raw_ostream& os):
_entryFunction(entryFunction),
_instanceNum(instanceNum),
_os(os)
{
TraverseDecl(_entryFunction);
}
......@@ -86,7 +87,7 @@ FindGPUMacro::~FindGPUMacro()
bool FindGPUMacro::VisitForStmt(ForStmt *fstmt) {
Stmt *body = fstmt->getBody();
int tx = 1, ty = 1, tz = 1 , bx = 1, by = 1, bz = 1, gpu_time = 0, cpu_time = 0;
int tx = 1, ty = 1, tz = 1 , bx = 1, by = 1, bz = 1, gpu_time = 0, cpu_time = 0, instanceNum = 0;
for (Stmt::child_iterator it = body->child_begin(), eit = body->child_end();
it != eit;
it++) {
......@@ -96,46 +97,69 @@ bool FindGPUMacro::VisitForStmt(ForStmt *fstmt) {
if (DeclStmt *ds = dyn_cast<DeclStmt>(s)){
if (VarDecl *vd = dyn_cast<VarDecl>(ds->getSingleDecl())){
string className = vd->getTypeSourceInfo()->getType().getBaseTypeIdentifier()->getName();
if (className == "profile_time") {
if (CXXConstructExpr *ce = dyn_cast<CXXConstructExpr>(vd->getInit()->IgnoreImpCasts())) {
IntegerLiteral *x = dyn_cast<IntegerLiteral>(ce->getArg(0));
IntegerLiteral *y = dyn_cast<IntegerLiteral>(ce->getArg(1));
gpu_time = x->getValue().getSExtValue();
cpu_time = y->getValue().getSExtValue();
}
}
if (className == "sc_gpu_thread_hierarchy") {
if (CXXConstructExpr *ce = dyn_cast<CXXConstructExpr>(vd->getInit()->IgnoreImpCasts())) {
IntegerLiteral *x = dyn_cast<IntegerLiteral>(ce->getArg(0));
IntegerLiteral *y = dyn_cast<IntegerLiteral>(ce->getArg(1));
IntegerLiteral *z = dyn_cast<IntegerLiteral>(ce->getArg(2));
tx = x->getValue().getSExtValue();
ty = y->getValue().getSExtValue();
tz = z->getValue().getSExtValue();
}
if (className == "profile_time") {
if (CXXConstructExpr *ce = dyn_cast<CXXConstructExpr>(vd->getInit()->IgnoreImpCasts())) {
if (MaterializeTemporaryExpr *me = dyn_cast<MaterializeTemporaryExpr>(ce->getArg(0)->IgnoreImpCasts())) {
if (CXXTemporaryObjectExpr *co = dyn_cast<CXXTemporaryObjectExpr>(me->GetTemporaryExpr()->IgnoreImpCasts())) {
IntegerLiteral *x = dyn_cast<IntegerLiteral>(co->getArg(0));
IntegerLiteral *y = dyn_cast<IntegerLiteral>(co->getArg(1));
IntegerLiteral *z = dyn_cast<IntegerLiteral>(co->getArg(2));
instanceNum = x->getValue().getSExtValue();
gpu_time = y->getValue().getSExtValue();
cpu_time = z->getValue().getSExtValue();
}
}
}
}
if (className == "sc_gpu_thread_hierarchy") {
if (CXXConstructExpr *ce = dyn_cast<CXXConstructExpr>(vd->getInit()->IgnoreImpCasts())) {
if (MaterializeTemporaryExpr *me = dyn_cast<MaterializeTemporaryExpr>(ce->getArg(0)->IgnoreImpCasts())) {
if (CXXTemporaryObjectExpr *co = dyn_cast<CXXTemporaryObjectExpr>(me->GetTemporaryExpr()->IgnoreImpCasts())) {
IntegerLiteral *x = dyn_cast<IntegerLiteral>(co->getArg(1));
IntegerLiteral *y = dyn_cast<IntegerLiteral>(co->getArg(2));
IntegerLiteral *z = dyn_cast<IntegerLiteral>(co->getArg(3));
IntegerLiteral *w = dyn_cast<IntegerLiteral>(co->getArg(4));
instanceNum = x->getValue().getSExtValue();
tx = x->getValue().getSExtValue();
ty = y->getValue().getSExtValue();
tz = z->getValue().getSExtValue();
}
}
if (className == "sc_gpu_block_hierarchy") {
if (CXXConstructExpr *ce = dyn_cast<CXXConstructExpr>(vd->getInit()->IgnoreImpCasts())) {
IntegerLiteral *x = dyn_cast<IntegerLiteral>(ce->getArg(0));
IntegerLiteral *y = dyn_cast<IntegerLiteral>(ce->getArg(1));
IntegerLiteral *z = dyn_cast<IntegerLiteral>(ce->getArg(2));
bx = x->getValue().getSExtValue();
by = y->getValue().getSExtValue();
bz = z->getValue().getSExtValue();
}
}
}
}
}
if (tx && ty && tz && bx && by && bz && gpu_time && cpu_time) {
GPUMacro *gm = new GPUMacro(bx, by, bz, tx, ty, tz, gpu_time, cpu_time);
_forStmtGPUMacroMap.insert(forStmtGPUMacroPairType(fstmt, gm));
}
}
}
if (className == "sc_gpu_block_hierarchy") {
if (CXXConstructExpr *ce = dyn_cast<CXXConstructExpr>(vd->getInit()->IgnoreImpCasts())) {
if (MaterializeTemporaryExpr *me = dyn_cast<MaterializeTemporaryExpr>(ce->getArg(0)->IgnoreImpCasts())) {
if (CXXTemporaryObjectExpr *co = dyn_cast<CXXTemporaryObjectExpr>(me->GetTemporaryExpr()->IgnoreImpCasts())) {
IntegerLiteral *x = dyn_cast<IntegerLiteral>(co->getArg(1));
IntegerLiteral *y = dyn_cast<IntegerLiteral>(co->getArg(2));
IntegerLiteral *z = dyn_cast<IntegerLiteral>(co->getArg(3));
IntegerLiteral *w = dyn_cast<IntegerLiteral>(co->getArg(4));
instanceNum = x->getValue().getSExtValue();
bx = y->getValue().getSExtValue();
by = z->getValue().getSExtValue();
bz = w->getValue().getSExtValue();
}
}
}
}
}
}
//_os <<"\n gpu_time : " <<gpu_time<<" cpu_time : " <<cpu_time<<" instanceNum : " <<_instanceNum<<" " <<instanceNum;
if (tx && ty && tz && bx && by && bz && gpu_time && cpu_time && (_instanceNum == instanceNum)) {
//_os <<"\n instance num : " <<_instanceNum<<" " <<instanceNum;
GPUMacro *gm = new GPUMacro(bx, by, bz, tx, ty, tz, gpu_time, cpu_time);
//_os <<"\n for stmt : " <<fstmt;
forStmtInstanceIdPairType forStmtInstanceId = make_pair(_instanceNum, fstmt);
_forStmtGPUMacroMap.insert(forStmtGPUMacroPairType(forStmtInstanceId, gm));
break;
}
}
return true;
}
......@@ -150,7 +174,7 @@ void FindGPUMacro::dump(){
it != eit;
it++) {
_os <<"\n For Stmt : " <<it->first;
_os <<"\n For Stmt : " <<it->first.second;
_os <<"\n GPU kernel parameters \n";
it->second->dump(_os);
}
......
......@@ -17,7 +17,7 @@ namespace scpar {
GPUMacro(int, int, int, int, int, int, int, int);
GPUMacro();
~GPUMacro();
int getBlockIdx();
int getBlockIdy();
int getBlockIdz();
......@@ -29,6 +29,7 @@ namespace scpar {
void dump(raw_ostream&);
private:
int _blockIdx;
int _blockIdy;
int _blockIdz;
......@@ -42,12 +43,14 @@ namespace scpar {
class FindGPUMacro:public RecursiveASTVisitor <FindGPUMacro> {
public:
typedef pair <ForStmt*, GPUMacro*> forStmtGPUMacroPairType;
typedef map<ForStmt*, GPUMacro*> forStmtGPUMacroMapType;
typedef pair<int, ForStmt*> forStmtInstanceIdPairType;
typedef map<int, ForStmt*> forStmtInstanceIdMapType;
FindGPUMacro(CXXMethodDecl*, raw_ostream&);
typedef pair <forStmtInstanceIdPairType, GPUMacro* > forStmtGPUMacroPairType;
typedef map <forStmtInstanceIdPairType, GPUMacro* > forStmtGPUMacroMapType;
FindGPUMacro(CXXMethodDecl*, int, raw_ostream&);
~FindGPUMacro();
// ANI : Need to add other loops as well.....
virtual bool VisitForStmt(ForStmt *);
......@@ -59,8 +62,10 @@ namespace scpar {
private:
forStmtGPUMacroMapType _forStmtGPUMacroMap;
CXXMethodDecl* _entryFunction;
raw_ostream& _os;
CXXMethodDecl* _entryFunction;
int _instanceNum;
raw_ostream& _os;
};
}
#endif
......@@ -13,6 +13,20 @@ GlobalSuspensionAutomata::~GlobalSuspensionAutomata()
{
}
// ANI : Needs to be a template class
bool GlobalSuspensionAutomata::notInVector(vector<SusCFG*> vec, SusCFG* cand){
for (int i = 0; i<vec.size(); i++) {
if (vec.at(i) == cand) {
return 0;
}
}
return 1;
}
void GlobalSuspensionAutomata::initializeGpuMap() {
// GPU map algorithm.
// Input is the global sauto
......@@ -20,6 +34,7 @@ void GlobalSuspensionAutomata::initializeGpuMap() {
// Need data structures of the form <time-stamp, vector of dp segments>
// Using the above data structure, for each time-stamp set, we identify which ones will go on the gpu.
//_os <<"\n Initialize gpu map\n";
for (int i = 0; i<_globalSauto.size(); i++) {
Transition *aTransition = _globalSauto.at(i);
for (int j = 0; j<_globalSauto.size(); j++) {
......@@ -36,31 +51,49 @@ void GlobalSuspensionAutomata::initializeGpuMap() {
vector<SusCFG*> bCodeBlocks = bTransition->returnCodeBlocks();
vector<SusCFG*> susCFGBlockList;
// iterate through each code block set and accumulate DP blocks.
for (int k = 0; k<aCodeBlocks.size(); k++) {
if (_susCFGBlockGPUMacroMap.find(aCodeBlocks.at(k)) != _susCFGBlockGPUMacroMap.end()) {
// DP segment found
susCFGBlockList.push_back(aCodeBlocks.at(k));
}
}
for (int k = 0; k<bCodeBlocks.size(); k++) {
if (_susCFGBlockGPUMacroMap.find(bCodeBlocks.at(k)) != _susCFGBlockGPUMacroMap.end()) {
// DP segment found
susCFGBlockList.push_back(bCodeBlocks.at(k));
}
}
if (susCFGBlockList.size() != 0) {
// debug susCFGBlockGPUMacroMap
timePairType timePair = make_pair(aTimePair.first, aTimePair.second);
if (_commonTimeDPMap.find(timePair) == _commonTimeDPMap.end()) {
_commonTimeDPMap.insert(commonTimeDPPairType(timePair, susCFGBlockList));
for (int k = 0; k<aCodeBlocks.size(); k++) {
if (_susCFGBlockGPUMacroMap.find(aCodeBlocks.at(k)) != _susCFGBlockGPUMacroMap.end()) {
// DP segment found
//if (notInVector(susCFGBlockList, aCodeBlocks.at(k))){
susCFGBlockList.push_back(aCodeBlocks.at(k));
//}
}
}
for (int k = 0; k<bCodeBlocks.size(); k++) {
if (_susCFGBlockGPUMacroMap.find(bCodeBlocks.at(k)) != _susCFGBlockGPUMacroMap.end()) {
// DP segment found
//if(notInVector(susCFGBlockList, bCodeBlocks.at(k))) {
susCFGBlockList.push_back(bCodeBlocks.at(k));
//}
}
}
_commonTimeDPMap.insert(commonTimeDPPairType(timePair, susCFGBlockList));
}
else {
//_os <<"\n Else path taken";
}
}
commonTimeDPMapType::iterator commonTimeFound = _commonTimeDPMap.find(timePair);
vector<SusCFG*> tmpVec = commonTimeFound->second;
for (int k = 0; k<bCodeBlocks.size(); k++) {
if (_susCFGBlockGPUMacroMap.find(bCodeBlocks.at(k)) != _susCFGBlockGPUMacroMap.end()) {
// DP segment found
if(notInVector(tmpVec, bCodeBlocks.at(k))) {
susCFGBlockList.push_back(bCodeBlocks.at(k));
}
}
}
tmpVec.insert(tmpVec.end(), susCFGBlockList.begin(), susCFGBlockList.end());
_commonTimeDPMap.erase(timePair);
_commonTimeDPMap.insert(commonTimeDPPairType(timePair, tmpVec));
}
}
}
}
}
// Actual gpu map algo starts here....
// use _commonTimeDPMap and for each timePair with more than one DP segment, do pseudo-knapsacking algo
......@@ -80,10 +113,10 @@ void GlobalSuspensionAutomata::initializeGpuMap() {
for (int i = 0; i<susCFGBlockList.size(); i++) {
if (_susCFGBlockGPUMacroMap.find(susCFGBlockList.at(i)) != _susCFGBlockGPUMacroMap.end()) {
// Found a DP segment
//_os <<"\n Found a DP segment\n";
susCFGBlockGPUMacroMapType::iterator gpuMacroFound = _susCFGBlockGPUMacroMap.find(susCFGBlockList.at(i));
GPUMacro *gpuMacro = gpuMacroFound->second;
u = u + max(gpuMacro->getGPUTime(), gpuMacro->getCPUTime());
u = u + max(gpuMacro->getGPUTime(), gpuMacro->getCPUTime());
//_os <<"\n Value of u : " <<u;
}
}
......@@ -100,8 +133,7 @@ void GlobalSuspensionAutomata::initializeGpuMap() {
l = c_actual;
}
}
}
}
}
bool GlobalSuspensionAutomata::GPUMap(float c_ideal, vector<SusCFG*> susCFGBlockList, float& c_actual) {
......@@ -111,9 +143,11 @@ bool GlobalSuspensionAutomata::GPUMap(float c_ideal, vector<SusCFG*> susCFGBlock
susCFGBlockGPUMacroMapType::iterator gpuMacroFound = _susCFGBlockGPUMacroMap.find(susCFGBlockList.at(i));
GPUMacro *gpuMacro = gpuMacroFound->second;
//_os <<"\n GPU macro gpu time : " <<gpuMacro->getGPUTime()<<" CPU time : " <<gpuMacro->getCPUTime();
if (gpuMacro->getGPUTime() <= c_ideal) {
if (gpuMacro->getGPUTime() <= c_ideal) {
susCFGBlockList.at(i)->addGPUFit();
//_os <<"\n Pushing block : " <<susCFGBlockList.at(i)<<" into gpuFitSusCFGVector";
//_os <<"\n Pushing block : " <<susCFGBlockList.at(i)<<" into gpuFitSusCFGVector";
gpuFitSusCFGVector.push_back(susCFGBlockList.at(i));
}
}
......@@ -223,7 +257,7 @@ int GlobalSuspensionAutomata::max(int a, int b) {
return a;
}
void GlobalSuspensionAutomata::annotateTransitionsDPSeg(Transition * t)
void GlobalSuspensionAutomata::annotateTransitionsDPSeg(Transition * t, int instanceId)
{
vector < SusCFG * >codeBlockVector = t->returnCodeBlocks();
......@@ -239,47 +273,59 @@ void GlobalSuspensionAutomata::annotateTransitionsDPSeg(Transition * t)
_entryFunctionGPUMacroMap.begin(), eit =
_entryFunctionGPUMacroMap.end(); it != eit; it++) {
FindGPUMacro::forStmtGPUMacroMapType gpuMacroMap = it->second;
if (gpuMacroMap.find(fs) != gpuMacroMap.end()) {
FindGPUMacro::forStmtGPUMacroMapType::iterator gpuMacroFound =
gpuMacroMap.find(fs);
_susCFGBlockGPUMacroMap.
insert(susCFGBlockGPUMacroPairType
(susCFGBlock, gpuMacroFound->second));
}
for (FindGPUMacro::forStmtGPUMacroMapType::iterator fit = gpuMacroMap.begin(),
fite = gpuMacroMap.end();
fit != fite;
fit++) {
FindGPUMacro::forStmtInstanceIdPairType forStmtInstanceIdPair = fit->first;
if (forStmtInstanceIdPair.first == instanceId && forStmtInstanceIdPair.second == fs) {
_susCFGBlockGPUMacroMap.insert(susCFGBlockGPUMacroPairType(susCFGBlock, fit->second));
break;
}
}
}
}
}
}
}
void GlobalSuspensionAutomata::initialise()
{
_moduleMap = _systemcModel->getModuleDecl();
for (Model::moduleMapType::iterator it = _moduleMap.begin(), eit =
_moduleMap.end(); it != eit; it++) {
ModuleDecl *md = it->second;
vector < EntryFunctionContainer * >vef = md->getEntryFunctionContainer();
vector < string > instanceList = md->getInstanceList();
for (int i = 0; i < instanceList.size(); i++) {
for (int j = 0; j < vef.size(); j++) {
SuspensionAutomata::transitionVectorType sauto =
vef.at(j)->getSusAuto(i);
_instanceFunctionSautoMap.
_moduleInstanceMap = _systemcModel->getModuleInstanceMap();
for (Model::moduleInstanceMapType::iterator it = _moduleInstanceMap.begin(), eit =
_moduleInstanceMap.end(); it != eit; it++) {
vector<ModuleDecl*> mdVec = it->second;
for (int i = 0; i<mdVec.size(); i++) {
ModuleDecl *md = mdVec.at(i);