annotate SSR.h @ 67:b5b5323b4177

added debugging stuff
author Some Random Person <seanhalle@yahoo.com>
date Fri, 16 Mar 2012 23:41:31 -0700
parents bd5ab695145c
children 81a0f076b12e
rev   line source
Me@6 1 /*
Me@6 2 * Copyright 2009 OpenSourceStewardshipFoundation.org
Me@6 3 * Licensed under GNU General Public License version 2
Me@6 4 *
Me@6 5 * Author: seanhalle@yahoo.com
Me@6 6 *
Me@6 7 */
Me@6 8
Me@6 9 #ifndef _SSR_H
Me@6 10 #define _SSR_H
Me@6 11
seanhalle@60 12 #include "Queue_impl/PrivateQueue.h"
seanhalle@60 13 #include "Hash_impl/PrivateHash.h"
seanhalle@60 14 #include "VMS_impl/VMS.h"
Nina@39 15 #include "dependency.h"
Me@6 16
Me@17 17
Me@17 18 //===========================================================================
Me@17 19 #define NUM_STRUCS_IN_SEM_ENV 1000
Me@17 20
seanhalle@62 21 //This is hardware dependent -- it's the number of cycles of scheduling
seanhalle@62 22 // overhead -- if a work unit is fewer than this, it is better being
seanhalle@62 23 // combined sequentially with other work
seanhalle@62 24 //This value depends on both VMS overhead and SSR's plugin. At some point
seanhalle@62 25 // it will be derived by perf-counter measurements during init of SSR
seanhalle@62 26 #define MIN_WORK_UNIT_CYCLES 20000
seanhalle@62 27
Me@17 28 //===========================================================================
Me@6 29 /*This header defines everything specific to the SSR semantic plug-in
Me@6 30 */
Me@6 31 typedef struct _SSRSemReq SSRSemReq;
Me@17 32 typedef void (*PtrToAtomicFn ) ( void * ); //executed atomically in master
Me@17 33 //===========================================================================
Me@6 34
Me@6 35 /*Semantic layer-specific data sent inside a request from lib called in app
seanhalle@67 36 * to request handler called in AnimationMaster
Me@6 37 */
Me@21 38
Me@21 39 typedef struct
Me@21 40 {
seanhalle@60 41 SlaveVP *VPCurrentlyExecuting;
Me@21 42 PrivQueueStruc *waitingVPQ;
Me@21 43 }
Me@21 44 SSRTrans;
Me@21 45
msach@24 46 /*WARNING: assembly hard-codes position of endInstrAddr as first field
msach@24 47 */
Me@21 48 typedef struct
Me@21 49 {
Me@22 50 void *endInstrAddr;
Me@21 51 int32 hasBeenStarted;
Me@21 52 int32 hasFinished;
Me@21 53 PrivQueueStruc *waitQ;
Me@21 54 }
Me@21 55 SSRSingleton;
Me@21 56
Me@6 57 enum SSRReqType
Me@6 58 {
Me@6 59 send_type = 1,
Me@6 60 send_from_to,
Me@6 61 receive_any, //order and grouping matter -- send before receive
Me@6 62 receive_type, // and receive_any first of the receives -- Handlers
Me@6 63 receive_from_to,// rely upon this ordering of enum
Me@6 64 transfer_to,
Me@17 65 transfer_out,
Me@17 66 malloc_req,
Me@17 67 free_req,
Me@21 68 singleton_fn_start,
Me@21 69 singleton_fn_end,
Me@21 70 singleton_data_start,
Me@21 71 singleton_data_end,
Me@17 72 atomic,
Me@17 73 trans_start,
Me@17 74 trans_end
Me@6 75 };
Me@6 76
Me@6 77 struct _SSRSemReq
Me@6 78 { enum SSRReqType reqType;
seanhalle@60 79 SlaveVP *sendPr;
seanhalle@60 80 SlaveVP *receivePr;
Me@17 81 int32 msgType;
Me@17 82 void *msg;
Me@6 83 SSRSemReq *nextReqInHashEntry;
Me@17 84
Me@17 85 void *initData;
seanhalle@60 86 TopLevelFnPtr fnPtr;
seanhalle@64 87 int32 coreToAssignOnto;
Me@17 88
Me@17 89 int32 sizeToMalloc;
Me@17 90 void *ptrToFree;
Me@17 91
Me@17 92 int32 singletonID;
Me@22 93 SSRSingleton **singletonPtrAddr;
Me@17 94
Me@17 95 PtrToAtomicFn fnToExecInMaster;
Me@17 96 void *dataForFn;
Me@17 97
Me@17 98 int32 transID;
Me@6 99 }
Me@6 100 /* SSRSemReq */;
Me@6 101
Me@17 102
Me@17 103 typedef struct
Me@17 104 {
Me@6 105 PrivQueueStruc **readyVPQs;
Me@14 106 HashTable *commHashTbl;
seanhalle@60 107 int32 numSlaveVP;
Me@14 108 int32 nextCoreToGetNewPr;
Me@14 109 int32 primitiveStartTime;
Me@17 110
Me@17 111 //fix limit on num with dynArray
Me@21 112 SSRSingleton fnSingletons[NUM_STRUCS_IN_SEM_ENV];
Me@17 113 SSRTrans transactionStrucs[NUM_STRUCS_IN_SEM_ENV];
Nina@39 114
seanhalle@60 115 #ifdef HOLISTIC__TURN_ON_OBSERVE_UCC
nengel@47 116 ListOfArrays* unitList;
nengel@46 117 ListOfArrays* ctlDependenciesList;
nengel@46 118 ListOfArrays* commDependenciesList;
nengel@48 119 NtoN** ntonGroups;
nengel@48 120 PrivDynArrayInfo* ntonGroupsInfo;
nengel@49 121 ListOfArrays* dynDependenciesList;
nengel@49 122 Unit last_in_slot[NUM_CORES * NUM_SCHED_SLOTS];
nengel@49 123 ListOfArrays* hwArcs;
Nina@39 124 #endif
nengel@50 125
seanhalle@60 126 #ifdef HOLISTIC__TURN_ON_PERF_COUNTERS
nengel@56 127 ListOfArrays* counterList[NUM_CORES];
nengel@50 128 #endif
seanhalle@60 129 SlaveVP* idlePr[NUM_CORES][NUM_SCHED_SLOTS];
Me@6 130 }
Me@6 131 SSRSemEnv;
Me@6 132
Me@6 133
Me@17 134 typedef struct _TransListElem TransListElem;
Me@17 135 struct _TransListElem
Me@17 136 {
Me@17 137 int32 transID;
Me@17 138 TransListElem *nextTrans;
Me@17 139 };
Me@18 140 //TransListElem
Me@18 141
Me@17 142 typedef struct
Me@17 143 {
Me@17 144 int32 highestTransEntered;
Me@17 145 TransListElem *lastTransEntered;
Me@17 146 }
Me@17 147 SSRSemData;
Me@17 148
Me@6 149 //===========================================================================
Me@6 150
Me@6 151 void
seanhalle@60 152 SSR__create_seed_procr_and_do_work( TopLevelFnPtr fn, void *initData );
Me@6 153
Me@14 154 int32
Me@14 155 SSR__giveMinWorkUnitCycles( float32 percentOverhead );
Me@14 156
Me@20 157 void
Me@14 158 SSR__start_primitive();
Me@14 159
Me@20 160 int32
Me@14 161 SSR__end_primitive_and_give_cycles();
Me@14 162
Me@16 163 int32
Me@16 164 SSR__giveIdealNumWorkUnits();
Me@14 165
Me@17 166 int32
Me@17 167 SSR__give_number_of_cores_to_schedule_onto();
Me@17 168
Me@6 169 //=======================
Me@6 170
Me@6 171 void
Me@6 172 SSR__init();
Me@6 173
Me@6 174 void
Me@6 175 SSR__cleanup_after_shutdown();
Me@6 176
Me@6 177 //=======================
Me@6 178
seanhalle@60 179 SlaveVP *
seanhalle@60 180 SSR__create_procr_with( TopLevelFnPtr fnPtr, void *initData,
seanhalle@60 181 SlaveVP *creatingSlv );
Me@6 182
seanhalle@60 183 SlaveVP *
seanhalle@60 184 SSR__create_procr_with_affinity( TopLevelFnPtr fnPtr, void *initData,
seanhalle@64 185 SlaveVP *creatingPr, int32 coreToAssignOnto);
Me@17 186
Me@6 187 void
seanhalle@60 188 SSR__dissipate_procr( SlaveVP *procrToDissipate );
Me@6 189
Me@6 190 //=======================
Me@6 191 void *
seanhalle@60 192 SSR__malloc_to( int numBytes, SlaveVP *ownerSlv );
Me@17 193
Me@17 194 void
seanhalle@60 195 SSR__free( void *ptrToFree, SlaveVP *owningSlv );
Me@6 196
Me@6 197 void
seanhalle@60 198 SSR__transfer_ownership_of_from_to( void *data, SlaveVP *oldOwnerPr,
seanhalle@60 199 SlaveVP *newOwnerSlv );
Me@6 200
Me@6 201 void
seanhalle@60 202 SSR__add_ownership_by_to( SlaveVP *newOwnerPr, void *data );
Me@6 203
Me@6 204 void
seanhalle@60 205 SSR__remove_ownership_by_from( SlaveVP *loserPr, void *dataLosing );
Me@6 206
Me@6 207 void
Me@6 208 SSR__transfer_ownership_to_outside( void *dataToTransferOwnershipOf );
Me@6 209
Me@6 210
Me@6 211
Me@6 212 //=======================
Me@6 213 void
seanhalle@60 214 SSR__send_of_type_to( SlaveVP *sendPr, void *msg, const int type,
seanhalle@60 215 SlaveVP *receivePr);
Me@6 216
Me@6 217 void
seanhalle@60 218 SSR__send_from_to( void *msg, SlaveVP *sendPr, SlaveVP *receivePr);
Me@6 219
Me@6 220 void *
seanhalle@60 221 SSR__receive_type_to( const int type, SlaveVP *receiveSlv );
Me@6 222
Me@6 223 void *
seanhalle@60 224 SSR__receive_from_to( SlaveVP *sendPr, SlaveVP *receiveSlv );
Me@6 225
Me@6 226
Me@17 227 //======================= Concurrency Stuff ======================
Me@17 228 void
seanhalle@60 229 SSR__start_fn_singleton( int32 singletonID, SlaveVP *animSlv );
Me@21 230
Me@21 231 void
seanhalle@60 232 SSR__end_fn_singleton( int32 singletonID, SlaveVP *animSlv );
Me@21 233
Me@21 234 void
seanhalle@60 235 SSR__start_data_singleton( SSRSingleton **singeltonAddr, SlaveVP *animSlv );
Me@21 236
Me@21 237 void
seanhalle@60 238 SSR__end_data_singleton( SSRSingleton **singletonAddr, SlaveVP *animSlv );
Me@6 239
Me@6 240 void
Me@17 241 SSR__animate_short_fn_in_isolation( PtrToAtomicFn ptrToFnToExecInMaster,
seanhalle@60 242 void *data, SlaveVP *animSlv );
Me@17 243
Me@17 244 void
seanhalle@60 245 SSR__start_transaction( int32 transactionID, SlaveVP *animSlv );
Me@17 246
Me@17 247 void
seanhalle@60 248 SSR__end_transaction( int32 transactionID, SlaveVP *animSlv );
Me@6 249
Me@6 250
Me@6 251 //========================= Internal use only =============================
Me@6 252 void
seanhalle@60 253 SSR__Request_Handler( SlaveVP *requestingPr, void *_semEnv );
Me@6 254
seanhalle@60 255 SlaveVP *
seanhalle@67 256 SSR__assign_slaveVP_to_slot( void *_semEnv, AnimSlot *slot );
Me@6 257
seanhalle@60 258 SlaveVP*
seanhalle@60 259 SSR__create_procr_helper( TopLevelFnPtr fnPtr, void *initData,
seanhalle@64 260 SSRSemEnv *semEnv, int32 coreToAssignOnto );
Me@6 261
seanhalle@64 262 //===================== Measurement of Lang Overheads =====================
seanhalle@64 263 #include "SSR_Measurement.h"
seanhalle@64 264
seanhalle@64 265 //===========================================================================
Me@6 266 #endif /* _SSR_H */
Me@6 267