#include <klass.hh>
Inherited by SigFloatGenKlass, and SigIntGenKlass.
Public Member Functions | |
Klass (const string &name, const string &super, int numInputs, int numOutputs, bool __vec=false) | |
virtual | ~Klass () |
void | openLoop (const string &size) |
Open a non-recursive loop on top of the stack of open loops. | |
void | openLoop (Tree recsymbol, const string &size) |
Open a recursive loop on top of the stack of open loops. | |
void | closeLoop (Tree sig=0) |
Close the top loop and either keep it or absorb it within its enclosing loop. | |
void | setLoopProperty (Tree sig, Loop *l) |
Store the loop used to compute a signal. | |
bool | getLoopProperty (Tree sig, Loop *&l) |
Returns the loop used to compute a signal. | |
Loop * | topLoop () |
void | buildTasksList () |
void | addIncludeFile (const string &str) |
void | addLibrary (const string &str) |
void | collectIncludeFile (set< string > &S) |
void | collectLibrary (set< string > &S) |
void | addSubKlass (Klass *son) |
void | addDeclCode (const string &str) |
void | addInitCode (const string &str) |
void | addStaticInitCode (const string &str) |
void | addStaticFields (const string &str) |
void | addUICode (const string &str) |
void | addUIMacro (const string &str) |
void | incUIActiveCount () |
void | incUIPassiveCount () |
void | addSharedDecl (const string &str) |
void | addFirstPrivateDecl (const string &str) |
void | addZone1 (const string &str) |
void | addZone2 (const string &str) |
void | addZone2b (const string &str) |
void | addZone2c (const string &str) |
void | addZone3 (const string &str) |
void | addPreCode (const string &str) |
void | addExecCode (const string &str) |
void | addPostCode (const string &str) |
virtual void | println (int n, ostream &fout) |
Print a full C++ class corresponding to a Faust dsp. | |
virtual void | printComputeMethod (int n, ostream &fout) |
Print Compute() method according to the various switch. | |
virtual void | printComputeMethodScalar (int n, ostream &fout) |
virtual void | printComputeMethodVectorFaster (int n, ostream &fout) |
Uses loops of constant gVecSize boundary in order to provide the C compiler with more optimisation opportunities. | |
virtual void | printComputeMethodVectorSimple (int n, ostream &fout) |
Simple loop layout, generally less efficient than printComputeMethodVectorFaster. | |
virtual void | printComputeMethodOpenMP (int n, ostream &fout) |
virtual void | printComputeMethodScheduler (int n, ostream &fout) |
virtual void | printLoopGraphScalar (int n, ostream &fout) |
virtual void | printLoopGraphVector (int n, ostream &fout) |
Print the loop graph (used for vector code). | |
virtual void | printLoopGraphOpenMP (int n, ostream &fout) |
Print the loop graph as a serie of parallel loops. | |
virtual void | printLoopGraphScheduler (int n, ostream &fout) |
Print the loop graph as a serie of parallel loops. | |
virtual void | printLoopGraphInternal (int n, ostream &fout) |
Print the loop graph (used for internals classes). | |
virtual void | printLoopDeepFirst (int n, ostream &fout, Loop *l, set< Loop * > &visited) |
Print a loop graph deep first. | |
virtual void | printLastLoopLevelScheduler (int n, int lnum, const lset &L, ostream &fout) |
Print the 'level' of the loop graph as a set of parallel loops. | |
virtual void | printLoopLevelScheduler (int n, int lnum, const lset &L, ostream &fout) |
Print the 'level' of the loop graph as a set of parallel loops. | |
virtual void | printOneLoopScheduler (lset::const_iterator p, int n, ostream &fout) |
virtual void | printLoopLevelOpenMP (int n, int lnum, const lset &L, ostream &fout) |
Print the 'level' of the loop graph as a set of parallel loops. | |
virtual void | printMetadata (int n, const map< Tree, set< Tree > > &S, ostream &fout) |
Print metadata declaration. | |
virtual void | printIncludeFile (ostream &fout) |
Print the required include files. | |
virtual void | printLibrary (ostream &fout) |
Print the required C++ libraries as comments in source code. | |
int | inputs () |
int | outputs () |
Protected Attributes | |
string | fKlassName |
string | fSuperKlassName |
int | fNumInputs |
int | fNumOutputs |
int | fNumActives |
number of active controls in the UI (sliders, buttons, etc.) | |
int | fNumPassives |
number of passive widgets in the UI (bargraphs, etc.) | |
set< string > | fIncludeFileSet |
set< string > | fLibrarySet |
list< Klass * > | fSubClassList |
list< string > | fDeclCode |
list< string > | fStaticInitCode |
static init code for class constant tables | |
list< string > | fStaticFields |
static fields after class | |
list< string > | fInitCode |
list< string > | fUICode |
list< string > | fUIMacro |
list< string > | fSharedDecl |
shared declarations | |
list< string > | fFirstPrivateDecl |
first private declarations | |
list< string > | fZone1Code |
shared vectors | |
list< string > | fZone2Code |
first private | |
list< string > | fZone2bCode |
single once per block | |
list< string > | fZone2cCode |
single once per block | |
list< string > | fZone3Code |
private every sub block | |
Loop * | fTopLoop |
active loops currently open | |
property< Loop * > | fLoopProperty |
loops used to compute some signals | |
bool | fVec |
Definition at line 55 of file klass.hh.
Klass::Klass | ( | const string & | name, | |
const string & | super, | |||
int | numInputs, | |||
int | numOutputs, | |||
bool | __vec = false | |||
) | [inline] |
Definition at line 103 of file klass.hh.
00104 : fKlassName(name), fSuperKlassName(super), fNumInputs(numInputs), fNumOutputs(numOutputs), 00105 fNumActives(0), fNumPassives(0), 00106 fTopLoop(new Loop(0, "count")), fVec(__vec) 00107 {}
void Klass::addDeclCode | ( | const string & | str | ) | [inline] |
Definition at line 132 of file klass.hh.
References fDeclCode.
Referenced by buildTasksList(), dlineLoop(), ScalarCompiler::ensureIotaCode(), ScalarCompiler::generateButton(), ScalarCompiler::generateCheckbox(), ScalarCompiler::generateDelayLine(), ScalarCompiler::generateDelayVecNoTemp(), ScalarCompiler::generateHBargraph(), ScalarCompiler::generateHSlider(), ScalarCompiler::generateIota(), ScalarCompiler::generateNumEntry(), ScalarCompiler::generatePrefix(), ScalarCompiler::generateSelect2(), ScalarCompiler::generateSelect3(), ScalarCompiler::generateStaticTable(), ScalarCompiler::generateTable(), ScalarCompiler::generateVariableStore(), ScalarCompiler::generateVBargraph(), ScalarCompiler::generateVSlider(), and vectorLoop().
00132 { fDeclCode.push_back(str); }
void Klass::addExecCode | ( | const string & | str | ) | [inline] |
Definition at line 158 of file klass.hh.
References Loop::addExecCode(), and fTopLoop.
Referenced by VectorCompiler::compileMultiSignal(), ScalarCompiler::compileMultiSignal(), ScalarCompiler::compileSingleSignal(), dlineLoop(), ScalarCompiler::generateDelayLine(), ScalarCompiler::generateDelayVecNoTemp(), ScalarCompiler::generateHBargraph(), ScalarCompiler::generateIota(), ScalarCompiler::generateOutput(), ScalarCompiler::generatePrefix(), ScalarCompiler::generateSelect2(), ScalarCompiler::generateSelect3(), ScalarCompiler::generateVariableStore(), ScalarCompiler::generateVBargraph(), ScalarCompiler::generateWRTbl(), and vectorLoop().
00158 { fTopLoop->addExecCode(str); }
void Klass::addFirstPrivateDecl | ( | const string & | str | ) | [inline] |
Definition at line 149 of file klass.hh.
References fFirstPrivateDecl.
Referenced by dlineLoop(), and ScalarCompiler::generateVariableStore().
00149 { fFirstPrivateDecl.push_back(str); }
void Klass::addIncludeFile | ( | const string & | str | ) | [inline] |
Definition at line 122 of file klass.hh.
References fIncludeFileSet.
Referenced by Compiler::addIncludeFile().
00122 { fIncludeFileSet.insert(str); }
void Klass::addInitCode | ( | const string & | str | ) | [inline] |
Definition at line 134 of file klass.hh.
References fInitCode.
Referenced by buildTasksList(), dlineLoop(), ScalarCompiler::ensureIotaCode(), ScalarCompiler::generateButton(), ScalarCompiler::generateCheckbox(), ScalarCompiler::generateDelayLine(), ScalarCompiler::generateDelayVecNoTemp(), ScalarCompiler::generateHBargraph(), ScalarCompiler::generateHSlider(), ScalarCompiler::generateIota(), ScalarCompiler::generateNumEntry(), ScalarCompiler::generatePrefix(), ScalarCompiler::generateSelect2(), ScalarCompiler::generateSelect3(), ScalarCompiler::generateSigGen(), ScalarCompiler::generateTable(), ScalarCompiler::generateVariableStore(), ScalarCompiler::generateVBargraph(), and ScalarCompiler::generateVSlider().
00134 { fInitCode.push_back(str); }
void Klass::addLibrary | ( | const string & | str | ) | [inline] |
Definition at line 124 of file klass.hh.
References fLibrarySet.
Referenced by Compiler::addLibrary().
00124 { fLibrarySet.insert(str); }
void Klass::addPostCode | ( | const string & | str | ) | [inline] |
Definition at line 159 of file klass.hh.
References Loop::addPostCode(), and fTopLoop.
Referenced by dlineLoop(), ScalarCompiler::ensureIotaCode(), ScalarCompiler::generateDelayLine(), and ScalarCompiler::generateDelayVecNoTemp().
00159 { fTopLoop->addPostCode(str); }
void Klass::addPreCode | ( | const string & | str | ) | [inline] |
Definition at line 157 of file klass.hh.
References Loop::addPreCode(), and fTopLoop.
Referenced by dlineLoop().
00157 { fTopLoop->addPreCode(str); }
void Klass::addSharedDecl | ( | const string & | str | ) | [inline] |
Definition at line 148 of file klass.hh.
References fSharedDecl.
Referenced by VectorCompiler::compileMultiSignal(), dlineLoop(), ScalarCompiler::generateSelect2(), ScalarCompiler::generateSelect3(), and vectorLoop().
00148 { fSharedDecl.push_back(str); }
void Klass::addStaticFields | ( | const string & | str | ) | [inline] |
Definition at line 138 of file klass.hh.
References fStaticFields.
Referenced by ScalarCompiler::generateStaticTable().
00138 { fStaticFields.push_back(str); }
void Klass::addStaticInitCode | ( | const string & | str | ) | [inline] |
Definition at line 136 of file klass.hh.
References fStaticInitCode.
Referenced by ScalarCompiler::generateStaticSigGen(), and ScalarCompiler::generateStaticTable().
00136 { fStaticInitCode.push_back(str); }
void Klass::addSubKlass | ( | Klass * | son | ) | [inline] |
Definition at line 130 of file klass.hh.
References fSubClassList.
Referenced by ScalarCompiler::generateSigGen(), and ScalarCompiler::generateStaticSigGen().
00130 { fSubClassList.push_back(son); }
void Klass::addUICode | ( | const string & | str | ) | [inline] |
Definition at line 140 of file klass.hh.
References fUICode.
Referenced by Compiler::generateUserInterfaceTree(), and Compiler::generateWidgetCode().
00140 { fUICode.push_back(str); }
void Klass::addUIMacro | ( | const string & | str | ) | [inline] |
Definition at line 142 of file klass.hh.
References fUIMacro.
Referenced by Compiler::generateWidgetMacro().
00142 { fUIMacro.push_back(str); }
void Klass::addZone1 | ( | const string & | str | ) | [inline] |
Definition at line 151 of file klass.hh.
References fZone1Code.
Referenced by dlineLoop(), ScalarCompiler::generateSelect2(), ScalarCompiler::generateSelect3(), and vectorLoop().
00151 { fZone1Code.push_back(str); }
void Klass::addZone2 | ( | const string & | str | ) | [inline] |
Definition at line 152 of file klass.hh.
References fZone2Code.
Referenced by dlineLoop(), ScalarCompiler::generateHBargraph(), ScalarCompiler::generateVariableStore(), and ScalarCompiler::generateVBargraph().
00152 { fZone2Code.push_back(str); }
void Klass::addZone2b | ( | const string & | str | ) | [inline] |
Definition at line 153 of file klass.hh.
References fZone2bCode.
Referenced by ScalarCompiler::generateSelect2(), and ScalarCompiler::generateSelect3().
00153 { fZone2bCode.push_back(str); }
void Klass::addZone2c | ( | const string & | str | ) | [inline] |
Definition at line 154 of file klass.hh.
References fZone2cCode.
Referenced by buildTasksList().
00154 { fZone2cCode.push_back(str); }
void Klass::addZone3 | ( | const string & | str | ) | [inline] |
Definition at line 155 of file klass.hh.
References fZone3Code.
Referenced by buildTasksList(), VectorCompiler::compileMultiSignal(), and ScalarCompiler::compileMultiSignal().
00155 { fZone3Code.push_back(str); }
void Klass::buildTasksList | ( | ) |
Definition at line 285 of file klass.cpp.
References addDeclCode(), addInitCode(), addZone2c(), addZone3(), computeUseCount(), Loop::fIndex, fTopLoop, gGroupTaskSwitch, groupSeqLoops(), gTaskCount, LAST_TASK_INDEX, sortGraph(), START_TASK_INDEX, START_TASK_MAX, subst(), and T().
Referenced by VectorCompiler::compileMultiSignal().
00286 { 00287 lgraph G; 00288 00289 if (gGroupTaskSwitch) { 00290 computeUseCount(fTopLoop); 00291 groupSeqLoops(fTopLoop); 00292 } 00293 00294 sortGraph(fTopLoop, G); 00295 int index_task = START_TASK_INDEX; 00296 00297 addDeclCode("TaskGraph fGraph;"); 00298 addDeclCode("FAUSTFLOAT** input;"); 00299 addDeclCode("FAUSTFLOAT** output;"); 00300 addDeclCode("volatile bool fIsFinished;"); 00301 addDeclCode("int fFullCount;"); 00302 addDeclCode("int fIndex;"); 00303 addDeclCode("DSPThreadPool fThreadPool;"); 00304 addDeclCode("int fStaticNumThreads;"); 00305 addDeclCode("int fDynamicNumThreads;"); 00306 00307 // Compute forward dependencies 00308 for (int l=G.size()-1; l>=0; l--) { 00309 for (lset::const_iterator p =G[l].begin(); p!=G[l].end(); p++) { 00310 for (lset::const_iterator p1 = (*p)->fBackwardLoopDependencies.begin(); p1!=(*p)->fBackwardLoopDependencies.end(); p1++) { 00311 (*p1)->fForwardLoopDependencies.insert((*p)); 00312 } 00313 (*p)->fIndex = index_task; 00314 index_task++; 00315 } 00316 } 00317 00318 // Compute ready tasks list 00319 vector<int> task_num; 00320 for (int l=G.size()-1; l>=0; l--) { 00321 lset::const_iterator next; 00322 for (lset::const_iterator p =G[l].begin(); p!=G[l].end(); p++) { 00323 if ((*p)->fBackwardLoopDependencies.size() == 0) { 00324 task_num.push_back((*p)->fIndex); 00325 } 00326 } 00327 } 00328 00329 if (task_num.size() < START_TASK_MAX) { 00330 00331 // Push ready tasks thread 0, execute one task directly 00332 00333 addZone3("if (cur_thread == 0) {"); 00334 00335 Loop* keep = NULL; 00336 for (int l=G.size()-1; l>=0; l--) { 00337 lset::const_iterator next; 00338 for (lset::const_iterator p =G[l].begin(); p!=G[l].end(); p++) { 00339 if ((*p)->fBackwardLoopDependencies.size() == 0) { 00340 if (keep == NULL) { 00341 keep = *p; 00342 } else { 00343 addZone3(subst(" taskqueue.PushHead($0);", T((*p)->fIndex))); 00344 } 00345 } 00346 } 00347 } 00348 00349 if (keep != NULL) { 00350 addZone3(subst(" tasknum = $0;", T(keep->fIndex))); 00351 } 00352 00353 addZone3("} else {"); 00354 addZone3(" tasknum = TaskQueue::GetNextTask(cur_thread);"); 00355 addZone3("}"); 00356 00357 } else { 00358 00359 // Cut ready tasks list and have each thread (dynamically) use a subpart 00360 addZone3(subst("int task_list_size = $0;", T((int)task_num.size()))); 00361 stringstream buf; 00362 buf << "int task_list[" << task_num.size() << "] = {"; 00363 for(size_t i = 0; i < task_num.size(); i++) { 00364 buf << task_num[i]; 00365 if (i != (task_num.size() - 1)) 00366 buf << ","; 00367 } 00368 buf << "};"; 00369 00370 addZone3(buf.str()); 00371 addZone3("taskqueue.InitTaskList(task_list_size, task_list, fDynamicNumThreads, cur_thread, tasknum);"); 00372 } 00373 00374 // Last stage connected to end task 00375 addZone2c("// Initialize end task"); 00376 addZone2c(subst("fGraph.InitTask($0,$1);", T(LAST_TASK_INDEX), T((int)G[0].size()))); 00377 00378 // Compute init section 00379 addZone2c("// Only initialize tasks with inputs"); 00380 for (int l=G.size()-1; l>=0; l--) { 00381 for (lset::const_iterator p =G[l].begin(); p!=G[l].end(); p++) { 00382 if ((*p)->fBackwardLoopDependencies.size() > 0) { // Only itialize taks with inputs 00383 addZone2c(subst("fGraph.InitTask($0,$1);", T(START_TASK_INDEX + gTaskCount++), T((int)(*p)->fBackwardLoopDependencies.size()))); 00384 } else { 00385 gTaskCount++; 00386 } 00387 } 00388 } 00389 00390 addInitCode("fStaticNumThreads = get_max_cpu();"); 00391 addInitCode("fDynamicNumThreads = getenv(\"OMP_NUM_THREADS\") ? atoi(getenv(\"OMP_NUM_THREADS\")) : fStaticNumThreads;"); 00392 addInitCode("fThreadPool.StartAll(fStaticNumThreads - 1, false, this);"); 00393 00394 gTaskCount = 0; 00395 }
void Klass::closeLoop | ( | Tree | sig = 0 |
) |
Close the top loop and either keep it or absorb it within its enclosing loop.
Definition at line 109 of file klass.cpp.
References Loop::absorb(), Loop::fBackwardLoopDependencies, Loop::fEnclosingLoop, fTopLoop, Loop::hasRecDependencies(), Loop::isEmpty(), and setLoopProperty().
Referenced by VectorCompiler::compileMultiSignal(), and VectorCompiler::generateCode().
00110 { 00111 assert(fTopLoop); 00112 Loop* l = fTopLoop; 00113 fTopLoop = l->fEnclosingLoop; 00114 assert(fTopLoop); 00115 //cerr << "close loop :" << l << endl; 00116 00117 if (l->isEmpty() || l->hasRecDependencies()) { 00118 // empty or dependent loop -> absorbed by enclosing one 00119 fTopLoop->absorb(l); 00120 delete l; 00121 } else { 00122 // we have an independent loop 00123 if (sig) setLoopProperty(sig,l); // associate the signal 00124 fTopLoop->fBackwardLoopDependencies.insert(l); 00125 } 00126 }
void Klass::collectIncludeFile | ( | set< string > & | S | ) |
Definition at line 1111 of file klass.cpp.
References fIncludeFileSet, fSubClassList, and merge().
Referenced by printIncludeFile().
01112 { 01113 list<Klass* >::iterator k; 01114 01115 for (k = fSubClassList.begin(); k != fSubClassList.end(); k++) (*k)->collectIncludeFile(S); 01116 merge(S, fIncludeFileSet); 01117 }
void Klass::collectLibrary | ( | set< string > & | S | ) |
Definition at line 1119 of file klass.cpp.
References fLibrarySet, fSubClassList, and merge().
Referenced by printLibrary().
01120 { 01121 list<Klass* >::iterator k; 01122 01123 for (k = fSubClassList.begin(); k != fSubClassList.end(); k++) (*k)->collectLibrary(S); 01124 merge(S, fLibrarySet); 01125 }
Returns the loop used to compute a signal.
Definition at line 80 of file klass.cpp.
References fLoopProperty.
Referenced by VectorCompiler::CS().
00081 { 00082 return fLoopProperty.get(sig, l); 00083 }
void Klass::incUIActiveCount | ( | ) | [inline] |
Definition at line 144 of file klass.hh.
References fNumActives.
Referenced by Compiler::generateWidgetCode().
00144 { fNumActives++; }
void Klass::incUIPassiveCount | ( | ) | [inline] |
Definition at line 145 of file klass.hh.
References fNumPassives.
Referenced by Compiler::generateWidgetCode().
00145 { fNumPassives++; }
int Klass::inputs | ( | ) | [inline] |
Definition at line 190 of file klass.hh.
References fNumInputs.
Referenced by VectorCompiler::compileMultiSignal(), ScalarCompiler::compileMultiSignal(), and main().
00190 { return fNumInputs; }
void Klass::openLoop | ( | Tree | recsymbol, | |
const string & | size | |||
) |
void Klass::openLoop | ( | const string & | size | ) |
Open a non-recursive loop on top of the stack of open loops.
size | the number of iterations of the loop |
Definition at line 89 of file klass.cpp.
References fTopLoop.
Referenced by VectorCompiler::compileMultiSignal(), and VectorCompiler::generateCode().
int Klass::outputs | ( | ) | [inline] |
Definition at line 191 of file klass.hh.
References fNumOutputs.
Referenced by VectorCompiler::compileMultiSignal(), ScalarCompiler::compileMultiSignal(), and main().
00191 { return fNumOutputs; }
void Klass::printComputeMethod | ( | int | n, | |
ostream & | fout | |||
) | [virtual] |
Print Compute() method according to the various switch.
Definition at line 727 of file klass.cpp.
References gOpenMPSwitch, gSchedulerSwitch, gVectorLoopVariant, gVectorSwitch, printComputeMethodOpenMP(), printComputeMethodScalar(), printComputeMethodScheduler(), printComputeMethodVectorFaster(), and printComputeMethodVectorSimple().
Referenced by println().
00728 { 00729 if (gSchedulerSwitch) { 00730 printComputeMethodScheduler (n, fout); 00731 } else if (gOpenMPSwitch) { 00732 printComputeMethodOpenMP (n, fout); 00733 } else if (gVectorSwitch) { 00734 switch (gVectorLoopVariant) { 00735 case 0 : printComputeMethodVectorFaster(n, fout); break; 00736 case 1 : printComputeMethodVectorSimple(n, fout); break; 00737 default : cerr << "unknown loop variant " << gVectorLoopVariant << endl; exit(1); 00738 } 00739 } else { 00740 printComputeMethodScalar(n, fout); 00741 } 00742 }
void Klass::printComputeMethodOpenMP | ( | int | n, | |
ostream & | fout | |||
) | [virtual] |
Definition at line 860 of file klass.cpp.
References fFirstPrivateDecl, fZone1Code, fZone2bCode, fZone2Code, fZone3Code, gVecSize, printdecllist(), printlines(), printLoopGraphOpenMP(), subst(), tab(), and xfloat().
Referenced by printComputeMethod().
00861 { 00862 // in openMP mode we need to split loops in smaller pieces not larger 00863 // than gVecSize and add OpenMP pragmas 00864 tab(n+1,fout); fout << subst("virtual void compute (int fullcount, $0** input, $0** output) {", xfloat()); 00865 printlines(n+2, fZone1Code, fout); 00866 printlines(n+2, fZone2Code, fout); 00867 tab(n+2,fout); fout << "#pragma omp parallel"; 00868 printdecllist(n+3, "firstprivate", fFirstPrivateDecl, fout); 00869 00870 tab(n+2,fout); fout << "{"; 00871 if (!fZone2bCode.empty()) { 00872 tab(n+3,fout); fout << "#pragma omp single"; 00873 tab(n+3,fout); fout << "{"; 00874 printlines(n+4, fZone2bCode, fout); 00875 tab(n+3,fout); fout << "}"; 00876 } 00877 00878 tab(n+3,fout); fout << "for (int index = 0; index < fullcount; index += " << gVecSize << ") {"; 00879 tab(n+4,fout); fout << "int count = min ("<< gVecSize << ", fullcount-index);"; 00880 00881 printlines (n+4, fZone3Code, fout); 00882 printLoopGraphOpenMP (n+4,fout); 00883 00884 tab(n+3,fout); fout << "}"; 00885 00886 tab(n+2,fout); fout << "}"; 00887 tab(n+1,fout); fout << "}"; 00888 }
void Klass::printComputeMethodScalar | ( | int | n, | |
ostream & | fout | |||
) | [virtual] |
Definition at line 744 of file klass.cpp.
References fZone1Code, fZone2bCode, fZone2Code, fZone3Code, printlines(), printLoopGraphScalar(), subst(), tab(), and xfloat().
Referenced by printComputeMethod().
00745 { 00746 tab(n+1,fout); fout << subst("virtual void compute (int count, $0** input, $0** output) {", xfloat()); 00747 printlines (n+2, fZone1Code, fout); 00748 printlines (n+2, fZone2Code, fout); 00749 printlines (n+2, fZone2bCode, fout); 00750 printlines (n+2, fZone3Code, fout); 00751 printLoopGraphScalar (n+2,fout); 00752 tab(n+1,fout); fout << "}"; 00753 }
void Klass::printComputeMethodScheduler | ( | int | n, | |
ostream & | fout | |||
) | [virtual] |
Definition at line 959 of file klass.cpp.
References fZone1Code, fZone2cCode, fZone2Code, fZone3Code, gTaskCount, gVecSize, printlines(), printLoopGraphScheduler(), START_TASK_INDEX, subst(), tab(), and xfloat().
Referenced by printComputeMethod().
00960 { 00961 tab(n+1,fout); fout << subst("virtual void compute (int fullcount, $0** input, $0** output) {", xfloat()); 00962 00963 tab(n+2,fout); fout << "GetRealTime();"; 00964 00965 tab(n+2,fout); fout << "this->input = input;"; 00966 tab(n+2,fout); fout << "this->output = output;"; 00967 00968 tab(n+2,fout); fout << "StartMeasure();"; 00969 00970 tab(n+2,fout); fout << "for (fIndex = 0; fIndex < fullcount; fIndex += " << gVecSize << ") {"; 00971 00972 tab(n+3,fout); fout << "fFullCount = min ("<< gVecSize << ", fullcount-fIndex);"; 00973 tab(n+3,fout); fout << "TaskQueue::Init();"; 00974 printlines (n+3, fZone2cCode, fout); 00975 00976 tab(n+3,fout); fout << "fIsFinished = false;"; 00977 tab(n+3,fout); fout << "fThreadPool.SignalAll(fDynamicNumThreads - 1);"; 00978 tab(n+3,fout); fout << "computeThread(0);"; 00979 tab(n+3,fout); fout << "while (!fThreadPool.IsFinished()) {}"; 00980 00981 tab(n+2,fout); fout << "}"; 00982 00983 tab(n+2,fout); fout << "StopMeasure(fStaticNumThreads, fDynamicNumThreads);"; 00984 00985 tab(n+1,fout); fout << "}"; 00986 00987 tab(n+1,fout); fout << "void computeThread(int cur_thread) {"; 00988 printlines (n+2, fZone1Code, fout); 00989 printlines (n+2, fZone2Code, fout); 00990 00991 tab(n+2,fout); fout << "// Init graph state"; 00992 00993 tab(n+2,fout); fout << "{"; 00994 tab(n+3,fout); fout << "TaskQueue taskqueue;"; 00995 tab(n+3,fout); fout << "int tasknum = -1;"; 00996 tab(n+3,fout); fout << "int count = fFullCount;"; 00997 00998 // Init input and output 00999 tab(n+3,fout); fout << "// Init input and output"; 01000 printlines (n+3, fZone3Code, fout); 01001 01002 tab(n+3,fout); fout << "while (!fIsFinished) {"; 01003 tab(n+4,fout); fout << "switch (tasknum) {"; 01004 01005 // Work stealing task 01006 tab(n+5, fout); fout << "case WORK_STEALING_INDEX: { "; 01007 tab(n+6, fout); fout << "tasknum = TaskQueue::GetNextTask(cur_thread);"; 01008 tab(n+6, fout); fout << "break;"; 01009 tab(n+5, fout); fout << "} "; 01010 01011 // End task 01012 tab(n+5, fout); fout << "case LAST_TASK_INDEX: { "; 01013 tab(n+6, fout); fout << "fIsFinished = true;"; 01014 tab(n+6, fout); fout << "break;"; 01015 tab(n+5, fout); fout << "} "; 01016 01017 gTaskCount = START_TASK_INDEX ; 01018 01019 // DSP tasks 01020 printLoopGraphScheduler (n+5,fout); 01021 01022 tab(n+4,fout); fout << "}"; 01023 tab(n+3,fout); fout << "}"; 01024 tab(n+2,fout); fout << "}"; 01025 tab(n+1,fout); fout << "}"; 01026 }
void Klass::printComputeMethodVectorFaster | ( | int | n, | |
ostream & | fout | |||
) | [virtual] |
Uses loops of constant gVecSize boundary in order to provide the C compiler with more optimisation opportunities.
Improves performances in general, but not always
Definition at line 760 of file klass.cpp.
References fZone1Code, fZone2bCode, fZone2Code, fZone3Code, gVecSize, printlines(), printLoopGraphVector(), subst(), tab(), and xfloat().
Referenced by printComputeMethod().
00761 { 00762 // in vector mode we need to split loops in smaller pieces not larger 00763 // than gVecSize 00764 tab(n+1,fout); fout << subst("virtual void compute (int fullcount, $0** input, $0** output) {", xfloat()); 00765 printlines(n+2, fZone1Code, fout); 00766 printlines(n+2, fZone2Code, fout); 00767 printlines(n+2, fZone2bCode, fout); 00768 00769 tab(n+2,fout); fout << "int index;"; 00770 tab(n+2,fout); fout << "for (index = 0; index <= fullcount - " << gVecSize << "; index += " << gVecSize << ") {"; 00771 tab(n+3,fout); fout << "// compute by blocks of " << gVecSize << " samples"; 00772 tab(n+3,fout); fout << "const int count = " << gVecSize << ";"; 00773 printlines (n+3, fZone3Code, fout); 00774 printLoopGraphVector(n+3,fout); 00775 tab(n+2,fout); fout << "}"; 00776 00777 tab(n+2,fout); fout << "if (index < fullcount) {"; 00778 tab(n+3,fout); fout << "// compute the remaining samples if any"; 00779 tab(n+3,fout); fout << "int count = fullcount-index;"; 00780 printlines (n+3, fZone3Code, fout); 00781 printLoopGraphVector(n+3,fout); 00782 tab(n+2,fout); fout << "}"; 00783 tab(n+1,fout); fout << "}"; 00784 }
void Klass::printComputeMethodVectorSimple | ( | int | n, | |
ostream & | fout | |||
) | [virtual] |
Simple loop layout, generally less efficient than printComputeMethodVectorFaster.
Definition at line 789 of file klass.cpp.
References fZone1Code, fZone2bCode, fZone2Code, fZone3Code, gVecSize, printlines(), printLoopGraphVector(), subst(), tab(), and xfloat().
Referenced by printComputeMethod().
00790 { 00791 // in vector mode we need to split loops in smaller pieces not larger 00792 // than gVecSize 00793 tab(n+1,fout); fout << subst("virtual void compute (int fullcount, $0** input, $0** output) {", xfloat()); 00794 printlines(n+2, fZone1Code, fout); 00795 printlines(n+2, fZone2Code, fout); 00796 printlines(n+2, fZone2bCode, fout); 00797 tab(n+2,fout); fout << "for (int index = 0; index < fullcount; index += " << gVecSize << ") {"; 00798 tab(n+3,fout); fout << "int count = min("<< gVecSize << ", fullcount-index);"; 00799 printlines (n+3, fZone3Code, fout); 00800 printLoopGraphVector(n+3,fout); 00801 tab(n+2,fout); fout << "}"; 00802 tab(n+1,fout); fout << "}"; 00803 }
void Klass::printIncludeFile | ( | ostream & | fout | ) | [virtual] |
Print the required include files.
Definition at line 177 of file klass.cpp.
References collectIncludeFile(), and gOpenMPSwitch.
Referenced by main().
00178 { 00179 set<string> S; 00180 set<string>::iterator f; 00181 00182 if (gOpenMPSwitch) { 00183 fout << "#include <omp.h>" << "\n"; 00184 } 00185 00186 collectIncludeFile(S); 00187 for (f = S.begin(); f != S.end(); f++) { 00188 fout << "#include " << *f << "\n"; 00189 } 00190 }
void Klass::printLastLoopLevelScheduler | ( | int | n, | |
int | lnum, | |||
const lset & | L, | |||
ostream & | fout | |||
) | [virtual] |
Print the 'level' of the loop graph as a set of parallel loops.
Definition at line 546 of file klass.cpp.
References gTaskCount, nonRecursiveLevel(), and tab().
Referenced by printLoopGraphScheduler().
00547 { 00548 if (nonRecursiveLevel(L) && L.size() == 1 && !(*L.begin())->isEmpty()) { 00549 00550 lset::const_iterator p =L.begin(); 00551 tab(n, fout); fout << "case " << gTaskCount++ << ": { "; 00552 (*p)->println(n+1, fout); 00553 tab(n+1, fout); fout << "tasknum = LAST_TASK_INDEX;"; 00554 tab(n+1, fout); fout << "break;"; 00555 tab(n, fout); fout << "} "; 00556 00557 } else if (L.size() > 1) { 00558 00559 for (lset::const_iterator p =L.begin(); p!=L.end(); p++) { 00560 tab(n, fout); fout << "case " << gTaskCount++ << ": { "; 00561 (*p)->println(n+1, fout); 00562 tab(n+1, fout); fout << "fGraph.ActivateOneOutputTask(taskqueue, LAST_TASK_INDEX, tasknum);"; 00563 tab(n+1, fout); fout << "break;"; 00564 tab(n, fout); fout << "} "; 00565 } 00566 00567 } else if (L.size() == 1 && !(*L.begin())->isEmpty()) { 00568 00569 lset::const_iterator p =L.begin(); 00570 tab(n, fout); fout << "case " << gTaskCount++ << ": { "; 00571 (*p)->println(n+1, fout); 00572 tab(n+1, fout); fout << "tasknum = LAST_TASK_INDEX;"; 00573 tab(n+1, fout); fout << "break;"; 00574 tab(n, fout); fout << "} "; 00575 00576 } 00577 }
void Klass::printLibrary | ( | ostream & | fout | ) | [virtual] |
Print the required C++ libraries as comments in source code.
Definition at line 160 of file klass.cpp.
References collectLibrary().
Referenced by main().
00161 { 00162 set<string> S; 00163 set<string>::iterator f; 00164 00165 string sep; 00166 collectLibrary(S); 00167 fout << "/* link with "; 00168 for (f = S.begin(), sep =": "; f != S.end(); f++, sep = ", ") { 00169 fout << sep << *f; 00170 } 00171 fout << " */\n"; 00172 }
void Klass::println | ( | int | n, | |
ostream & | fout | |||
) | [virtual] |
Print a full C++ class corresponding to a Faust dsp.
Reimplemented in SigIntGenKlass, and SigFloatGenKlass.
Definition at line 655 of file klass.cpp.
References fDeclCode, fInitCode, fKlassName, fNumActives, fNumInputs, fNumOutputs, fNumPassives, fStaticFields, fStaticInitCode, fSubClassList, fSuperKlassName, fUICode, fUIMacro, gMetaDataSet, gSchedulerSwitch, gUIMacroSwitch, printComputeMethod(), printlines(), printMetadata(), and tab().
Referenced by main().
00656 { 00657 list<Klass* >::iterator k; 00658 00659 if (gSchedulerSwitch) { 00660 tab(n,fout); fout << "class " << fKlassName << " : public " << fSuperKlassName << ", public Runnable {"; 00661 } else { 00662 tab(n,fout); fout << "class " << fKlassName << " : public " << fSuperKlassName << "{"; 00663 } 00664 00665 if (gUIMacroSwitch) { 00666 tab(n,fout); fout << " public:"; 00667 } else { 00668 tab(n,fout); fout << " private:"; 00669 } 00670 00671 for (k = fSubClassList.begin(); k != fSubClassList.end(); k++) (*k)->println(n+1, fout); 00672 00673 printlines(n+1, fDeclCode, fout); 00674 00675 tab(n,fout); fout << " public:"; 00676 00677 printMetadata(n+1, gMetaDataSet, fout); 00678 tab(n+1,fout); fout << "virtual int getNumInputs() \t{ " 00679 << "return " << fNumInputs 00680 << "; }"; 00681 tab(n+1,fout); fout << "virtual int getNumOutputs() \t{ " 00682 << "return " << fNumOutputs 00683 << "; }"; 00684 00685 tab(n+1,fout); fout << "static void classInit(int samplingFreq) {"; 00686 printlines (n+2, fStaticInitCode, fout); 00687 tab(n+1,fout); fout << "}"; 00688 00689 tab(n+1,fout); fout << "virtual void instanceInit(int samplingFreq) {"; 00690 tab(n+2,fout); fout << "fSamplingFreq = samplingFreq;"; 00691 printlines (n+2, fInitCode, fout); 00692 tab(n+1,fout); fout << "}"; 00693 00694 tab(n+1,fout); fout << "virtual void init(int samplingFreq) {"; 00695 tab(n+2,fout); fout << "classInit(samplingFreq);"; 00696 tab(n+2,fout); fout << "instanceInit(samplingFreq);"; 00697 tab(n+1,fout); fout << "}"; 00698 00699 00700 tab(n+1,fout); fout << "virtual void buildUserInterface(UI* interface) {"; 00701 printlines (n+2, fUICode, fout); 00702 tab(n+1,fout); fout << "}"; 00703 00704 printComputeMethod(n, fout); 00705 00706 tab(n,fout); fout << "};\n" << endl; 00707 00708 printlines(n, fStaticFields, fout); 00709 00710 // generate user interface macros if needed 00711 if (gUIMacroSwitch) { 00712 tab(n, fout); fout << "#ifdef FAUST_UIMACROS"; 00713 tab(n+1,fout); fout << "#define FAUST_INPUTS " << fNumInputs; 00714 tab(n+1,fout); fout << "#define FAUST_OUTPUTS " << fNumOutputs; 00715 tab(n+1,fout); fout << "#define FAUST_ACTIVES " << fNumActives; 00716 tab(n+1,fout); fout << "#define FAUST_PASSIVES " << fNumPassives; 00717 printlines(n+1, fUIMacro, fout); 00718 tab(n, fout); fout << "#endif"; 00719 } 00720 00721 fout << endl; 00722 }
void Klass::printLoopDeepFirst | ( | int | n, | |
ostream & | fout, | |||
Loop * | l, | |||
set< Loop * > & | visited | |||
) | [virtual] |
Print a loop graph deep first.
Definition at line 224 of file klass.cpp.
References Loop::fBackwardLoopDependencies, Loop::fOrder, isElement(), Loop::println(), and tab().
Referenced by printLoopGraphVector().
00225 { 00226 // avoid printing already printed loops 00227 if (isElement(visited, l)) return; 00228 00229 // remember we have printed this loop 00230 visited.insert(l); 00231 00232 // print the dependencies loops (that need to be computed before this one) 00233 for (lset::const_iterator p =l->fBackwardLoopDependencies.begin(); p!=l->fBackwardLoopDependencies.end(); p++) { 00234 printLoopDeepFirst(n, fout, *p, visited); 00235 } 00236 // the print the loop itself 00237 tab(n, fout); 00238 tab(n, fout); fout << "// LOOP " << l << ", ORDER " << l->fOrder << endl; 00239 l->println(n+1, fout); 00240 }
void Klass::printLoopGraphInternal | ( | int | n, | |
ostream & | fout | |||
) | [virtual] |
Print the loop graph (used for internals classes).
Definition at line 473 of file klass.cpp.
References fTopLoop, gVectorSwitch, sortGraph(), and tab().
Referenced by SigFloatGenKlass::println(), and SigIntGenKlass::println().
00474 { 00475 lgraph G; 00476 sortGraph(fTopLoop, G); 00477 00478 // normal mode 00479 for (int l=G.size()-1; l>=0; l--) { 00480 if (gVectorSwitch) { tab(n, fout); fout << "// SECTION : " << G.size() - l; } 00481 for (lset::const_iterator p =G[l].begin(); p!=G[l].end(); p++) { 00482 (*p)->printoneln(n, fout); 00483 } 00484 } 00485 }
void Klass::printLoopGraphOpenMP | ( | int | n, | |
ostream & | fout | |||
) | [virtual] |
Print the loop graph as a serie of parallel loops.
Definition at line 431 of file klass.cpp.
References computeUseCount(), fTopLoop, gGroupTaskSwitch, groupSeqLoops(), printLoopLevelOpenMP(), sortGraph(), and tab().
Referenced by printComputeMethodOpenMP().
00432 { 00433 if (gGroupTaskSwitch) { 00434 computeUseCount(fTopLoop); 00435 groupSeqLoops(fTopLoop); 00436 } 00437 00438 lgraph G; 00439 sortGraph(fTopLoop, G); 00440 00441 // OpenMP mode : add OpenMP directives 00442 for (int l=G.size()-1; l>=0; l--) { 00443 tab(n, fout); fout << "// SECTION : " << G.size() - l; 00444 printLoopLevelOpenMP(n, G.size() - l, G[l], fout); 00445 } 00446 }
void Klass::printLoopGraphScalar | ( | int | n, | |
ostream & | fout | |||
) | [virtual] |
Definition at line 490 of file klass.cpp.
References fTopLoop, and Loop::printoneln().
Referenced by printComputeMethodScalar().
00491 { 00492 fTopLoop->printoneln(n, fout); 00493 }
void Klass::printLoopGraphScheduler | ( | int | n, | |
ostream & | fout | |||
) | [virtual] |
Print the loop graph as a serie of parallel loops.
Definition at line 451 of file klass.cpp.
References computeUseCount(), fTopLoop, gGroupTaskSwitch, groupSeqLoops(), printLastLoopLevelScheduler(), printLoopLevelScheduler(), sortGraph(), and tab().
Referenced by printComputeMethodScheduler().
00452 { 00453 if (gGroupTaskSwitch) { 00454 computeUseCount(fTopLoop); 00455 groupSeqLoops(fTopLoop); 00456 } 00457 00458 lgraph G; 00459 sortGraph(fTopLoop, G); 00460 00461 // OpenMP mode : add OpenMP directives 00462 for (int l=G.size()-1; l>0; l--) { 00463 tab(n, fout); fout << "// SECTION : " << G.size() - l; 00464 printLoopLevelScheduler(n, G.size() - l, G[l], fout); 00465 } 00466 00467 printLastLoopLevelScheduler(n, G.size(), G[0], fout); 00468 }
void Klass::printLoopGraphVector | ( | int | n, | |
ostream & | fout | |||
) | [virtual] |
Print the loop graph (used for vector code).
Definition at line 400 of file klass.cpp.
References computeUseCount(), fTopLoop, gDeepFirstSwitch, gGroupTaskSwitch, groupSeqLoops(), gVectorSwitch, printLoopDeepFirst(), sortGraph(), and tab().
Referenced by printComputeMethodVectorFaster(), and printComputeMethodVectorSimple().
00401 { 00402 if (gGroupTaskSwitch) { 00403 computeUseCount(fTopLoop); 00404 groupSeqLoops(fTopLoop); 00405 } 00406 00407 lgraph G; 00408 sortGraph(fTopLoop, G); 00409 00410 #if 1 00411 // EXPERIMENTAL 00412 if (gVectorSwitch && gDeepFirstSwitch) { 00413 set<Loop*> visited; 00414 printLoopDeepFirst(n, fout, fTopLoop, visited); 00415 return; 00416 } 00417 #endif 00418 00419 // normal mode 00420 for (int l=G.size()-1; l>=0; l--) { 00421 if (gVectorSwitch) { tab(n, fout); fout << "// SECTION : " << G.size() - l; } 00422 for (lset::const_iterator p =G[l].begin(); p!=G[l].end(); p++) { 00423 (*p)->println(n, fout); 00424 } 00425 } 00426 }
void Klass::printLoopLevelOpenMP | ( | int | n, | |
int | lnum, | |||
const lset & | L, | |||
ostream & | fout | |||
) | [virtual] |
Print the 'level' of the loop graph as a set of parallel loops.
Definition at line 510 of file klass.cpp.
References nonRecursiveLevel(), and tab().
Referenced by printLoopGraphOpenMP().
00511 { 00512 if (nonRecursiveLevel(L) && L.size()==1) { 00513 for (lset::const_iterator p =L.begin(); p!=L.end(); p++) { 00514 if ((*p)->isEmpty() == false) { 00515 tab(n, fout); fout << "#pragma omp single "; 00516 tab(n, fout); fout << "{ "; 00517 (*p)->println(n+1, fout); 00518 tab(n, fout); fout << "} "; 00519 } 00520 } 00521 00522 } else if (L.size() > 1) { 00523 tab(n, fout); fout << "#pragma omp sections "; 00524 tab(n, fout); fout << "{ "; 00525 for (lset::const_iterator p =L.begin(); p!=L.end(); p++) { 00526 tab(n+1, fout); fout << "#pragma omp section "; 00527 tab(n+1, fout); fout << "{"; 00528 (*p)->println(n+2, fout); 00529 tab(n+1, fout); fout << "} "; 00530 } 00531 tab(n, fout); fout << "} "; 00532 } else if (L.size() == 1 && !(*L.begin())->isEmpty()) { 00533 tab(n, fout); fout << "#pragma omp single "; 00534 tab(n, fout); fout << "{ "; 00535 for (lset::const_iterator p =L.begin(); p!=L.end(); p++) { 00536 (*p)->println(n+1, fout); 00537 } 00538 tab(n, fout); fout << "} "; 00539 } 00540 }
void Klass::printLoopLevelScheduler | ( | int | n, | |
int | lnum, | |||
const lset & | L, | |||
ostream & | fout | |||
) | [virtual] |
Print the 'level' of the loop graph as a set of parallel loops.
Definition at line 639 of file klass.cpp.
References nonRecursiveLevel(), and printOneLoopScheduler().
Referenced by printLoopGraphScheduler().
00640 { 00641 if (nonRecursiveLevel(L) && L.size() == 1 && !(*L.begin())->isEmpty()) { 00642 printOneLoopScheduler(L.begin(), n, fout); 00643 } else if (L.size() > 1) { 00644 for (lset::const_iterator p = L.begin(); p != L.end(); p++) { 00645 printOneLoopScheduler(p, n, fout); 00646 } 00647 } else if (L.size() == 1 && !(*L.begin())->isEmpty()) { 00648 printOneLoopScheduler(L.begin(), n, fout); 00649 } 00650 }
Print metadata declaration.
Definition at line 195 of file klass.cpp.
References gMetaDataSet, tab(), and tree().
Referenced by println().
00196 { 00197 tab(n,fout); fout << "static void metadata(Meta* m) \t{ "; 00198 00199 for (map<Tree, set<Tree> >::iterator i = gMetaDataSet.begin(); i != gMetaDataSet.end(); i++) { 00200 if (i->first != tree("author")) { 00201 tab(n+1,fout); fout << "m->declare(\"" << *(i->first) << "\", " << **(i->second.begin()) << ");"; 00202 } else { 00203 for (set<Tree>::iterator j = i->second.begin(); j != i->second.end(); j++) { 00204 if (j == i->second.begin()) { 00205 tab(n+1,fout); fout << "m->declare(\"" << *(i->first) << "\", " << **j << ");" ; 00206 } else { 00207 tab(n+1,fout); fout << "m->declare(\"" << "contributor" << "\", " << **j << ");"; 00208 } 00209 } 00210 } 00211 } 00212 00213 tab(n,fout); fout << "}" << endl; 00214 }
void Klass::printOneLoopScheduler | ( | lset::const_iterator | p, | |
int | n, | |||
ostream & | fout | |||
) | [virtual] |
Definition at line 579 of file klass.cpp.
References Loop::fIndex, gTaskCount, subst(), T(), and tab().
Referenced by printLoopLevelScheduler().
00580 { 00581 tab(n, fout); fout << "case " << gTaskCount++ << ": { "; 00582 (*p)->println(n+1, fout); 00583 00584 // One output only 00585 if ((*p)->fForwardLoopDependencies.size() == 1) { 00586 00587 lset::const_iterator p1 = (*p)->fForwardLoopDependencies.begin(); 00588 if ((*p1)->fBackwardLoopDependencies.size () == 1) { 00589 tab(n+1, fout); fout << subst("tasknum = $0;", T((*p1)->fIndex)); 00590 } else { 00591 tab(n+1, fout); fout << subst("fGraph.ActivateOneOutputTask(taskqueue, $0, tasknum);", T((*p1)->fIndex)); 00592 } 00593 00594 } else { 00595 00596 Loop* keep = NULL; 00597 // Find one output with no backward dependencies 00598 for (lset::const_iterator p1 = (*p)->fForwardLoopDependencies.begin(); p1!=(*p)->fForwardLoopDependencies.end(); p1++) { 00599 if ((*p1)->fBackwardLoopDependencies.size () == 1) { 00600 keep = *p1; 00601 break; 00602 } 00603 } 00604 00605 if (keep == NULL) { 00606 tab(n+1, fout); fout << "tasknum = WORK_STEALING_INDEX;"; 00607 } 00608 00609 for (lset::const_iterator p1 = (*p)->fForwardLoopDependencies.begin(); p1!=(*p)->fForwardLoopDependencies.end(); p1++) { 00610 if ((*p1)->fBackwardLoopDependencies.size () == 1) { // Task is the only input 00611 if (*p1 != keep) { 00612 tab(n+1, fout); fout << subst("taskqueue.PushHead($0);", T((*p1)->fIndex)); 00613 } 00614 } else { 00615 if (keep == NULL) { 00616 tab(n+1, fout); fout << subst("fGraph.ActivateOutputTask(taskqueue, $0, tasknum);", T((*p1)->fIndex)); 00617 } else { 00618 tab(n+1, fout); fout << subst("fGraph.ActivateOutputTask(taskqueue, $0);", T((*p1)->fIndex)); 00619 } 00620 } 00621 } 00622 00623 if (keep != NULL) { 00624 tab(n+1, fout); fout << subst("tasknum = $0;", T(keep->fIndex)); // Last one 00625 } else { 00626 tab(n+1, fout); fout << "fGraph.GetReadyTask(taskqueue, tasknum);"; // Last one 00627 } 00628 } 00629 00630 tab(n+1, fout); fout << "break;"; 00631 tab(n, fout); fout << "} "; 00632 }
Store the loop used to compute a signal.
Definition at line 72 of file klass.cpp.
References fLoopProperty.
Referenced by closeLoop().
00073 { 00074 fLoopProperty.set(sig,l); 00075 }
Loop* Klass::topLoop | ( | ) | [inline] |
Definition at line 118 of file klass.hh.
References fTopLoop.
Referenced by VectorCompiler::CS(), and VectorCompiler::generateCode().
00118 { return fTopLoop; }
list<string> Klass::fDeclCode [protected] |
Definition at line 73 of file klass.hh.
Referenced by addDeclCode(), SigFloatGenKlass::println(), SigIntGenKlass::println(), and println().
list<string> Klass::fFirstPrivateDecl [protected] |
first private declarations
Definition at line 88 of file klass.hh.
Referenced by addFirstPrivateDecl(), and printComputeMethodOpenMP().
set<string> Klass::fIncludeFileSet [protected] |
Definition at line 68 of file klass.hh.
Referenced by addIncludeFile(), and collectIncludeFile().
list<string> Klass::fInitCode [protected] |
Definition at line 76 of file klass.hh.
Referenced by addInitCode(), SigFloatGenKlass::println(), and println().
string Klass::fKlassName [protected] |
Definition at line 60 of file klass.hh.
Referenced by SigFloatGenKlass::println(), SigIntGenKlass::println(), and println().
set<string> Klass::fLibrarySet [protected] |
Definition at line 69 of file klass.hh.
Referenced by addLibrary(), and collectLibrary().
property<Loop*> Klass::fLoopProperty [protected] |
loops used to compute some signals
Definition at line 97 of file klass.hh.
Referenced by getLoopProperty(), and setLoopProperty().
int Klass::fNumActives [protected] |
number of active controls in the UI (sliders, buttons, etc.)
Definition at line 64 of file klass.hh.
Referenced by incUIActiveCount(), and println().
int Klass::fNumInputs [protected] |
Definition at line 62 of file klass.hh.
Referenced by inputs(), SigFloatGenKlass::println(), SigIntGenKlass::println(), and println().
int Klass::fNumOutputs [protected] |
Definition at line 63 of file klass.hh.
Referenced by outputs(), SigFloatGenKlass::println(), SigIntGenKlass::println(), and println().
int Klass::fNumPassives [protected] |
number of passive widgets in the UI (bargraphs, etc.)
Definition at line 65 of file klass.hh.
Referenced by incUIPassiveCount(), and println().
list<string> Klass::fSharedDecl [protected] |
list<string> Klass::fStaticFields [protected] |
static fields after class
Definition at line 75 of file klass.hh.
Referenced by addStaticFields(), and println().
list<string> Klass::fStaticInitCode [protected] |
static init code for class constant tables
Definition at line 74 of file klass.hh.
Referenced by addStaticInitCode(), and println().
list<Klass* > Klass::fSubClassList [protected] |
Definition at line 71 of file klass.hh.
Referenced by addSubKlass(), collectIncludeFile(), collectLibrary(), SigFloatGenKlass::println(), SigIntGenKlass::println(), and println().
string Klass::fSuperKlassName [protected] |
Loop* Klass::fTopLoop [protected] |
active loops currently open
Definition at line 96 of file klass.hh.
Referenced by addExecCode(), addPostCode(), addPreCode(), buildTasksList(), closeLoop(), openLoop(), printLoopGraphInternal(), printLoopGraphOpenMP(), printLoopGraphScalar(), printLoopGraphScheduler(), printLoopGraphVector(), and topLoop().
list<string> Klass::fUICode [protected] |
Definition at line 77 of file klass.hh.
Referenced by addUICode(), and println().
list<string> Klass::fUIMacro [protected] |
Definition at line 78 of file klass.hh.
Referenced by addUIMacro(), and println().
bool Klass::fVec [protected] |
list<string> Klass::fZone1Code [protected] |
shared vectors
Definition at line 90 of file klass.hh.
Referenced by addZone1(), printComputeMethodOpenMP(), printComputeMethodScalar(), printComputeMethodScheduler(), printComputeMethodVectorFaster(), printComputeMethodVectorSimple(), SigFloatGenKlass::println(), and SigIntGenKlass::println().
list<string> Klass::fZone2bCode [protected] |
single once per block
Definition at line 92 of file klass.hh.
Referenced by addZone2b(), printComputeMethodOpenMP(), printComputeMethodScalar(), printComputeMethodVectorFaster(), printComputeMethodVectorSimple(), SigFloatGenKlass::println(), and SigIntGenKlass::println().
list<string> Klass::fZone2cCode [protected] |
single once per block
Definition at line 93 of file klass.hh.
Referenced by addZone2c(), and printComputeMethodScheduler().
list<string> Klass::fZone2Code [protected] |
first private
Definition at line 91 of file klass.hh.
Referenced by addZone2(), printComputeMethodOpenMP(), printComputeMethodScalar(), printComputeMethodScheduler(), printComputeMethodVectorFaster(), printComputeMethodVectorSimple(), SigFloatGenKlass::println(), and SigIntGenKlass::println().
list<string> Klass::fZone3Code [protected] |
private every sub block
Definition at line 94 of file klass.hh.
Referenced by addZone3(), printComputeMethodOpenMP(), printComputeMethodScalar(), printComputeMethodScheduler(), printComputeMethodVectorFaster(), printComputeMethodVectorSimple(), SigFloatGenKlass::println(), and SigIntGenKlass::println().