diff VMS.h @ 31:e69579a0e797

Works multi-core.. pinned VP to a core loop
author Me
date Wed, 01 Sep 2010 08:23:39 -0700
parents c8823e0bb2b4
children 17d20e5cf924
line diff
     1.1 --- a/VMS.h	Mon Aug 09 02:24:31 2010 -0700
     1.2 +++ b/VMS.h	Wed Sep 01 08:23:39 2010 -0700
     1.3 @@ -14,6 +14,11 @@
     1.4  #include "Queue_impl/BlockingQueue.h"
     1.5  #include <pthread.h>
     1.6  
     1.7 +   //When DEBUG is defined, VMS does sequential exe in the main thread
     1.8 +   // It still does co-routines and all the mechanisms are the same, it just
     1.9 +   // has only a single thread and animates VPs one at a time
    1.10 +//#define DEBUG
    1.11 +
    1.12     //This value is the number of hardware threads in the shared memory
    1.13     // machine
    1.14  #define NUM_CORES        4
    1.15 @@ -22,8 +27,10 @@
    1.16  //#define NUM_SCHED_SLOTS  (2 * NUM_CORES + 1)
    1.17  #define NUM_SCHED_SLOTS  3
    1.18  
    1.19 -   // 8K stack
    1.20 -#define VIRT_PROCR_STACK_SIZE 0x20000
    1.21 +#define READYTOANIMATE_RETRIES 10000
    1.22 +
    1.23 +   // stack
    1.24 +#define VIRT_PROCR_STACK_SIZE 0x10000
    1.25  
    1.26     //256M of total memory for VMS application to VMS__malloc
    1.27  #define MASSIVE_MALLOC_SIZE 0x10000000
    1.28 @@ -43,7 +50,7 @@
    1.29  typedef struct _VMSReqst   VMSReqst;
    1.30  typedef struct _VirtProcr  VirtProcr;
    1.31  
    1.32 -typedef VirtProcr * (*SlaveScheduler)  ( void * );        //semEnv
    1.33 +typedef VirtProcr * (*SlaveScheduler)  ( void *, int );   //semEnv, coreIdx
    1.34  typedef void  (*RequestHandler)  ( VirtProcr *, void * ); //prWReqst, semEnv
    1.35  typedef void  (*VirtProcrFnPtr)  ( void *, VirtProcr * ); //initData, animPr
    1.36  typedef void    VirtProcrFn      ( void *, VirtProcr * ); //initData, animPr
    1.37 @@ -109,25 +116,21 @@
    1.38  
    1.39  typedef struct
    1.40   {
    1.41 -   SlaveScheduler slaveScheduler;
    1.42 -   RequestHandler requestHandler;
    1.43 +   SlaveScheduler   slaveScheduler;
    1.44 +   RequestHandler   requestHandler;
    1.45     
    1.46 -   SchedSlot    **schedSlots;
    1.47 -   SchedSlot    **filledSlots;
    1.48 -   int            numToPrecede;
    1.49 -   
    1.50 -   volatile int   stillRunning;
    1.51 -   
    1.52 -   VirtProcr     *masterVirtPr;
    1.53 +   SchedSlot     ***allSchedSlots;
    1.54 +   SRSWQueueStruc **readyToAnimateQs;
    1.55 +   VirtProcr      **masterVPs;
    1.56  
    1.57 -   void          *semanticEnv;
    1.58 -   void          *OSEventStruc;    //for future, when add I/O to BLIS
    1.59 +   void            *semanticEnv;
    1.60 +   void            *OSEventStruc;   //for future, when add I/O to BLIS
    1.61  
    1.62 -   void          *coreLoopEndPt; //addr to jump to to shut down a coreLoop
    1.63 +   void            *coreLoopStartPt;//addr to jump to to re-enter coreLoop
    1.64 +   void            *coreLoopEndPt;  //addr to jump to to shut down a coreLoop
    1.65  
    1.66 -   int            setupComplete;
    1.67 -
    1.68 -   void          *mallocChunk;
    1.69 +   int              setupComplete;
    1.70 +   int              masterLock;
    1.71   }
    1.72  MasterEnv;
    1.73  
    1.74 @@ -149,11 +152,6 @@
    1.75  
    1.76  volatile MasterEnv      *_VMSMasterEnv;
    1.77  
    1.78 -   //workQ is global, static, and volatile so that core loop has its location
    1.79 -   // hard coded, and reloads every time through the loop -- that way don't
    1.80 -   // need to save any regs used by core loop
    1.81 -volatile VMSQueueStruc  *_VMSWorkQ;
    1.82 -
    1.83  //==========================
    1.84  void
    1.85  VMS__init();
    1.86 @@ -190,6 +188,9 @@
    1.87  VMSReqst *
    1.88  VMS__take_top_request_from( VirtProcr *reqstingPr );
    1.89  
    1.90 +VMSReqst *
    1.91 +VMS__free_top_and_give_next_request_from( VirtProcr *procrWithReq );
    1.92 +
    1.93  inline void *
    1.94  VMS__take_sem_reqst_from( VMSReqst *req );
    1.95