# HG changeset patch # User Me # Date 1275358514 25200 # Node ID 6c518bda83fe9c2e1b08cf6170418b3125ef7012 # Parent ca61f77ed41722007752f3507a76a1ba7207d69a About to chg to win thds -- good except for that diff -r ca61f77ed417 -r 6c518bda83fe VMS.h --- a/VMS.h Mon May 31 15:24:42 2010 -0700 +++ b/VMS.h Mon May 31 19:15:14 2010 -0700 @@ -9,25 +9,27 @@ #ifndef _VMS_H #define _VMS_H - #include "VMS_primitive_data_types.h" #include "Queue_impl/BlockingQueue.h" //This value is the number of hardware threads in the shared memory -// machine -#define NUM_WORKERS 4 -#define NUM_SLAVES 8 +// machine -- make double that number scheduling slots, plus extra for master +#define NUM_WORKERS 4 +#define NUM_SCHED_SLOTS 9 #define SUCCESS 0 #define thdAttrs NULL -typedef struct WorkUnit WorkUnit; -typedef struct VMSProcr VMSProcr; -typedef struct SlaveReqst SlaveReqst; +typedef struct _WorkUnit WorkUnit; +typedef struct _VirtProcr VirtProcr; +typedef struct _SlaveReqst SlaveReqst; +typedef struct _SchedSlot SchedSlot; -typedef bool8 (*SlaveScheduler) ( void * ); +typedef bool8 (*SlaveScheduler) ( SchedSlot *, void * ); typedef void (*RequestHandler) ( SlaveReqst * ); +typedef void (*VirtProcrFnPtr) ( void *, VirtProcr * ); +typedef void VirtProcrFn( void *, VirtProcr * ); typedef struct { @@ -36,53 +38,56 @@ } ThdParams; -//This is application-level data of the scheduler that runs in the master -// virtual processor. This data is at a higher level than the slave data- -// struc, which is part of the virtualization infrastructure.. this -// MasterEnv sits on top of that level +struct _SchedSlot + { + int workIsDone; + int needsProcrAssigned; + VirtProcr *procrAssignedToSlot; + }; + + +struct _VirtProcr + { + void *stackPtr; + void *framePtr; + void *nextInstrPt; + void *coreLoopStartPt; //allows proto-runtime to be linked later + + void *initialData; + + SchedSlot *schedSlot; + SlaveReqst *requests; + + void *semanticData; + }; + + +//When optimize make a separate flat array in here for each flag in SchedSlot +//So that polling done flags is fast.. not sure even worth it, though.. typedef struct { - VMSProcr virtSlaves[ NUM_SLAVES ]; - VMSProcr virtMaster; + SlaveScheduler slaveScheduler; + RequestHandler requestHandler; - SlaveScheduler slaveScheduler; - RequestHandler requestHandler; - + SchedSlot **schedSlots; + SchedSlot **filledSlots; + int numFilled; + int stillRunning; - WorkUnit *masterWorkUnit; - VMSProcr **scheduledSlaves; - int numScheduled; - - void *OSEventStruc; + VirtProcr *masterVirtPr; void *semanticEnv; + void *OSEventStruc; //for future, when add I/O to BLIS } MasterEnv; -struct WorkUnit + +struct _SlaveReqst { - VMSProcr *slaveAssignedTo; - void *addrToJumpTo; - void *workData; - - void *pluginSpecific; - }; - - -struct VMSProcr - { - WorkUnit *workUnitToDo; - SlaveReqst *requestsToMaster; - int workIsDone; - int needsWorkAssigned; - }; - -struct SlaveReqst - { - VMSProcr *slaveFrom; - int reqType; - void *reqData; + VirtProcr *slaveFrom; + int reqType; //for future when have I/O and OS services + void *semReqData; SlaveReqst *nextRequest; }; @@ -94,11 +99,16 @@ //===================== Global Vars =================== + pthread_t coreLoopThds[ NUM_WORKERS ]; // std struc, holds thread info -QueueStruc *workQ; ThdParams thdParams[ NUM_WORKERS ]; -MasterEnv *masterEnv; +volatile MasterEnv *_VMSMasterEnv; + + //workQ is global, static, and volatile so that core loop has its location + // hard coded, and reloads every time through the loop -- that way don't + // need to save any regs used by core loop (will see if this really works) +volatile QueueStruc *_VMSWorkQ; #endif /* _VMS_H */