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