annotate SSR.h @ 66:ce95c4d84fcd

integrating holistic model in common ancestor - not finished yet
author Nina Engelhardt <nengel@mailbox.tu-berlin.de>
date Thu, 15 Mar 2012 18:28:43 +0100
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
Me@6 36 * to request handler called in MasterLoop
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];
nengel@66 130 int shutdownInitiated;
Me@6 131 }
Me@6 132 SSRSemEnv;
Me@6 133
Me@6 134
Me@17 135 typedef struct _TransListElem TransListElem;
Me@17 136 struct _TransListElem
Me@17 137 {
Me@17 138 int32 transID;
Me@17 139 TransListElem *nextTrans;
Me@17 140 };
Me@18 141 //TransListElem
Me@18 142
Me@17 143 typedef struct
Me@17 144 {
Me@17 145 int32 highestTransEntered;
Me@17 146 TransListElem *lastTransEntered;
Me@17 147 }
Me@17 148 SSRSemData;
Me@17 149
Me@6 150 //===========================================================================
Me@6 151
Me@6 152 void
seanhalle@60 153 SSR__create_seed_procr_and_do_work( TopLevelFnPtr fn, void *initData );
Me@6 154
Me@14 155 int32
Me@14 156 SSR__giveMinWorkUnitCycles( float32 percentOverhead );
Me@14 157
Me@20 158 void
Me@14 159 SSR__start_primitive();
Me@14 160
Me@20 161 int32
Me@14 162 SSR__end_primitive_and_give_cycles();
Me@14 163
Me@16 164 int32
Me@16 165 SSR__giveIdealNumWorkUnits();
Me@14 166
Me@17 167 int32
Me@17 168 SSR__give_number_of_cores_to_schedule_onto();
Me@17 169
Me@6 170 //=======================
Me@6 171
Me@6 172 void
Me@6 173 SSR__init();
Me@6 174
Me@6 175 void
Me@6 176 SSR__cleanup_after_shutdown();
Me@6 177
Me@6 178 //=======================
Me@6 179
seanhalle@60 180 SlaveVP *
seanhalle@60 181 SSR__create_procr_with( TopLevelFnPtr fnPtr, void *initData,
seanhalle@60 182 SlaveVP *creatingSlv );
Me@6 183
seanhalle@60 184 SlaveVP *
seanhalle@60 185 SSR__create_procr_with_affinity( TopLevelFnPtr fnPtr, void *initData,
seanhalle@64 186 SlaveVP *creatingPr, int32 coreToAssignOnto);
Me@17 187
Me@6 188 void
seanhalle@60 189 SSR__dissipate_procr( SlaveVP *procrToDissipate );
Me@6 190
Me@6 191 //=======================
Me@6 192 void *
seanhalle@60 193 SSR__malloc_to( int numBytes, SlaveVP *ownerSlv );
Me@17 194
Me@17 195 void
seanhalle@60 196 SSR__free( void *ptrToFree, SlaveVP *owningSlv );
Me@6 197
Me@6 198 void
seanhalle@60 199 SSR__transfer_ownership_of_from_to( void *data, SlaveVP *oldOwnerPr,
seanhalle@60 200 SlaveVP *newOwnerSlv );
Me@6 201
Me@6 202 void
seanhalle@60 203 SSR__add_ownership_by_to( SlaveVP *newOwnerPr, void *data );
Me@6 204
Me@6 205 void
seanhalle@60 206 SSR__remove_ownership_by_from( SlaveVP *loserPr, void *dataLosing );
Me@6 207
Me@6 208 void
Me@6 209 SSR__transfer_ownership_to_outside( void *dataToTransferOwnershipOf );
Me@6 210
Me@6 211
Me@6 212
Me@6 213 //=======================
Me@6 214 void
seanhalle@60 215 SSR__send_of_type_to( SlaveVP *sendPr, void *msg, const int type,
seanhalle@60 216 SlaveVP *receivePr);
Me@6 217
Me@6 218 void
seanhalle@60 219 SSR__send_from_to( void *msg, SlaveVP *sendPr, SlaveVP *receivePr);
Me@6 220
Me@6 221 void *
seanhalle@60 222 SSR__receive_type_to( const int type, SlaveVP *receiveSlv );
Me@6 223
Me@6 224 void *
seanhalle@60 225 SSR__receive_from_to( SlaveVP *sendPr, SlaveVP *receiveSlv );
Me@6 226
Me@6 227
Me@17 228 //======================= Concurrency Stuff ======================
Me@17 229 void
seanhalle@60 230 SSR__start_fn_singleton( int32 singletonID, SlaveVP *animSlv );
Me@21 231
Me@21 232 void
seanhalle@60 233 SSR__end_fn_singleton( int32 singletonID, SlaveVP *animSlv );
Me@21 234
Me@21 235 void
seanhalle@60 236 SSR__start_data_singleton( SSRSingleton **singeltonAddr, SlaveVP *animSlv );
Me@21 237
Me@21 238 void
seanhalle@60 239 SSR__end_data_singleton( SSRSingleton **singletonAddr, SlaveVP *animSlv );
Me@6 240
Me@6 241 void
Me@17 242 SSR__animate_short_fn_in_isolation( PtrToAtomicFn ptrToFnToExecInMaster,
seanhalle@60 243 void *data, SlaveVP *animSlv );
Me@17 244
Me@17 245 void
seanhalle@60 246 SSR__start_transaction( int32 transactionID, SlaveVP *animSlv );
Me@17 247
Me@17 248 void
seanhalle@60 249 SSR__end_transaction( int32 transactionID, SlaveVP *animSlv );
Me@6 250
Me@6 251
Me@6 252 //========================= Internal use only =============================
Me@6 253 void
seanhalle@60 254 SSR__Request_Handler( SlaveVP *requestingPr, void *_semEnv );
Me@6 255
seanhalle@60 256 SlaveVP *
seanhalle@64 257 SSR__assign_slaveVP( void *_semEnv, int coreNum, SchedSlot *slot );
Me@6 258
seanhalle@60 259 SlaveVP*
seanhalle@60 260 SSR__create_procr_helper( TopLevelFnPtr fnPtr, void *initData,
seanhalle@64 261 SSRSemEnv *semEnv, int32 coreToAssignOnto );
Me@6 262
seanhalle@64 263 //===================== Measurement of Lang Overheads =====================
seanhalle@64 264 #include "SSR_Measurement.h"
seanhalle@64 265
seanhalle@64 266 //===========================================================================
Me@6 267 #endif /* _SSR_H */
Me@6 268