Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > VOMP_impls > VOMP__MC_shared_impl
diff VOMP.h @ 0:b311282ec174
Initial add -- copies of code from SSR
| author | Some Random Person <seanhalle@yahoo.com> |
|---|---|
| date | Sun, 20 May 2012 22:07:52 -0700 |
| parents | |
| children | 21cf36019f0d |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/VOMP.h Sun May 20 22:07:52 2012 -0700 1.3 @@ -0,0 +1,268 @@ 1.4 +/* 1.5 + * Copyright 2009 OpenSourceStewardshipFoundation.org 1.6 + * Licensed under GNU General Public License version 2 1.7 + * 1.8 + * Author: seanhalle@yahoo.com 1.9 + * 1.10 + */ 1.11 + 1.12 +#ifndef _SSR_H 1.13 +#define _SSR_H 1.14 + 1.15 +#include "Queue_impl/PrivateQueue.h" 1.16 +#include "Hash_impl/PrivateHash.h" 1.17 +#include "VMS_impl/VMS.h" 1.18 +#include "dependency.h" 1.19 + 1.20 + 1.21 +//=========================================================================== 1.22 +#define NUM_STRUCS_IN_SEM_ENV 1000 1.23 + 1.24 + //This is hardware dependent -- it's the number of cycles of scheduling 1.25 + // overhead -- if a work unit is fewer than this, it is better being 1.26 + // combined sequentially with other work 1.27 + //This value depends on both VMS overhead and SSR's plugin. At some point 1.28 + // it will be derived by perf-counter measurements during init of SSR 1.29 +#define MIN_WORK_UNIT_CYCLES 20000 1.30 + 1.31 +//=========================================================================== 1.32 +/*This header defines everything specific to the SSR semantic plug-in 1.33 + */ 1.34 +typedef struct _SSRSemReq SSRSemReq; 1.35 +typedef void (*PtrToAtomicFn ) ( void * ); //executed atomically in master 1.36 +//=========================================================================== 1.37 + 1.38 +/*Semantic layer-specific data sent inside a request from lib called in app 1.39 + * to request handler called in AnimationMaster 1.40 + */ 1.41 + 1.42 +typedef struct 1.43 + { 1.44 + SlaveVP *VPCurrentlyExecuting; 1.45 + PrivQueueStruc *waitingVPQ; 1.46 + } 1.47 +SSRTrans; 1.48 + 1.49 +/*WARNING: assembly hard-codes position of endInstrAddr as first field 1.50 + */ 1.51 +typedef struct 1.52 + { 1.53 + void *endInstrAddr; 1.54 + int32 hasBeenStarted; 1.55 + int32 hasFinished; 1.56 + PrivQueueStruc *waitQ; 1.57 + } 1.58 +SSRSingleton; 1.59 + 1.60 +enum SSRReqType 1.61 + { 1.62 + send_type = 1, 1.63 + send_from_to, 1.64 + receive_any, //order and grouping matter -- send before receive 1.65 + receive_type, // and receive_any first of the receives -- Handlers 1.66 + receive_from_to,// rely upon this ordering of enum 1.67 + transfer_to, 1.68 + transfer_out, 1.69 + malloc_req, 1.70 + free_req, 1.71 + singleton_fn_start, 1.72 + singleton_fn_end, 1.73 + singleton_data_start, 1.74 + singleton_data_end, 1.75 + atomic, 1.76 + trans_start, 1.77 + trans_end 1.78 + }; 1.79 + 1.80 +struct _SSRSemReq 1.81 + { enum SSRReqType reqType; 1.82 + SlaveVP *sendPr; 1.83 + SlaveVP *receivePr; 1.84 + int32 msgType; 1.85 + void *msg; 1.86 + SSRSemReq *nextReqInHashEntry; 1.87 + 1.88 + void *initData; 1.89 + TopLevelFnPtr fnPtr; 1.90 + int32 coreToAssignOnto; 1.91 + 1.92 + int32 sizeToMalloc; 1.93 + void *ptrToFree; 1.94 + 1.95 + int32 singletonID; 1.96 + SSRSingleton **singletonPtrAddr; 1.97 + 1.98 + PtrToAtomicFn fnToExecInMaster; 1.99 + void *dataForFn; 1.100 + 1.101 + int32 transID; 1.102 + } 1.103 +/* SSRSemReq */; 1.104 + 1.105 + 1.106 +typedef struct 1.107 + { 1.108 + PrivQueueStruc **readyVPQs; 1.109 + HashTable *commHashTbl; 1.110 + int32 numSlaveVP; 1.111 + int32 nextCoreToGetNewPr; 1.112 + int32 primitiveStartTime; 1.113 + 1.114 + //fix limit on num with dynArray 1.115 + SSRSingleton fnSingletons[NUM_STRUCS_IN_SEM_ENV]; 1.116 + SSRTrans transactionStrucs[NUM_STRUCS_IN_SEM_ENV]; 1.117 + 1.118 + #ifdef HOLISTIC__TURN_ON_OBSERVE_UCC 1.119 + ListOfArrays* unitList; 1.120 + ListOfArrays* ctlDependenciesList; 1.121 + ListOfArrays* commDependenciesList; 1.122 + NtoN** ntonGroups; 1.123 + PrivDynArrayInfo* ntonGroupsInfo; 1.124 + ListOfArrays* dynDependenciesList; 1.125 + Unit last_in_slot[NUM_CORES * NUM_ANIM_SLOTS]; 1.126 + ListOfArrays* hwArcs; 1.127 + #endif 1.128 + 1.129 + #ifdef HOLISTIC__TURN_ON_PERF_COUNTERS 1.130 + ListOfArrays* counterList[NUM_CORES]; 1.131 + #endif 1.132 + SlaveVP* idlePr[NUM_CORES][NUM_ANIM_SLOTS]; 1.133 + int shutdownInitiated; 1.134 + } 1.135 +SSRSemEnv; 1.136 + 1.137 + 1.138 +typedef struct _TransListElem TransListElem; 1.139 +struct _TransListElem 1.140 + { 1.141 + int32 transID; 1.142 + TransListElem *nextTrans; 1.143 + }; 1.144 +//TransListElem 1.145 + 1.146 +typedef struct 1.147 + { 1.148 + int32 highestTransEntered; 1.149 + TransListElem *lastTransEntered; 1.150 + } 1.151 +SSRSemData; 1.152 + 1.153 +//=========================================================================== 1.154 + 1.155 +void 1.156 +SSR__create_seed_procr_and_do_work( TopLevelFnPtr fn, void *initData ); 1.157 + 1.158 +int32 1.159 +SSR__giveMinWorkUnitCycles( float32 percentOverhead ); 1.160 + 1.161 +void 1.162 +SSR__start_primitive(); 1.163 + 1.164 +int32 1.165 +SSR__end_primitive_and_give_cycles(); 1.166 + 1.167 +int32 1.168 +SSR__giveIdealNumWorkUnits(); 1.169 + 1.170 +int32 1.171 +SSR__give_number_of_cores_to_schedule_onto(); 1.172 + 1.173 +//======================= 1.174 + 1.175 +void 1.176 +SSR__init(); 1.177 + 1.178 +void 1.179 +SSR__cleanup_after_shutdown(); 1.180 + 1.181 +//======================= 1.182 + 1.183 + SlaveVP * 1.184 +SSR__create_procr_with( TopLevelFnPtr fnPtr, void *initData, 1.185 + SlaveVP *creatingSlv ); 1.186 + 1.187 + SlaveVP * 1.188 +SSR__create_procr_with_affinity( TopLevelFnPtr fnPtr, void *initData, 1.189 + SlaveVP *creatingPr, int32 coreToAssignOnto); 1.190 + 1.191 +void 1.192 +SSR__dissipate_procr( SlaveVP *procrToDissipate ); 1.193 + 1.194 +//======================= 1.195 +void * 1.196 +SSR__malloc_to( int numBytes, SlaveVP *ownerSlv ); 1.197 + 1.198 +void 1.199 +SSR__free( void *ptrToFree, SlaveVP *owningSlv ); 1.200 + 1.201 +void 1.202 +SSR__transfer_ownership_of_from_to( void *data, SlaveVP *oldOwnerPr, 1.203 + SlaveVP *newOwnerSlv ); 1.204 + 1.205 +void 1.206 +SSR__add_ownership_by_to( SlaveVP *newOwnerPr, void *data ); 1.207 + 1.208 +void 1.209 +SSR__remove_ownership_by_from( SlaveVP *loserPr, void *dataLosing ); 1.210 + 1.211 +void 1.212 +SSR__transfer_ownership_to_outside( void *dataToTransferOwnershipOf ); 1.213 + 1.214 + 1.215 + 1.216 +//======================= 1.217 +void 1.218 +SSR__send_of_type_to( SlaveVP *sendPr, void *msg, const int type, 1.219 + SlaveVP *receivePr); 1.220 + 1.221 +void 1.222 +SSR__send_from_to( void *msg, SlaveVP *sendPr, SlaveVP *receivePr); 1.223 + 1.224 +void * 1.225 +SSR__receive_type_to( const int type, SlaveVP *receiveSlv ); 1.226 + 1.227 +void * 1.228 +SSR__receive_from_to( SlaveVP *sendPr, SlaveVP *receiveSlv ); 1.229 + 1.230 + 1.231 +//======================= Concurrency Stuff ====================== 1.232 +void 1.233 +SSR__start_fn_singleton( int32 singletonID, SlaveVP *animSlv ); 1.234 + 1.235 +void 1.236 +SSR__end_fn_singleton( int32 singletonID, SlaveVP *animSlv ); 1.237 + 1.238 +void 1.239 +SSR__start_data_singleton( SSRSingleton **singeltonAddr, SlaveVP *animSlv ); 1.240 + 1.241 +void 1.242 +SSR__end_data_singleton( SSRSingleton **singletonAddr, SlaveVP *animSlv ); 1.243 + 1.244 +void 1.245 +SSR__animate_short_fn_in_isolation( PtrToAtomicFn ptrToFnToExecInMaster, 1.246 + void *data, SlaveVP *animSlv ); 1.247 + 1.248 +void 1.249 +SSR__start_transaction( int32 transactionID, SlaveVP *animSlv ); 1.250 + 1.251 +void 1.252 +SSR__end_transaction( int32 transactionID, SlaveVP *animSlv ); 1.253 + 1.254 + 1.255 +//========================= Internal use only ============================= 1.256 +void 1.257 +SSR__Request_Handler( SlaveVP *requestingPr, void *_semEnv ); 1.258 + 1.259 +SlaveVP * 1.260 +SSR__assign_slaveVP_to_slot( void *_semEnv, AnimSlot *slot ); 1.261 + 1.262 +SlaveVP* 1.263 +SSR__create_procr_helper( TopLevelFnPtr fnPtr, void *initData, 1.264 + SSRSemEnv *semEnv, int32 coreToAssignOnto ); 1.265 + 1.266 +//===================== Measurement of Lang Overheads ===================== 1.267 +#include "SSR_Measurement.h" 1.268 + 1.269 +//=========================================================================== 1.270 +#endif /* _SSR_H */ 1.271 +
