changeset 17:07d1e42f4379 ML_lib

Merge DKU version with Reo Opt1 version
author Sean Halle <seanhalle@yahoo.com>
date Sat, 29 Mar 2014 06:18:57 -0700
parents c752e62ad9c5 9b0e4a786354
children
files langlets/PRServ__wrapper_library.h
diffstat 5 files changed, 188 insertions(+), 20 deletions(-) [+]
line diff
     1.1 --- a/PR__PI.h	Sat Mar 29 06:18:08 2014 -0700
     1.2 +++ b/PR__PI.h	Sat Mar 29 06:18:57 2014 -0700
     1.3 @@ -106,8 +106,20 @@
     1.4  PR_PI__take_lang_reqst_from( req )   req->langReq
     1.5  
     1.6  void
     1.7 +PR_PI__make_slave_ready( SlaveVP *requestingSlv, void *_langEnv );
     1.8 +
     1.9 +void
    1.10 +PR_PI__make_slave_ready_for_lang( SlaveVP *slave, int32 magicNum );
    1.11 +
    1.12 +void
    1.13  PR_PI__resume_slave_in_PRServ( SlaveVP *slave );
    1.14  
    1.15 +void
    1.16 +PR_PI__make_task_ready( void *_task, void *_langEnv );
    1.17 +
    1.18 +void
    1.19 +PR_PI__handle_wait_for_langlets_work_to_end( SlaveVP *slave, void *langEnv );
    1.20 +
    1.21  #define \
    1.22  PR_PI__malloc   PR_int__malloc
    1.23  #define \
     2.1 --- a/PR__WL.h	Sat Mar 29 06:18:08 2014 -0700
     2.2 +++ b/PR__WL.h	Sat Mar 29 06:18:57 2014 -0700
     2.3 @@ -39,6 +39,12 @@
     2.4  void
     2.5  PR__start();
     2.6  
     2.7 +void
     2.8 +PR__set_app_info( char *info );
     2.9 +
    2.10 +void
    2.11 +PR__set_input_info( char *info );
    2.12 +
    2.13  PRProcess *
    2.14  PR__create_process( BirthFnPtr seed_Fn, void *seedData );
    2.15  
     3.1 --- a/langlets/PRServ__wrapper_library.h	Sat Mar 29 06:18:08 2014 -0700
     3.2 +++ b/langlets/PRServ__wrapper_library.h	Sat Mar 29 06:18:57 2014 -0700
     3.3 @@ -135,7 +135,7 @@
     3.4  PRServ__DKU_make_empty_DKU_piece();
     3.5  
     3.6  DKUPiece *
     3.7 -PRServ__DKU_make_child_piece_from( pieceToDivide );
     3.8 +PRServ__DKU_make_child_piece_from( DKUPiece *pieceToDivide );
     3.9  
    3.10  void
    3.11  PRServ__DKU_set_root_piece_maker( DKUInstance *dkuInstance, 
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/langlets/abs_wrapper_library.h	Sat Mar 29 06:18:57 2014 -0700
     4.3 @@ -0,0 +1,93 @@
     4.4 +/*
     4.5 + *  Copyright 2009 OpenSourceResearchInstitute.org
     4.6 + *  Licensed under GNU General Public License version 2
     4.7 + *
     4.8 + * Author: seanhalle@yahoo.com
     4.9 + *
    4.10 + */
    4.11 +
    4.12 +#ifndef _PRDSL_WRAPPER_H
    4.13 +#define	_PRDSL_WRAPPER_H
    4.14 +
    4.15 +#include <PR__include/PR__structs__common.h>
    4.16 +
    4.17 +//===========================================================================
    4.18 +   //uniquely identifies PRDSL -- should be a jenkins char-hash of "PRDSL" to int32
    4.19 +#define PRDSL_MAGIC_NUMBER 0000000004
    4.20 +
    4.21 +typedef struct _PRDSLTaskStub  PRDSLTaskStub;
    4.22 +
    4.23 +//===========================================================================
    4.24 +
    4.25 +/*This is PRDSL's "lang meta task"
    4.26 + *See the proto-runtime wiki entry to learn about "lang meta task"
    4.27 + *In essence, this holds all the meta information that PRDSL needs about a task
    4.28 + */
    4.29 +struct _PRDSLTaskStub
    4.30 + {
    4.31 +   void           **args;            //given to the birth Fn
    4.32 +   int32            numBlockingProp;
    4.33 +   PrivQueueStruc  *dependentTasksQ;
    4.34 +   bool32           isActive; //active after done adding propendents
    4.35 +   bool32           canBeAProp;
    4.36 +   
    4.37 +   PRDSLTaskStub *parentTaskStub; //for liveness, for the wait construct
    4.38 +   int32          numLiveChildTasks;
    4.39 +   int32          numLiveChildVPs;
    4.40 +   bool32         isWaitingForChildTasksToEnd;
    4.41 +   bool32         isWaitingForChildThreadsToEnd;
    4.42 +   bool32         isEnded;
    4.43 +   
    4.44 +//   int32         *taskID; //is in PRMetaTask, in prolog
    4.45 + };
    4.46 +
    4.47 +
    4.48 +//=======================
    4.49 +
    4.50 +void
    4.51 +PRDSL__start( SlaveVP *seedSlv );
    4.52 +
    4.53 +void
    4.54 +PRDSL__shutdown( SlaveVP *seedSlv );
    4.55 +
    4.56 +void
    4.57 +PRDSL__wait_for_all_PRDSL_created_work_to_end( SlaveVP *seedSlv );
    4.58 +
    4.59 +//=======================
    4.60 +
    4.61 +SlaveVP *
    4.62 +PRDSL__create_thread( BirthFnPtr fnPtr,   void *initData,
    4.63 +                                               SlaveVP *creatingThd );
    4.64 +
    4.65 +void
    4.66 +PRDSL__end_thread( SlaveVP *thdToEnd );
    4.67 +
    4.68 +//=======================
    4.69 +
    4.70 +#define PRDSL__malloc( numBytes, callingSlave ) PR_App__malloc( numBytes, callingSlave)
    4.71 +
    4.72 +#define PRDSL__free(ptrToFree, callingSlave ) PR_App__free( ptrToFree, callingSlave )
    4.73 +
    4.74 +
    4.75 +//=======================
    4.76 +PRDSLTaskStub *
    4.77 +PRDSL__create_task_ready_to_run( BirthFnPtr birthFn, void *args, SlaveVP *animSlv);
    4.78 +
    4.79 +//inline int32 *
    4.80 +//PRDSL__create_taskID_of_size( int32 numInts, SlaveVP *animSlv );
    4.81 +
    4.82 +
    4.83 +void
    4.84 +PRDSL__end_task( SlaveVP *animSlv );
    4.85 +
    4.86 +//=========================
    4.87 +void
    4.88 +PRDSL__taskwait(SlaveVP *animSlv);
    4.89 +
    4.90 +
    4.91 +inline int32 *
    4.92 +PRDSL__give_self_taskID( SlaveVP *animSlv );
    4.93 +
    4.94 +//===========================================================================
    4.95 +#endif	
    4.96 +
     5.1 --- a/langlets/vreo_wrapper_library.h	Sat Mar 29 06:18:08 2014 -0700
     5.2 +++ b/langlets/vreo_wrapper_library.h	Sat Mar 29 06:18:57 2014 -0700
     5.3 @@ -10,41 +10,62 @@
     5.4  #define	_VREO_WRAPPER_H
     5.5  
     5.6  #include <PR__include/PR__structs__common.h>
     5.7 -
     5.8 +#include <PR__include/prqueue.h>
     5.9     //uniquely identifies VSs -- should be a jenkins char-hash of "VSs" to int32
    5.10  #define VReo_MAGIC_NUMBER 0000000003
    5.11  
    5.12  //===========================================================================
    5.13  typedef struct _VReoIsland VReoIsland;
    5.14 +typedef struct _VReoO1island VReoO1island;
    5.15 +typedef struct _VReoBridge   VReoBridge;
    5.16 +typedef struct _VReoPartnerQStruct VReoPartnerQStruct;
    5.17  
    5.18  typedef bool32 (*VReoCheckerFn ) ( VReoIsland * );
    5.19  typedef void   (*VReoDoerFn )    ( VReoIsland * );
    5.20 +typedef void   (*VReoO1islandDoerFn) (VReoO1island *, VReoBridge*, VReoBridge*); //chg to list of bridges
    5.21  //===========================================================================
    5.22 +typedef enum
    5.23 + { Island,
    5.24 +   O1island,
    5.25 +   VP
    5.26 + }
    5.27 +VReoRWType;
    5.28  
    5.29 -typedef struct
    5.30 +struct _VReoBridge
    5.31   {
    5.32     void          *buffer;
    5.33 -   bool32         portIsFull;
    5.34 +   bool32         bridgeIsFull;
    5.35     SlaveVP       *waitingReaderVP;   //doubles as flag
    5.36     SlaveVP       *waitingWriterVP;
    5.37     
    5.38 -   void          *reader;  //either island or VP
    5.39 -   void          *writer;  //either island or VP
    5.40 -   
    5.41 +   void          *reader;  //island, o1island, or VP
    5.42 +   VReoRWType     readerType;
    5.43 +   void          *writer;  //island, o1island, or VP
    5.44 +   VReoRWType     writerType;
    5.45 +
    5.46 +   //============  For Islands  =============
    5.47     int32          numReaderCheckerFns;  
    5.48 -   VReoCheckerFn *readerCheckerFns;     //checkers triggered when port state changes
    5.49 +   VReoCheckerFn *readerCheckerFns;     //checkers triggered when bridge state changes
    5.50     VReoDoerFn    *readerDoerFns;        //corresponding doer functions   
    5.51  
    5.52     int32          numWriterCheckerFns;  
    5.53 -   VReoCheckerFn *writerCheckerFns;     //checkers triggered when port state changes
    5.54 -   VReoDoerFn    *writerDoerFns;        //corresponding doer functions   
    5.55 - }
    5.56 -VReoPort;
    5.57 -
    5.58 +   VReoCheckerFn *writerCheckerFns;     //checkers triggered when bridge state changes
    5.59 +   VReoDoerFn    *writerDoerFns;        //corresponding doer functions
    5.60 +   
    5.61 +   //============  For O1islands  =============
    5.62 +   VReoPartnerQStruct *readerPartnerQStruct;
    5.63 +   VReoPartnerQStruct *writerPartnerQStruct;
    5.64 +      //these queues are pointed to by partnerQStructs in other bridges
    5.65 +      //the bridge is placed into these queues when no partner is found
    5.66 +   PrivQueueStruc     *readerOfferQ; 
    5.67 +   PrivQueueStruc     *writerOfferQ;
    5.68 + };
    5.69 +//VReoBridge
    5.70 + 
    5.71  struct _VReoIsland
    5.72   {
    5.73 -   int32          numPorts;
    5.74 -   VReoPort     **ports;          //array of pointers to port structs
    5.75 +   int32          numBridges;
    5.76 +   VReoBridge     **bridges;          //array of pointers to bridge structs
    5.77     
    5.78     int32          numCheckerFns;
    5.79     VReoCheckerFn *checkerFns;     //checkers triggered when state changes
    5.80 @@ -54,6 +75,33 @@
    5.81   };
    5.82  //VReoIsland
    5.83  
    5.84 +
    5.85 +struct _VReoO1island
    5.86 + {
    5.87 +   int32          numBridges;
    5.88 +   VReoBridge     **bridges;          //array of pointers to bridge structs
    5.89 +   
    5.90 +//   VReoO1islandCheckerFn  checkerFn; //checker triggered when state changes
    5.91 +//   VReoO1islandDoerFn    *doerFns;        //corresponding doer functions   
    5.92 +   
    5.93 +   //During search, have to save last Q checked inside each node of 
    5.94 +   // Qstruct..
    5.95 + };
    5.96 +//VReoO1island
    5.97 +
    5.98 +/*This is expected to change in future..  just quick and simple to get
    5.99 + * first version of optimization working.  In particular, the way the
   5.100 + * doer functions are handled should change.  Not clear how to handle them
   5.101 + * at this point.
   5.102 + */
   5.103 +struct _VReoPartnerQStruct
   5.104 + {
   5.105 +   int32             numQs;
   5.106 +   PrivQueueStruc  **partnerQs;   //array of partner Qs, hold bridge ptrs
   5.107 +   VReoO1islandDoerFn *doerFns;     //array of ptrs to doer Fns
   5.108 +  };
   5.109 +//VReoPartnerQStruct
   5.110 + 
   5.111  typedef struct _VReoListElem VReoListElem;
   5.112   
   5.113  struct _VReoListElem
   5.114 @@ -65,13 +113,16 @@
   5.115   
   5.116  typedef struct
   5.117   {
   5.118 -   int32        numPorts; //
   5.119 -   VReoPort    *ports;    //array of port structs
   5.120 -   VReoPort   **boundaryPorts;
   5.121 +   int32        numBridges; //
   5.122 +   VReoBridge    *bridges;    //array of bridge structs
   5.123 +   VReoBridge   **boundaryBridges;
   5.124     
   5.125     int32        numIslands;
   5.126     VReoIsland  *islands;  //array of island structs -- no pointers
   5.127     
   5.128 +   int32        numO1islands;
   5.129 +   VReoO1island  *o1islands;  //array of O1island structs -- no pointers
   5.130 +   
   5.131     int32        numVPs;
   5.132     VReoListElem *VPs;
   5.133     
   5.134 @@ -106,10 +157,10 @@
   5.135  //=======================
   5.136  
   5.137  void
   5.138 -VReo__put_into_port( void *itemToPut, VReoPort *port, SlaveVP *callingVP );
   5.139 +VReo__put_into_bridge( void *itemToPut, VReoBridge *bridge, SlaveVP *callingVP );
   5.140  
   5.141  void *
   5.142 -VReo__get_from_port( VReoPort *port, SlaveVP *callingVP );
   5.143 +VReo__get_from_bridge( VReoBridge *bridge, SlaveVP *callingVP );
   5.144  
   5.145  
   5.146  
   5.147 @@ -120,6 +171,12 @@
   5.148  void
   5.149  VReo__end_VP( SlaveVP *VPToEnd );
   5.150  
   5.151 +//================  For use by generated circuit code  =================
   5.152 +void
   5.153 +o1islandReadBridgeToWrittenBridgeDoer( VReoO1island *o1island, 
   5.154 +                      VReoBridge *readBridge, VReoBridge *writtenBridge );
   5.155 +
   5.156 +
   5.157  //===========================================================================
   5.158  #endif	/* _VReo_H */
   5.159