comparison MasterLoop.c @ 166:aefd87f9d12f

loop graph
author Nina Engelhardt
date Tue, 18 Oct 2011 15:53:04 +0200
parents 395f58384a5c
children 981acd1db6af
comparison
equal deleted inserted replaced
37:75ff680b09b8 43:16895dd3ea7b
88 volatile VirtProcr *volatileMasterPr; 88 volatile VirtProcr *volatileMasterPr;
89 89
90 volatileMasterPr = animatingPr; 90 volatileMasterPr = animatingPr;
91 masterPr = (VirtProcr*)volatileMasterPr; //used to force re-define after jmp 91 masterPr = (VirtProcr*)volatileMasterPr; //used to force re-define after jmp
92 92
93 bulb b = new_bulb();
94 numSlotsFilled=1;
93 //First animation of each MasterVP will in turn animate this part 95 //First animation of each MasterVP will in turn animate this part
94 // of setup code.. (VP creator sets up the stack as if this function 96 // of setup code.. (VP creator sets up the stack as if this function
95 // was called normally, but actually get here by jmp) 97 // was called normally, but actually get here by jmp)
96 //So, setup values about stack ptr, jmp pt and all that 98 //So, setup values about stack ptr, jmp pt and all that
97 //masterPr->nextInstrPt = &&masterLoopStartPt; 99 //masterPr->nextInstrPt = &&masterLoopStartPt;
127 129
128 requestHandler = masterEnv->requestHandler; 130 requestHandler = masterEnv->requestHandler;
129 slaveScheduler = masterEnv->slaveScheduler; 131 slaveScheduler = masterEnv->slaveScheduler;
130 semanticEnv = masterEnv->semanticEnv; 132 semanticEnv = masterEnv->semanticEnv;
131 133
134 #ifdef DETECT_LOOP_GRAPH
135 if(numSlotsFilled > 0){
136 b = new_bulb();
137 addToDynArray((void*)b,masterEnv->loop_graph_array_info);
138 set_bulb_core(b,thisCoresIdx);
139 set_bulb_id(b,masterEnv->loop_counter[thisCoresIdx]++);
140 }
141 #endif
132 142
133 //Poll each slot's Done flag 143 //Poll each slot's Done flag
134 numSlotsFilled = 0; 144 numSlotsFilled = 0;
135 for( slotIdx = 0; slotIdx < NUM_SCHED_SLOTS; slotIdx++) 145 for( slotIdx = 0; slotIdx < NUM_SCHED_SLOTS; slotIdx++)
136 { 146 {
158 print_record_csv_to_file(lastRecord,_VMSMasterEnv->counteroutput); 168 print_record_csv_to_file(lastRecord,_VMSMasterEnv->counteroutput);
159 169
160 Dependency* newd = new_dependency(currSlot->procrAssignedToSlot->procrID,lastRecord->task_position,currSlot->procrAssignedToSlot->procrID,lastRecord->task_position + 1); 170 Dependency* newd = new_dependency(currSlot->procrAssignedToSlot->procrID,lastRecord->task_position,currSlot->procrAssignedToSlot->procrID,lastRecord->task_position + 1);
161 addToDynArray((void*) newd ,masterEnv->dependenciesInfo); 171 addToDynArray((void*) newd ,masterEnv->dependenciesInfo);
162 172
173
174
163 //print_record_human_readable(lastRecord); 175 //print_record_human_readable(lastRecord);
164 //create new entry in record array 176 //create new entry in record array
165 CounterRecord* newRecord = VMS__malloc(sizeof(CounterRecord)); 177 CounterRecord* newRecord = VMS__malloc(sizeof(CounterRecord));
166 newRecord->req_core = thisCoresIdx; 178 newRecord->req_core = thisCoresIdx;
167 newRecord->vp_id = currSlot->procrAssignedToSlot->procrID; 179 newRecord->vp_id = currSlot->procrAssignedToSlot->procrID;
215 saveCyclesAndInstrs(thisCoresIdx,lastRecord->end_assign_cycles,lastRecord->end_assign_instrs); 227 saveCyclesAndInstrs(thisCoresIdx,lastRecord->end_assign_cycles,lastRecord->end_assign_instrs);
216 #endif 228 #endif
217 writeVMSQ( schedVirtPr, readyToAnimateQ ); 229 writeVMSQ( schedVirtPr, readyToAnimateQ );
218 } 230 }
219 } 231 }
232 #ifdef DETECT_LOOP_GRAPH
233 if(!currSlot->needsProcrAssigned) {
234 int lastRecordIdx = currSlot->procrAssignedToSlot->counter_history_array_info->numInArray -1;
235 CounterRecord* lastRecord = currSlot->procrAssignedToSlot->counter_history[lastRecordIdx];
236 set_bulb_member(b,slotIdx,currSlot->procrAssignedToSlot->procrID,lastRecord->task_position);
237 }
238 #endif
220 } 239 }
221 240
222 241
223 #ifdef USE_WORK_STEALING 242 #ifdef USE_WORK_STEALING
224 //If no slots filled, means no more work, look for work to steal. 243 //If no slots filled, means no more work, look for work to steal.