# HG changeset patch # User Sean Halle # Date 1345974574 25200 # Node ID 0d04c3e608ccce6483356a2cf7883181b68cc36d # Parent eadb2ba022a0293c89ad2954e10aedef4b33ab74 Creating a new branch for development of the DKU Pattern diff -r eadb2ba022a0 -r 0d04c3e608cc SSR.c --- a/SSR.c Mon Mar 19 10:02:54 2012 -0700 +++ b/SSR.c Sun Aug 26 02:49:34 2012 -0700 @@ -603,6 +603,65 @@ } +//============================== DKU ================================ + +/*The DKU pattern is instantiated by registering a divider, a kernel, + * and an undivider. These are done by appropriate VMS_App__ calls. + *For now, think that things like WorkTable will want their own interface + * for divider and undivider.. so here, just do traditional DKU, with the + * DKUPiece data struct (include a field for passing info from divider + * to unidivider) + */ +void +VMS_App__register_DKU_divider( DKUID ID, DKUDividerFn dividerFn, + SlaveVP *animSlv ) + { + + } + +/*The kernel has no context, so it's created as a task, but it can + * communicate, so a suspendable task, just like in VSs. + *Will put this DKU into VSs first.. and thinking about forcing every + * language to support both tasks and VPs. + */ +void +VMS_App__register_DKU_kernel( DKUID ID, DKUKernelFn kernelFn, + SlaveVP *animSlv ) + { + + } + +void +VMS_App__register_DKU_undivider( DKUID ID, DKUUndividerFn undividerFn, + SlaveVP *animSlv ) + { + + } + +DKUInst * +VMS_DKU__make_DKU_Instance( DKUInstID DKU_INST_ID ) + { int oldSz, i; + DKUInstStruc **oldArray; + + DKUEnvironStruc *E = BLIS__BLISEnvironment->DKUEnvironment; + + if( E->numDKUInstances <= DKU_INST_ID) E->numDKUInstances = DKU_INST_ID+1; + if( DKU_INST_ID >= E->instArraySz ) + { //full, so make bigger + oldSz = E->instArraySz; + oldArray = E->DKUInstStrucs; + E->instArraySz *= 2; + E->DKUInstStrucs = malloc( E->instArraySz * sizeof(DKUInstStruc *) ); + for( i = 0; i < oldSz; i++ ) + { E->DKUInstStrucs[i] = oldArray[i]; + } + free( oldArray ); + } + E->DKUInstStrucs[ DKU_INST_ID ] = makeDKUInstStruc( DKU_INST_ID ); + return E->DKUInstStrucs[ DKU_INST_ID ]; + } + + //=========================================================================== // /*A function singleton is a function whose body executes exactly once, on a diff -r eadb2ba022a0 -r 0d04c3e608cc SSR.h --- a/SSR.h Mon Mar 19 10:02:54 2012 -0700 +++ b/SSR.h Sun Aug 26 02:49:34 2012 -0700 @@ -132,6 +132,18 @@ SSRSemEnv; +typedef struct _DKUPiece DKUPiece; + +typedef DKUPiece * (*DKUDividerFn ) ( DKUPiece * ); + +struct _DKUPiece + { + void *workData; + DKUPiece **subPieces; + void *infoForUndiv; //app creates own struct and casts + }; +//DKUPiece + typedef struct _TransListElem TransListElem; struct _TransListElem { @@ -225,6 +237,21 @@ SSR__receive_from_to( SlaveVP *sendPr, SlaveVP *receiveSlv ); + +//=========================== DKU ============================== +void +VMS_App__register_DKU_divider( DKUID ID, DKUDividerFn dividerFn, + SlaveVP *animSlv ); +void +VMS_App__register_DKU_kernel( DKUID ID, DKUKernelFn kernelFn, + SlaveVP *animSlv ); + +void +VMS_App__register_DKU_undivider( DKUID ID, DKUUndividerFn undividerFn, + SlaveVP *animSlv ); + + + //======================= Concurrency Stuff ====================== void SSR__start_fn_singleton( int32 singletonID, SlaveVP *animSlv );