# HG changeset patch # User Sean Halle # Date 1386713875 28800 # Node ID 9b0e4a786354e8e9c03992c4787e4d718ad1b583 # Parent ad931059d1c473e340a5d0afecb06202bc0b0d19 update Reo to o1island version, update PI and WL, add ABS wrapper lib diff -r ad931059d1c4 -r 9b0e4a786354 PR__PI.h --- a/PR__PI.h Sun Oct 06 11:26:20 2013 -0700 +++ b/PR__PI.h Tue Dec 10 14:17:55 2013 -0800 @@ -106,8 +106,20 @@ PR_PI__take_lang_reqst_from( req ) req->langReq void +PR_PI__make_slave_ready( SlaveVP *requestingSlv, void *_langEnv ); + +void +PR_PI__make_slave_ready_for_lang( SlaveVP *slave, int32 magicNum ); + +void PR_PI__resume_slave_in_PRServ( SlaveVP *slave ); +void +PR_PI__make_task_ready( void *_task, void *_langEnv ); + +void +PR_PI__handle_wait_for_langlets_work_to_end( SlaveVP *slave, void *langEnv ); + #define \ PR_PI__malloc PR_int__malloc #define \ diff -r ad931059d1c4 -r 9b0e4a786354 PR__WL.h --- a/PR__WL.h Sun Oct 06 11:26:20 2013 -0700 +++ b/PR__WL.h Tue Dec 10 14:17:55 2013 -0800 @@ -39,6 +39,12 @@ void PR__start(); +void +PR__set_app_info( char *info ); + +void +PR__set_input_info( char *info ); + PRProcess * PR__create_process( BirthFnPtr seed_Fn, void *seedData ); diff -r ad931059d1c4 -r 9b0e4a786354 langlets/abs_wrapper_library.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langlets/abs_wrapper_library.h Tue Dec 10 14:17:55 2013 -0800 @@ -0,0 +1,93 @@ +/* + * Copyright 2009 OpenSourceResearchInstitute.org + * Licensed under GNU General Public License version 2 + * + * Author: seanhalle@yahoo.com + * + */ + +#ifndef _PRDSL_WRAPPER_H +#define _PRDSL_WRAPPER_H + +#include + +//=========================================================================== + //uniquely identifies PRDSL -- should be a jenkins char-hash of "PRDSL" to int32 +#define PRDSL_MAGIC_NUMBER 0000000004 + +typedef struct _PRDSLTaskStub PRDSLTaskStub; + +//=========================================================================== + +/*This is PRDSL's "lang meta task" + *See the proto-runtime wiki entry to learn about "lang meta task" + *In essence, this holds all the meta information that PRDSL needs about a task + */ +struct _PRDSLTaskStub + { + void **args; //given to the birth Fn + int32 numBlockingProp; + PrivQueueStruc *dependentTasksQ; + bool32 isActive; //active after done adding propendents + bool32 canBeAProp; + + PRDSLTaskStub *parentTaskStub; //for liveness, for the wait construct + int32 numLiveChildTasks; + int32 numLiveChildVPs; + bool32 isWaitingForChildTasksToEnd; + bool32 isWaitingForChildThreadsToEnd; + bool32 isEnded; + +// int32 *taskID; //is in PRMetaTask, in prolog + }; + + +//======================= + +void +PRDSL__start( SlaveVP *seedSlv ); + +void +PRDSL__shutdown( SlaveVP *seedSlv ); + +void +PRDSL__wait_for_all_PRDSL_created_work_to_end( SlaveVP *seedSlv ); + +//======================= + +SlaveVP * +PRDSL__create_thread( BirthFnPtr fnPtr, void *initData, + SlaveVP *creatingThd ); + +void +PRDSL__end_thread( SlaveVP *thdToEnd ); + +//======================= + +#define PRDSL__malloc( numBytes, callingSlave ) PR_App__malloc( numBytes, callingSlave) + +#define PRDSL__free(ptrToFree, callingSlave ) PR_App__free( ptrToFree, callingSlave ) + + +//======================= +PRDSLTaskStub * +PRDSL__create_task_ready_to_run( BirthFnPtr birthFn, void *args, SlaveVP *animSlv); + +//inline int32 * +//PRDSL__create_taskID_of_size( int32 numInts, SlaveVP *animSlv ); + + +void +PRDSL__end_task( SlaveVP *animSlv ); + +//========================= +void +PRDSL__taskwait(SlaveVP *animSlv); + + +inline int32 * +PRDSL__give_self_taskID( SlaveVP *animSlv ); + +//=========================================================================== +#endif + diff -r ad931059d1c4 -r 9b0e4a786354 langlets/vreo_wrapper_library.h --- a/langlets/vreo_wrapper_library.h Sun Oct 06 11:26:20 2013 -0700 +++ b/langlets/vreo_wrapper_library.h Tue Dec 10 14:17:55 2013 -0800 @@ -10,41 +10,62 @@ #define _VREO_WRAPPER_H #include - +#include //uniquely identifies VSs -- should be a jenkins char-hash of "VSs" to int32 #define VReo_MAGIC_NUMBER 0000000003 //=========================================================================== typedef struct _VReoIsland VReoIsland; +typedef struct _VReoO1island VReoO1island; +typedef struct _VReoBridge VReoBridge; +typedef struct _VReoPartnerQStruct VReoPartnerQStruct; typedef bool32 (*VReoCheckerFn ) ( VReoIsland * ); typedef void (*VReoDoerFn ) ( VReoIsland * ); +typedef void (*VReoO1islandDoerFn) (VReoO1island *, VReoBridge*, VReoBridge*); //chg to list of bridges //=========================================================================== +typedef enum + { Island, + O1island, + VP + } +VReoRWType; -typedef struct +struct _VReoBridge { void *buffer; - bool32 portIsFull; + bool32 bridgeIsFull; SlaveVP *waitingReaderVP; //doubles as flag SlaveVP *waitingWriterVP; - void *reader; //either island or VP - void *writer; //either island or VP - + void *reader; //island, o1island, or VP + VReoRWType readerType; + void *writer; //island, o1island, or VP + VReoRWType writerType; + + //============ For Islands ============= int32 numReaderCheckerFns; - VReoCheckerFn *readerCheckerFns; //checkers triggered when port state changes + VReoCheckerFn *readerCheckerFns; //checkers triggered when bridge state changes VReoDoerFn *readerDoerFns; //corresponding doer functions int32 numWriterCheckerFns; - VReoCheckerFn *writerCheckerFns; //checkers triggered when port state changes - VReoDoerFn *writerDoerFns; //corresponding doer functions - } -VReoPort; - + VReoCheckerFn *writerCheckerFns; //checkers triggered when bridge state changes + VReoDoerFn *writerDoerFns; //corresponding doer functions + + //============ For O1islands ============= + VReoPartnerQStruct *readerPartnerQStruct; + VReoPartnerQStruct *writerPartnerQStruct; + //these queues are pointed to by partnerQStructs in other bridges + //the bridge is placed into these queues when no partner is found + PrivQueueStruc *readerOfferQ; + PrivQueueStruc *writerOfferQ; + }; +//VReoBridge + struct _VReoIsland { - int32 numPorts; - VReoPort **ports; //array of pointers to port structs + int32 numBridges; + VReoBridge **bridges; //array of pointers to bridge structs int32 numCheckerFns; VReoCheckerFn *checkerFns; //checkers triggered when state changes @@ -54,6 +75,33 @@ }; //VReoIsland + +struct _VReoO1island + { + int32 numBridges; + VReoBridge **bridges; //array of pointers to bridge structs + +// VReoO1islandCheckerFn checkerFn; //checker triggered when state changes +// VReoO1islandDoerFn *doerFns; //corresponding doer functions + + //During search, have to save last Q checked inside each node of + // Qstruct.. + }; +//VReoO1island + +/*This is expected to change in future.. just quick and simple to get + * first version of optimization working. In particular, the way the + * doer functions are handled should change. Not clear how to handle them + * at this point. + */ +struct _VReoPartnerQStruct + { + int32 numQs; + PrivQueueStruc **partnerQs; //array of partner Qs, hold bridge ptrs + VReoO1islandDoerFn *doerFns; //array of ptrs to doer Fns + }; +//VReoPartnerQStruct + typedef struct _VReoListElem VReoListElem; struct _VReoListElem @@ -65,13 +113,16 @@ typedef struct { - int32 numPorts; // - VReoPort *ports; //array of port structs - VReoPort **boundaryPorts; + int32 numBridges; // + VReoBridge *bridges; //array of bridge structs + VReoBridge **boundaryBridges; int32 numIslands; VReoIsland *islands; //array of island structs -- no pointers + int32 numO1islands; + VReoO1island *o1islands; //array of O1island structs -- no pointers + int32 numVPs; VReoListElem *VPs; @@ -106,10 +157,10 @@ //======================= void -VReo__put_into_port( void *itemToPut, VReoPort *port, SlaveVP *callingVP ); +VReo__put_into_bridge( void *itemToPut, VReoBridge *bridge, SlaveVP *callingVP ); void * -VReo__get_from_port( VReoPort *port, SlaveVP *callingVP ); +VReo__get_from_bridge( VReoBridge *bridge, SlaveVP *callingVP ); @@ -120,6 +171,12 @@ void VReo__end_VP( SlaveVP *VPToEnd ); +//================ For use by generated circuit code ================= +void +o1islandReadBridgeToWrittenBridgeDoer( VReoO1island *o1island, + VReoBridge *readBridge, VReoBridge *writtenBridge ); + + //=========================================================================== #endif /* _VReo_H */