PiSDFGraph* initPisdf_test6(Archi* archi, Stack* stack){ PiSDFGraph* top = CREATE(stack, PiSDFGraph)( 0,0,0,0,0,1, archi, stack); top->addHierVertex( "top", test6(archi, stack), 0, 0, 0); return top; }
SRDAGGraph* result_Test6(PiSDFGraph* pisdf, Stack* stack){ SRDAGGraph* srdag = CREATE(stack, SRDAGGraph)(stack); PiSDFGraph* topPisdf = pisdf->getBody(0)->getSubGraph(); SRDAGVertex* vxA = srdag->addVertex(topPisdf->getBody(0)); SRDAGVertex* vxB = srdag->addVertex(topPisdf->getBody(1)); SRDAGVertex* vxH0 = srdag->addVertex(topPisdf->getBody(2)->getSubGraph()->getBody(0)); SRDAGVertex* vxH1 = srdag->addVertex(topPisdf->getBody(2)->getSubGraph()->getBody(0)); SRDAGVertex* vxH2 = srdag->addVertex(topPisdf->getBody(2)->getSubGraph()->getBody(0)); SRDAGVertex* vxH3 = srdag->addVertex(topPisdf->getBody(2)->getSubGraph()->getBody(0)); SRDAGVertex* vxJ = srdag->addJoin(4); SRDAGVertex* vxF = srdag->addFork(4); srdag->addEdge( vxA, 0, vxF, 0, 4); srdag->addEdge( vxF , 0, vxH0, 0, 1); srdag->addEdge( vxF , 1, vxH1, 0, 1); srdag->addEdge( vxF , 2, vxH2, 0, 1); srdag->addEdge( vxF , 3, vxH3, 0, 1); srdag->addEdge( vxH0, 0, vxJ , 0, 1); srdag->addEdge( vxH1, 0, vxJ , 1, 1); srdag->addEdge( vxH2, 0, vxJ , 2, 1); srdag->addEdge( vxH3, 0, vxJ , 3, 1); srdag->addEdge( vxJ, 0, vxB, 0, 4); return srdag; }
PiSDFGraph* test5(Archi* archi, Stack* stack){ PiSDFGraph* graph = CREATE(stack, PiSDFGraph)( /*Edges*/ 3, /*Params*/ 0, /*InIf*/ 0, /*OutIf*/ 0, /*Config*/ 0, /*Normal*/ 4, archi, stack); // Parameters. // Configure vertices // Other vertices PiSDFVertex *vxA = graph->addBodyVertex( "A", /*Fct*/ 19, /*In*/ 0, /*Out*/ 1, /*Par*/ 0); PiSDFVertex *vxB = graph->addBodyVertex( "B", /*Fct*/ 20, /*In*/ 1, /*Out*/ 1, /*Par*/ 0); PiSDFVertex *vxCheck = graph->addBodyVertex( "Check", /*Fct*/ 22, /*In*/ 1, /*Out*/ 0, /*Par*/ 0); PiSDFVertex *vxH = graph->addHierVertex( "H_top", /*SubGraph*/ test5_sub(archi, stack), /*In*/ 1, /*Out*/ 1, /*Par*/ 0); // Edges. graph->connect( /*Src*/ vxA, /*SrcPrt*/ 0, /*Prod*/ "1", /*Snk*/ vxH, /*SnkPrt*/ 0, /*Cons*/ "2", /*Delay*/ "0", 0); graph->connect( /*Src*/ vxH, /*SrcPrt*/ 0, /*Prod*/ "2", /*Snk*/ vxB, /*SnkPrt*/ 0, /*Cons*/ "1", /*Delay*/ "0", 0); graph->connect( /*Src*/ vxB, /*SrcPrt*/ 0, /*Prod*/ "1", /*Snk*/ vxCheck, /*SnkPrt*/ 0, /*Cons*/ "2", /*Delay*/ "0", 0); // Timings vxA->isExecutableOnAllPE(); vxA->setTimingOnType(0, "10", stack); vxB->isExecutableOnAllPE(); vxB->setTimingOnType(0, "10", stack); vxCheck->isExecutableOnPE(0); vxCheck->setTimingOnType(0, "10", stack); return graph; }
SRDAGGraph* result_Test0_1(PiSDFGraph* pisdf, Stack* stack){ SRDAGGraph* srdag = CREATE(stack, SRDAGGraph)(stack); PiSDFGraph* topPisdf = pisdf->getBody(0)->getSubGraph(); SRDAGVertex* vxC = srdag->addVertex(topPisdf->getConfig(0)); SRDAGVertex* vxA = srdag->addVertex(topPisdf->getBody(0)); SRDAGVertex* vxB0 = srdag->addVertex(topPisdf->getBody(1)); SRDAGVertex* vxB1 = srdag->addVertex(topPisdf->getBody(1)); SRDAGVertex* vxCheck = srdag->addVertex(topPisdf->getBody(2)); SRDAGVertex* vxF = srdag->addFork(2); SRDAGVertex* vxJ = srdag->addJoin(2); vxB0->addInParam(0, 1); vxB1->addInParam(0, 1); vxCheck->addInParam(0, 1); srdag->addEdge( vxA, 0, vxF, 0, 2); srdag->addEdge( vxF, 0, vxB0, 0, 1); srdag->addEdge( vxF, 1, vxB1, 0, 1); srdag->addEdge( vxB0, 0, vxJ, 0, 1); srdag->addEdge( vxB1, 0, vxJ, 1, 1); srdag->addEdge( vxJ, 0, vxCheck, 0, 2); return srdag; }
/** * This is the method you need to call to build a complete PiSDF graph. */ PiSDFGraph* init_daq_fft(Archi* archi, Stack* stack) { PiSDFGraph* top = CREATE(stack, PiSDFGraph)( /*Edges*/ 0, /*Params*/ 0, /*InputIf*/ 0, /*OutputIf*/ 0, /*Config*/ 0, /*Body*/ 1, /*Archi*/ archi, /*Stack*/ stack); top->addHierVertex( /*Name*/ "top", /*Graph*/ daq_fft(archi, stack), /*InputIf*/ 0, /*OutputIf*/ 0, /*Params*/ 0); return top; }
SRDAGGraph* result_Test0_2(PiSDFGraph* pisdf, Stack* stack){ SRDAGGraph* srdag = CREATE(stack, SRDAGGraph)(stack); PiSDFGraph* topPisdf = pisdf->getBody(0)->getSubGraph(); SRDAGVertex* vxC = srdag->addVertex(topPisdf->getConfig(0)); SRDAGVertex* vxA = srdag->addVertex(topPisdf->getBody(0)); SRDAGVertex* vxB = srdag->addVertex(topPisdf->getBody(1)); SRDAGVertex* vxCheck = srdag->addVertex(topPisdf->getBody(2)); vxB->addInParam(0, 2); vxCheck->addInParam(0, 2); srdag->addEdge( vxA, 0, vxB, 0, 2); srdag->addEdge( vxB, 0, vxCheck, 0, 2); return srdag; }
PiSDFGraph* test6_sub(Archi* archi, Stack* stack){ PiSDFGraph* graph = CREATE(stack, PiSDFGraph)( /*Edges*/ 2, /*Params*/ 0, /*InIf*/ 1, /*OutIf*/ 1, /*Config*/ 0, /*Normal*/ 1, archi, stack); // Parameters. // Configure vertices // Interfaces PiSDFVertex *ifIn = graph->addInputIf( "in", 0 /*Par*/); PiSDFVertex *ifOut = graph->addOutputIf( "out", 0 /*Par*/); // Other vertices PiSDFVertex *vxH = graph->addBodyVertex( "H", /*Fct*/ 24, /*In*/ 1, /*Out*/ 1, /*Par*/ 0); // Edges. graph->connect( /*Src*/ ifIn, /*SrcPrt*/ 0, /*Prod*/ "2", /*Snk*/ vxH, /*SnkPrt*/ 0, /*Cons*/ "1", /*Delay*/ "0", 0); graph->connect( /*Src*/ vxH, /*SrcPrt*/ 0, /*Prod*/ "1", /*Snk*/ ifOut, /*SnkPrt*/ 0, /*Cons*/ "2", /*Delay*/ "0", 0); // Timings vxH->isExecutableOnAllPE(); vxH->setTimingOnType(0, "10", stack); // Subgraphs return graph; }
int main(int argc, char* argv[]){ SpiderConfig cfg; ExecutionStat stat; initActors(); DynStack pisdfStack("PisdfStack"); DynStack archiStack("ArchiStack"); #define SH_MEM 0x00500000 PlatformK2Arm platform(2, 4, SH_MEM, &archiStack, radix2_fft_fcts, N_FCT_RADIX2_FFT); Archi* archi = platform.getArchi(); cfg.memAllocType = MEMALLOC_SPECIAL_ACTOR; cfg.memAllocStart = (void*)0; cfg.memAllocSize = SH_MEM; cfg.schedulerType = SCHEDULER_LIST; cfg.srdagStack.type = STACK_DYNAMIC; cfg.srdagStack.name = "SrdagStack"; cfg.srdagStack.size = 0; cfg.srdagStack.start = 0; cfg.transfoStack.type = STACK_DYNAMIC; cfg.transfoStack.name = "TransfoStack"; cfg.transfoStack.size = 0; cfg.transfoStack.start = 0; spider_init(cfg); printf("Start\n"); try{ pisdfStack.freeAll(); PiSDFGraph *topPisdf = init_Radix2_fft(archi, &pisdfStack); topPisdf->print("topPisdf.gv"); Platform::get()->rstTime(); spider_launch(archi, topPisdf); spider_printGantt(archi, spider_getLastSRDAG(), "radixFFT_2.pgantt", "latex.tex", &stat); spider_getLastSRDAG()->print("radixFFT_2.gv"); printf("EndTime = %ld us\n", stat.globalEndTime/1000); printf("Memory use = "); if(stat.memoryUsed < 1024) printf("\t%5.1f B", stat.memoryUsed/1.); else if(stat.memoryUsed < 1024*1024) printf("\t%5.1f KB", stat.memoryUsed/1024.); else if(stat.memoryUsed < 1024*1024*1024) printf("\t%5.1f MB", stat.memoryUsed/1024./1024.); else printf("\t%5.1f GB", stat.memoryUsed/1024./1024./1024.); printf("\n"); printf("Actors:\n"); for(int j=0; j<stat.nbActor; j++){ printf("\t%18s:", stat.actors[j]->getName()); for(int k=0; k<archi->getNPETypes(); k++) printf("\t%8ld (x%3ld)", stat.actorTimes[j][k]/stat.actorIterations[j][k], stat.actorIterations[j][k]); printf("\n"); } free_Radix2_fft(topPisdf, &pisdfStack); }catch(const char* s){ printf("Exception : %s\n", s); } printf("finished\n"); spider_free(); return 0; }
// Method building PiSDFGraphcostParallel PiSDFGraph* costParallel(Archi* archi, Stack* stack) { PiSDFGraph* graph = CREATE(stack, PiSDFGraph)( /*Edges*/ 18, /*Params*/ 9, /*InputIf*/ 5, /*OutputIf*/ 1, /*Config*/ 0, /*Body*/ 9, /*Archi*/ archi, /*Stack*/ stack); /* Parameters */ PiSDFParam *param_nIter = graph->addHeritedParam("nIter", 0); PiSDFParam *param_height = graph->addHeritedParam("height", 1); PiSDFParam *param_width = graph->addHeritedParam("width", 2); PiSDFParam *param_maxDisp = graph->addHeritedParam("maxDisp", 3); PiSDFParam *param_minDisp = graph->addHeritedParam("minDisp", 4); PiSDFParam *param_truncValue = graph->addHeritedParam("truncValue", 5); PiSDFParam *param_scale = graph->addHeritedParam("scale", 6); PiSDFParam *param_size = graph->addDependentParam("size", "height*width"); PiSDFParam *param_nDisp = graph->addDependentParam("nDisp", "maxDisp-minDisp+1"); /* Vertices */ PiSDFVertex* if_cenL = graph->addInputIf( /*Name*/ "if_cenL", /*InParam*/ 1); if_cenL->addInParam(0, param_size); PiSDFVertex* if_cenR = graph->addInputIf( /*Name*/ "if_cenR", /*InParam*/ 1); if_cenR->addInParam(0, param_size); PiSDFVertex* if_grayL = graph->addInputIf( /*Name*/ "if_grayL", /*InParam*/ 1); if_grayL->addInParam(0, param_size); PiSDFVertex* if_grayR = graph->addInputIf( /*Name*/ "if_grayR", /*InParam*/ 1); if_grayR->addInParam(0, param_size); PiSDFVertex* if_rgb = graph->addInputIf( /*Name*/ "if_rgb", /*InParam*/ 1); if_rgb->addInParam(0, param_size); PiSDFVertex* bo_Br_rgb = graph->addSpecialVertex( /*Type*/ PISDF_SUBTYPE_BROADCAST, /*InData*/ 1, /*OutData*/ 2, /*InParam*/ 1); bo_Br_rgb->addInParam(0, param_size); PiSDFVertex* bo_GenIx = graph->addBodyVertex( /*Name*/ "GenIx", /*FctId*/ COSTPARALLEL_GENIX_FCT, /*InData*/ 0, /*OutData*/ 1, /*InParam*/ 1); bo_GenIx->addInParam(0, param_nIter); bo_GenIx->isExecutableOnPE(CORE_ARM0); bo_GenIx->setTimingOnType(CORE_TYPE_ARM, "3330", stack); PiSDFVertex* bo_GenDisp = graph->addBodyVertex( /*Name*/ "GenDisp", /*FctId*/ COSTPARALLEL_GENDISP_FCT, /*InData*/ 0, /*OutData*/ 1, /*InParam*/ 2); bo_GenDisp->addInParam(0, param_minDisp); bo_GenDisp->addInParam(1, param_maxDisp); bo_GenDisp->isExecutableOnPE(CORE_ARM0); bo_GenDisp->setTimingOnType(CORE_TYPE_ARM, "4025", stack); PiSDFVertex* bo_VWeights = graph->addBodyVertex( /*Name*/ "VWeights", /*FctId*/ COSTPARALLEL_VWEIGHTS_FCT, /*InData*/ 2, /*OutData*/ 1, /*InParam*/ 2); bo_VWeights->addInParam(0, param_height); bo_VWeights->addInParam(1, param_width); // bo_VWeights->isExecutableOnPE(CORE_ARM0); bo_VWeights->isExecutableOnPE(CORE_DSP0); bo_VWeights->isExecutableOnPE(CORE_DSP1); bo_VWeights->isExecutableOnPE(CORE_DSP2); bo_VWeights->isExecutableOnPE(CORE_DSP3); bo_VWeights->isExecutableOnPE(CORE_DSP4); bo_VWeights->isExecutableOnPE(CORE_DSP5); bo_VWeights->isExecutableOnPE(CORE_DSP6); bo_VWeights->isExecutableOnPE(CORE_DSP7); bo_VWeights->setTimingOnType(CORE_TYPE_C6X, "58039643", stack); bo_VWeights->setTimingOnType(CORE_TYPE_ARM, "219177142", stack); PiSDFVertex* bo_HWeight = graph->addBodyVertex( /*Name*/ "HWeight", /*FctId*/ COSTPARALLEL_HWEIGHT_FCT, /*InData*/ 2, /*OutData*/ 1, /*InParam*/ 2); bo_HWeight->addInParam(0, param_height); bo_HWeight->addInParam(1, param_width); // bo_HWeight->isExecutableOnPE(CORE_ARM0); bo_HWeight->isExecutableOnPE(CORE_DSP0); bo_HWeight->isExecutableOnPE(CORE_DSP1); bo_HWeight->isExecutableOnPE(CORE_DSP2); bo_HWeight->isExecutableOnPE(CORE_DSP3); bo_HWeight->isExecutableOnPE(CORE_DSP4); bo_HWeight->isExecutableOnPE(CORE_DSP5); bo_HWeight->isExecutableOnPE(CORE_DSP6); bo_HWeight->isExecutableOnPE(CORE_DSP7); bo_HWeight->setTimingOnType(CORE_TYPE_C6X, "57467063", stack); bo_HWeight->setTimingOnType(CORE_TYPE_ARM, "217559830", stack); PiSDFVertex* bo_CostConstruction = graph->addBodyVertex( /*Name*/ "CostConstruction", /*FctId*/ COSTPARALLEL_COSTCONSTRUCTION_FCT, /*InData*/ 5, /*OutData*/ 1, /*InParam*/ 3); bo_CostConstruction->addInParam(0, param_truncValue); bo_CostConstruction->addInParam(1, param_height); bo_CostConstruction->addInParam(2, param_width); // bo_CostConstruction->isExecutableOnPE(CORE_ARM0); bo_CostConstruction->isExecutableOnPE(CORE_DSP0); bo_CostConstruction->isExecutableOnPE(CORE_DSP1); bo_CostConstruction->isExecutableOnPE(CORE_DSP2); bo_CostConstruction->isExecutableOnPE(CORE_DSP3); bo_CostConstruction->isExecutableOnPE(CORE_DSP4); bo_CostConstruction->isExecutableOnPE(CORE_DSP5); bo_CostConstruction->isExecutableOnPE(CORE_DSP6); bo_CostConstruction->isExecutableOnPE(CORE_DSP7); bo_CostConstruction->setTimingOnType(CORE_TYPE_C6X, "39526772", stack); bo_CostConstruction->setTimingOnType(CORE_TYPE_ARM, "237452231", stack); PiSDFVertex* if_rawDisparity = graph->addOutputIf( /*Name*/ "if_rawDisparity", /*InParam*/ 1); if_rawDisparity->addInParam(0, param_size); PiSDFVertex* bo_Br_Ix = graph->addSpecialVertex( /*Type*/ PISDF_SUBTYPE_BROADCAST, /*InData*/ 1, /*OutData*/ 3, /*InParam*/ 1); bo_Br_Ix->addInParam(0, param_nIter); PiSDFVertex* bo_Br_Disp = graph->addSpecialVertex( /*Type*/ PISDF_SUBTYPE_BROADCAST, /*InData*/ 1, /*OutData*/ 2, /*InParam*/ 1); bo_Br_Disp->addInParam(0, param_nDisp); PiSDFVertex* bo_DispComp = graph->addHierVertex( /*Name*/ "DispComp", /*Graph*/ DispComp(archi, stack), /*InData*/ 5, /*OutData*/ 1, /*InParam*/ 6); bo_DispComp->addInParam(0, param_height); bo_DispComp->addInParam(1, param_width); bo_DispComp->addInParam(2, param_nIter); bo_DispComp->addInParam(3, param_scale); bo_DispComp->addInParam(4, param_minDisp); bo_DispComp->addInParam(5, param_maxDisp); /* Edges */ graph->connect( /*Src*/ bo_DispComp, /*SrcPrt*/ 0, /*Prod*/ "(height*width)*1", /*Snk*/ if_rawDisparity, /*SnkPrt*/ 0, /*Cons*/ "(size)*1", /*Delay*/ "0",0); graph->connect( /*Src*/ bo_CostConstruction, /*SrcPrt*/ 0, /*Prod*/ "(height*width)*1", /*Snk*/ bo_DispComp, /*SnkPrt*/ 4, /*Cons*/ "(height*width*(maxDisp-minDisp+1))*1", /*Delay*/ "0",0); graph->connect( /*Src*/ bo_VWeights, /*SrcPrt*/ 0, /*Prod*/ "(height*width)*1", /*Snk*/ bo_DispComp, /*SnkPrt*/ 1, /*Cons*/ "(height*width*nIter)*1", /*Delay*/ "0",0); graph->connect( /*Src*/ bo_HWeight, /*SrcPrt*/ 0, /*Prod*/ "(height*width)*1", /*Snk*/ bo_DispComp, /*SnkPrt*/ 2, /*Cons*/ "(height*width*nIter)*1", /*Delay*/ "0",0); graph->connect( /*Src*/ if_rgb, /*SrcPrt*/ 0, /*Prod*/ "(size)*3", /*Snk*/ bo_Br_rgb, /*SnkPrt*/ 0, /*Cons*/ "(size)*3", /*Delay*/ "0",0); graph->connect( /*Src*/ bo_GenIx, /*SrcPrt*/ 0, /*Prod*/ "(nIter)*1", /*Snk*/ bo_Br_Ix, /*SnkPrt*/ 0, /*Cons*/ "(nIter)*1", /*Delay*/ "0",0); graph->connect( /*Src*/ bo_GenDisp, /*SrcPrt*/ 0, /*Prod*/ "(maxDisp-minDisp+1)*1", /*Snk*/ bo_Br_Disp, /*SnkPrt*/ 0, /*Cons*/ "(nDisp)*1", /*Delay*/ "0",0); graph->connect( /*Src*/ bo_Br_Disp, /*SrcPrt*/ 0, /*Prod*/ "(nDisp)*1", /*Snk*/ bo_CostConstruction, /*SnkPrt*/ 0, /*Cons*/ "(1)*1", /*Delay*/ "0",0); graph->connect( /*Src*/ bo_Br_Disp, /*SrcPrt*/ 1, /*Prod*/ "(nDisp)*1", /*Snk*/ bo_DispComp, /*SnkPrt*/ 3, /*Cons*/ "(maxDisp-minDisp+1)*1", /*Delay*/ "0",0); graph->connect( /*Src*/ bo_Br_Ix, /*SrcPrt*/ 0, /*Prod*/ "(nIter)*1", /*Snk*/ bo_DispComp, /*SnkPrt*/ 0, /*Cons*/ "(nIter)*1", /*Delay*/ "0",0); graph->connect( /*Src*/ bo_Br_Ix, /*SrcPrt*/ 1, /*Prod*/ "(nIter)*1", /*Snk*/ bo_HWeight, /*SnkPrt*/ 0, /*Cons*/ "(1)*1", /*Delay*/ "0",0); graph->connect( /*Src*/ bo_Br_Ix, /*SrcPrt*/ 2, /*Prod*/ "(nIter)*1", /*Snk*/ bo_VWeights, /*SnkPrt*/ 0, /*Cons*/ "(1)*1", /*Delay*/ "0",0); graph->connect( /*Src*/ bo_Br_rgb, /*SrcPrt*/ 0, /*Prod*/ "(size)*3", /*Snk*/ bo_HWeight, /*SnkPrt*/ 1, /*Cons*/ "(height*width)*3", /*Delay*/ "0",0); graph->connect( /*Src*/ bo_Br_rgb, /*SrcPrt*/ 1, /*Prod*/ "(size)*3", /*Snk*/ bo_VWeights, /*SnkPrt*/ 1, /*Cons*/ "(height*width)*3", /*Delay*/ "0",0); graph->connect( /*Src*/ if_cenL, /*SrcPrt*/ 0, /*Prod*/ "(size)*1", /*Snk*/ bo_CostConstruction, /*SnkPrt*/ 1, /*Cons*/ "(height*width)*1", /*Delay*/ "0",0); graph->connect( /*Src*/ if_cenR, /*SrcPrt*/ 0, /*Prod*/ "(size)*1", /*Snk*/ bo_CostConstruction, /*SnkPrt*/ 2, /*Cons*/ "(height*width)*1", /*Delay*/ "0",0); graph->connect( /*Src*/ if_grayL, /*SrcPrt*/ 0, /*Prod*/ "(size)*1", /*Snk*/ bo_CostConstruction, /*SnkPrt*/ 3, /*Cons*/ "(height*width)*1", /*Delay*/ "0",0); graph->connect( /*Src*/ if_grayR, /*SrcPrt*/ 0, /*Prod*/ "(size)*1", /*Snk*/ bo_CostConstruction, /*SnkPrt*/ 4, /*Cons*/ "(height*width)*1", /*Delay*/ "0",0); return graph; }
// Method building PiSDFGraphRadix2_fft PiSDFGraph* Radix2_fft(Archi* archi, Stack* stack){ PiSDFGraph* graph = CREATE(stack, PiSDFGraph)( /*Edges*/ 4, /*Params*/ 6, /*InputIf*/ 0, /*OutputIf*/ 0, /*Config*/ 1, /*Body*/ 5, /*Archi*/ archi, /*Stack*/ stack); /* Parameters */ PiSDFParam *param_fftSize = graph->addDynamicParam("fftSize"); PiSDFParam *param_P = graph->addDynamicParam("P"); PiSDFParam *param_n1 = graph->addDynamicParam("n1"); PiSDFParam *param_n2 = graph->addDynamicParam("n2"); PiSDFParam *param_N1 = graph->addDependentParam("N1", "2^P"); PiSDFParam *param_N2 = graph->addDependentParam("N2", "fftSize/2^P"); /* Vertices */ PiSDFVertex* bo_src = graph->addBodyVertex( /*Name*/ "src", /*FctId*/ RADIX2_FFT_SRC_FCT, /*InData*/ 0, /*OutData*/ 1, /*InParam*/ 1); bo_src->addInParam(0, param_fftSize); // bo_src->isExecutableOnPE(CORE_ARM0); // bo_src->isExecutableOnPE(CORE_ARM1); // bo_src->isExecutableOnPE(CORE_ARM2); // bo_src->isExecutableOnPE(CORE_ARM3); bo_src->isExecutableOnPE(CORE_DSP0); bo_src->setTimingOnType(CORE_TYPE_C6X, "100", stack); bo_src->setTimingOnType(CORE_TYPE_ARM, "100", stack); PiSDFVertex* bo_T = graph->addBodyVertex( /*Name*/ "T", /*FctId*/ RADIX2_FFT_T_FCT, /*InData*/ 1, /*OutData*/ 1, /*InParam*/ 2); bo_T->addInParam(0, param_N1); bo_T->addInParam(1, param_N2); // bo_T->isExecutableOnPE(CORE_ARM0); // bo_T->isExecutableOnPE(CORE_ARM1); // bo_T->isExecutableOnPE(CORE_ARM2); // bo_T->isExecutableOnPE(CORE_ARM3); bo_T->isExecutableOnPE(CORE_DSP0); // bo_T->isExecutableOnPE(CORE_DSP1); // bo_T->isExecutableOnPE(CORE_DSP2); // bo_T->isExecutableOnPE(CORE_DSP3); // bo_T->isExecutableOnPE(CORE_DSP4); // bo_T->isExecutableOnPE(CORE_DSP5); // bo_T->isExecutableOnPE(CORE_DSP6); // bo_T->isExecutableOnPE(CORE_DSP7); bo_T->setTimingOnType(CORE_TYPE_C6X, "100", stack); bo_T->setTimingOnType(CORE_TYPE_ARM, "100", stack); PiSDFVertex* bo_DFT_N2 = graph->addBodyVertex( /*Name*/ "DFT_N2", /*FctId*/ RADIX2_FFT_DFT_N2_FCT, /*InData*/ 1, /*OutData*/ 1, /*InParam*/ 2); bo_DFT_N2->addInParam(0, param_N2); bo_DFT_N2->addInParam(1, param_n2); // bo_DFT_N2->isExecutableOnPE(CORE_ARM0); bo_DFT_N2->isExecutableOnPE(CORE_ARM1); bo_DFT_N2->isExecutableOnPE(CORE_ARM2); // bo_DFT_N2->isExecutableOnPE(CORE_ARM3); bo_DFT_N2->isExecutableOnPE(CORE_DSP0); bo_DFT_N2->isExecutableOnPE(CORE_DSP1); bo_DFT_N2->isExecutableOnPE(CORE_DSP2); bo_DFT_N2->isExecutableOnPE(CORE_DSP3); bo_DFT_N2->isExecutableOnPE(CORE_DSP4); bo_DFT_N2->isExecutableOnPE(CORE_DSP5); bo_DFT_N2->isExecutableOnPE(CORE_DSP6); bo_DFT_N2->isExecutableOnPE(CORE_DSP7); bo_DFT_N2->setTimingOnType(CORE_TYPE_C6X, "117445", stack); bo_DFT_N2->setTimingOnType(CORE_TYPE_ARM, "78130", stack); PiSDFVertex* bo_snk = graph->addBodyVertex( /*Name*/ "snk", /*FctId*/ RADIX2_FFT_SNK_FCT, /*InData*/ 1, /*OutData*/ 0, /*InParam*/ 1); bo_snk->addInParam(0, param_fftSize); // bo_snk->isExecutableOnPE(CORE_ARM0); // bo_snk->isExecutableOnPE(CORE_ARM1); // bo_snk->isExecutableOnPE(CORE_ARM2); // bo_snk->isExecutableOnPE(CORE_ARM3); bo_snk->isExecutableOnPE(CORE_DSP0); bo_snk->setTimingOnType(CORE_TYPE_C6X, "100", stack); bo_snk->setTimingOnType(CORE_TYPE_ARM, "100", stack); PiSDFVertex* cf_cfgFFT = graph->addConfigVertex( /*Name*/ "cfgFFT", /*FctId*/ RADIX2_FFT_CFGFFT_FCT, /*SubType*/ PISDF_SUBTYPE_NORMAL, /*InData*/ 0, /*OutData*/ 0, /*InParam*/ 0, /*OutParam*/4); cf_cfgFFT->addOutParam(0, param_fftSize); cf_cfgFFT->addOutParam(1, param_P); cf_cfgFFT->addOutParam(2, param_n1); cf_cfgFFT->addOutParam(3, param_n2); cf_cfgFFT->isExecutableOnPE(CORE_ARM0); cf_cfgFFT->setTimingOnType(CORE_TYPE_C6X, "100", stack); cf_cfgFFT->setTimingOnType(CORE_TYPE_ARM, "100", stack); PiSDFVertex* bo_DFT_Radix2 = graph->addHierVertex( /*Name*/ "DFT_Radix2", /*Graph*/ DFT_Radix2(archi, stack), /*InData*/ 1, /*OutData*/ 1, /*InParam*/ 4); bo_DFT_Radix2->addInParam(0, param_N1); bo_DFT_Radix2->addInParam(1, param_N2); bo_DFT_Radix2->addInParam(2, param_n1); bo_DFT_Radix2->addInParam(3, param_P); /* Edges */ graph->connect( /*Src*/ bo_src, /*SrcPrt*/ 0, /*Prod*/ "(fftSize)*4", /*Snk*/ bo_T, /*SnkPrt*/ 0, /*Cons*/ "(N1*N2)*4", /*Delay*/ "0",0); graph->connect( /*Src*/ bo_T, /*SrcPrt*/ 0, /*Prod*/ "(N1*N2)*4", /*Snk*/ bo_DFT_N2, /*SnkPrt*/ 0, /*Cons*/ "(n2*N2)*4", /*Delay*/ "0",0); graph->connect( /*Src*/ bo_DFT_N2, /*SrcPrt*/ 0, /*Prod*/ "(n2*N2)*4", /*Snk*/ bo_DFT_Radix2, /*SnkPrt*/ 0, /*Cons*/ "(N1*N2)*4", /*Delay*/ "0",0); graph->connect( /*Src*/ bo_DFT_Radix2, /*SrcPrt*/ 0, /*Prod*/ "(N1*N2)*4", /*Snk*/ bo_snk, /*SnkPrt*/ 0, /*Cons*/ "(fftSize)*4", /*Delay*/ "0",0); return graph; }
SRDAGGraph* result_Test5(PiSDFGraph* pisdf, Stack* stack){ SRDAGGraph* srdag = CREATE(stack, SRDAGGraph)(stack); PiSDFGraph* topPisdf = pisdf->getBody(0)->getSubGraph(); SRDAGVertex* vxA0 = srdag->addVertex(topPisdf->getBody(0)); SRDAGVertex* vxA1 = srdag->addVertex(topPisdf->getBody(0)); SRDAGVertex* vxB0 = srdag->addVertex(topPisdf->getBody(1)); SRDAGVertex* vxB1 = srdag->addVertex(topPisdf->getBody(1)); SRDAGVertex* vxH = srdag->addVertex(topPisdf->getBody(3)->getSubGraph()->getBody(0)); SRDAGVertex* vxBr = srdag->addBroadcast(2); SRDAGVertex* vxJ0 = srdag->addJoin(2); SRDAGVertex* vxJ1 = srdag->addJoin(2); SRDAGVertex* vxF = srdag->addFork(3); SRDAGVertex* vxE = srdag->addEnd(); SRDAGVertex* vxJCheck = srdag->addJoin(2); SRDAGVertex* vxCheck = srdag->addVertex(topPisdf->getBody(2)); srdag->addEdge( vxA0, 0, vxJ0, 0, 1); srdag->addEdge( vxA1, 0, vxJ0, 1, 1); srdag->addEdge( vxJ0, 0, vxBr, 0, 2); srdag->addEdge( vxBr, 0, vxJ1, 0, 2); srdag->addEdge( vxBr, 1, vxJ1, 1, 2); srdag->addEdge( vxJ1, 0, vxH , 0, 4); srdag->addEdge( vxH , 0, vxF , 0, 4); srdag->addEdge( vxF , 0, vxE , 0, 2); srdag->addEdge( vxF , 1, vxB0 , 0, 1); srdag->addEdge( vxF , 2, vxB1 , 0, 1); srdag->addEdge( vxB0 , 0, vxJCheck , 0, 1); srdag->addEdge( vxB1 , 0, vxJCheck , 1, 1); srdag->addEdge( vxJCheck , 0, vxCheck , 0, 2); return srdag; }
// Method building PiSDFGraphDispComp PiSDFGraph* DispComp(Archi* archi, Stack* stack) { PiSDFGraph* graph = CREATE(stack, PiSDFGraph)( /*Edges*/ 10, /*Params*/ 8, /*InputIf*/ 5, /*OutputIf*/ 1, /*Config*/ 0, /*Body*/ 3, /*Archi*/ archi, /*Stack*/ stack); /* Parameters */ PiSDFParam *param_height = graph->addHeritedParam("height", 0); PiSDFParam *param_width = graph->addHeritedParam("width", 1); PiSDFParam *param_nIter = graph->addHeritedParam("nIter", 2); PiSDFParam *param_scale = graph->addHeritedParam("scale", 3); PiSDFParam *param_minDisp = graph->addHeritedParam("minDisp", 4); PiSDFParam *param_maxDisp = graph->addHeritedParam("maxDisp", 5); PiSDFParam *param_size = graph->addDependentParam("size", "height*width"); PiSDFParam *param_nDisp = graph->addDependentParam("nDisp", "maxDisp-minDisp+1"); /* Vertices */ PiSDFVertex* bo_AggregateCost = graph->addBodyVertex( /*Name*/ "AggregateCost", /*FctId*/ DISPCOMP_AGGREGATECOST_FCT, /*InData*/ 4, /*OutData*/ 1, /*InParam*/ 3); bo_AggregateCost->addInParam(0, param_height); bo_AggregateCost->addInParam(1, param_width); bo_AggregateCost->addInParam(2, param_nIter); // bo_AggregateCost->isExecutableOnPE(CORE_ARM0); bo_AggregateCost->isExecutableOnPE(CORE_DSP0); bo_AggregateCost->isExecutableOnPE(CORE_DSP1); bo_AggregateCost->isExecutableOnPE(CORE_DSP2); bo_AggregateCost->isExecutableOnPE(CORE_DSP3); bo_AggregateCost->isExecutableOnPE(CORE_DSP4); bo_AggregateCost->isExecutableOnPE(CORE_DSP5); bo_AggregateCost->isExecutableOnPE(CORE_DSP6); bo_AggregateCost->isExecutableOnPE(CORE_DSP7); bo_AggregateCost->setTimingOnType(CORE_TYPE_C6X, "127693715", stack); bo_AggregateCost->setTimingOnType(CORE_TYPE_ARM, "255956368", stack); PiSDFVertex* bo_DisparitySelect = graph->addBodyVertex( /*Name*/ "DisparitySelect", /*FctId*/ DISPCOMP_DISPARITYSELECT_FCT, /*InData*/ 4, /*OutData*/ 2, /*InParam*/ 5); bo_DisparitySelect->addInParam(0, param_height); bo_DisparitySelect->addInParam(1, param_width); bo_DisparitySelect->addInParam(2, param_scale); bo_DisparitySelect->addInParam(3, param_minDisp); bo_DisparitySelect->addInParam(4, param_maxDisp); // bo_DisparitySelect->isExecutableOnPE(CORE_ARM0); bo_DisparitySelect->isExecutableOnPE(CORE_DSP0); bo_DisparitySelect->isExecutableOnPE(CORE_DSP1); bo_DisparitySelect->isExecutableOnPE(CORE_DSP2); bo_DisparitySelect->isExecutableOnPE(CORE_DSP3); bo_DisparitySelect->isExecutableOnPE(CORE_DSP4); bo_DisparitySelect->isExecutableOnPE(CORE_DSP5); bo_DisparitySelect->isExecutableOnPE(CORE_DSP6); bo_DisparitySelect->isExecutableOnPE(CORE_DSP7); bo_DisparitySelect->setTimingOnType(CORE_TYPE_C6X, "43926345", stack); bo_DisparitySelect->setTimingOnType(CORE_TYPE_ARM, "177962862", stack); PiSDFVertex* bo_Br_Disp = graph->addSpecialVertex( /*Type*/ PISDF_SUBTYPE_BROADCAST, /*InData*/ 1, /*OutData*/ 2, /*InParam*/ 1); bo_Br_Disp->addInParam(0, param_size); PiSDFVertex* if_rawDisparity = graph->addOutputIf( /*Name*/ "if_rawDisparity", /*InParam*/ 1); if_rawDisparity->addInParam(0, param_size); PiSDFVertex* if_offsets = graph->addInputIf( /*Name*/ "if_offsets", /*InParam*/ 2); if_offsets->addInParam(0, param_nDisp); if_offsets->addInParam(1, param_nIter); PiSDFVertex* if_vWeights = graph->addInputIf( /*Name*/ "if_vWeights", /*InParam*/ 2); if_vWeights->addInParam(0, param_size); if_vWeights->addInParam(1, param_nIter); PiSDFVertex* if_hWeights = graph->addInputIf( /*Name*/ "if_hWeights", /*InParam*/ 2); if_hWeights->addInParam(0, param_size); if_hWeights->addInParam(1, param_nIter); PiSDFVertex* if_dispIx = graph->addInputIf( /*Name*/ "if_dispIx", /*InParam*/ 1); if_dispIx->addInParam(0, param_nDisp); PiSDFVertex* if_cost = graph->addInputIf( /*Name*/ "if_cost", /*InParam*/ 2); if_cost->addInParam(0, param_size); if_cost->addInParam(1, param_nDisp); /* Edges */ graph->connect( /*Src*/ bo_DisparitySelect, /*SrcPrt*/ 1, /*Prod*/ "(width*height+1)*1", /*Snk*/ bo_DisparitySelect, /*SnkPrt*/ 3, /*Cons*/ "(width*height+1)*1", /*Delay*/ "(size+1)*1",0); graph->connect( /*Src*/ bo_DisparitySelect, /*SrcPrt*/ 0, /*Prod*/ "(height*width)*1", /*Snk*/ bo_Br_Disp, /*SnkPrt*/ 0, /*Cons*/ "(size)*1", /*Delay*/ "0",0); graph->connect( /*Src*/ bo_Br_Disp, /*SrcPrt*/ 0, /*Prod*/ "(size)*1", /*Snk*/ if_rawDisparity, /*SnkPrt*/ 0, /*Cons*/ "(size)*1", /*Delay*/ "0",0); graph->connect( /*Src*/ bo_Br_Disp, /*SrcPrt*/ 1, /*Prod*/ "(size)*1", /*Snk*/ bo_DisparitySelect, /*SnkPrt*/ 2, /*Cons*/ "(width*height)*1", /*Delay*/ "(size)*1",0); graph->connect( /*Src*/ if_offsets, /*SrcPrt*/ 0, /*Prod*/ "(nIter)*1", /*Snk*/ bo_AggregateCost, /*SnkPrt*/ 2, /*Cons*/ "(nIter)*1", /*Delay*/ "0",0); graph->connect( /*Src*/ if_vWeights, /*SrcPrt*/ 0, /*Prod*/ "(size*nIter)*1", /*Snk*/ bo_AggregateCost, /*SnkPrt*/ 3, /*Cons*/ "(height*width*nIter)*1", /*Delay*/ "0",0); graph->connect( /*Src*/ if_hWeights, /*SrcPrt*/ 0, /*Prod*/ "(size*nIter)*1", /*Snk*/ bo_AggregateCost, /*SnkPrt*/ 1, /*Cons*/ "(height*width*nIter)*1", /*Delay*/ "0",0); graph->connect( /*Src*/ if_dispIx, /*SrcPrt*/ 0, /*Prod*/ "(nDisp)*1", /*Snk*/ bo_DisparitySelect, /*SnkPrt*/ 1, /*Cons*/ "(1)*1", /*Delay*/ "0",0); graph->connect( /*Src*/ if_cost, /*SrcPrt*/ 0, /*Prod*/ "(size*nDisp)*1", /*Snk*/ bo_AggregateCost, /*SnkPrt*/ 0, /*Cons*/ "(width*height)*1", /*Delay*/ "0",0); graph->connect( /*Src*/ bo_AggregateCost, /*SrcPrt*/ 0, /*Prod*/ "(width*height)*1", /*Snk*/ bo_DisparitySelect, /*SnkPrt*/ 0, /*Cons*/ "(width*height)*1", /*Delay*/ "0",0); return graph; }
int main(int argc, char* argv[]) { SpiderConfig cfg; ExecutionStat stat; initActors(); DynStack pisdfStack("PisdfStack"); DynStack archiStack("ArchiStack"); #define SH_MEM 0x00500000 PlatformLinux platform(4, SH_MEM, &archiStack, daq_fft_fcts, N_FCT_DAQ_FFT); Archi* archi = platform.getArchi(); cfg.memAllocType = MEMALLOC_SPECIAL_ACTOR; cfg.memAllocStart = (void*)0; cfg.memAllocSize = SH_MEM; cfg.schedulerType = SCHEDULER_LIST; cfg.srdagStack = {STACK_DYNAMIC, "SrdagStack", 0, 0}; cfg.transfoStack = {STACK_DYNAMIC, "TransfoStack", 0, 0}; spider_init(cfg); printf("Start\n"); // try{ PiSDFGraph *topPisdf = init_daq_fft(archi, &pisdfStack); topPisdf->print("topPisdf.gv"); Platform::get()->rstTime(); spider_launch(archi, topPisdf); spider_printGantt(archi, spider_getLastSRDAG(), "daq_fft.pgantt", "latex.tex", &stat); spider_getLastSRDAG()->print("daq_fft.gv"); printf("EndTime = %d ms\n", stat.globalEndTime/1000000); printf("Memory use = "); if(stat.memoryUsed < 1024) printf("\t%5.1f B", stat.memoryUsed/1.); else if(stat.memoryUsed < 1024*1024) printf("\t%5.1f KB", stat.memoryUsed/1024.); else if(stat.memoryUsed < 1024*1024*1024) printf("\t%5.1f MB", stat.memoryUsed/1024./1024.); else printf("\t%5.1f GB", stat.memoryUsed/1024./1024./1024.); printf("\n"); FILE* f = fopen("timings.csv", "w+"); fprintf(f, "Actors,x86\n"); printf("Actors:\n"); for(int j=0; j<stat.nbActor; j++) { printf("\t%12s:", stat.actors[j]->getName()); fprintf(f, "%s", stat.actors[j]->getName()); for(int k=0; k<archi->getNPETypes(); k++) { printf("\t%d (x%d)", stat.actorTimes[j][k]/stat.actorIterations[j][k], stat.actorIterations[j][k]); fprintf(f, ",%d", stat.actorTimes[j][k]/stat.actorIterations[j][k]); } printf("\n"); fprintf(f, "\n"); } free_daq_fft(topPisdf, &pisdfStack); // }catch(const char* s){ // printf("Exception : %s\n", s); // } printf("finished\n"); spider_free(); return 0; }
int main(int argc, char* argv[]) { SpiderConfig cfg; ExecutionStat stat; // initActors(); StaticStack pisdfStack("PisdfStack", pisdfStackMem, PISDF_SIZE); StaticStack archiStack("ArchiStack", archiStackMem, ARCHI_SIZE); #define SH_MEM 0x04000000 PlatformK2Arm platform(1, 0, USE_DDR, SH_MEM, &archiStack, stereo_fcts, N_FCT_STEREO); Archi* archi = platform.getArchi(); cfg.memAllocType = MEMALLOC_SPECIAL_ACTOR; cfg.memAllocStart = (void*)0; cfg.memAllocSize = SH_MEM; cfg.schedulerType = SCHEDULER_LIST; cfg.srdagStack.type = STACK_STATIC; cfg.srdagStack.name = "SrdagStack"; cfg.srdagStack.size = SRDAG_SIZE; cfg.srdagStack.start = srdagStack; cfg.transfoStack.type = STACK_STATIC; cfg.transfoStack.name = "TransfoStack"; cfg.transfoStack.size = TRANSFO_SIZE; cfg.transfoStack.start = transfoStack; spider_init(cfg); printf("Start\n"); try { int i=1; // for(int i=1; i<=1; i++){ printf("NStep = %d\n", i); char ganttPath[30]; sprintf(ganttPath, "stereo.pgantt"); char srdagPath[30]; sprintf(srdagPath, "stereo.gv"); pisdfStack.freeAll(); PiSDFGraph *topPisdf = init_stereo(archi, &pisdfStack); topPisdf->print("topPisdf.gv"); Platform::get()->rstTime(); spider_launch(archi, topPisdf); // spider_printGantt(archi, spider_getLastSRDAG(), ganttPath, "latex.tex", &stat); spider_getLastSRDAG()->print(srdagPath); printf("EndTime = %d ms\n", stat.globalEndTime/1000000); printf("Memory use = "); if(stat.memoryUsed < 1024) printf("\t%5.1f B", stat.memoryUsed/1.); else if(stat.memoryUsed < 1024*1024) printf("\t%5.1f KB", stat.memoryUsed/1024.); else if(stat.memoryUsed < 1024*1024*1024) printf("\t%5.1f MB", stat.memoryUsed/1024./1024.); else printf("\t%5.1f GB", stat.memoryUsed/1024./1024./1024.); printf("\n"); printf("Actors:\n"); for(int j=0; j<stat.nbActor; j++) { printf("\t%12s:", stat.actors[j]->getName()); for(int k=0; k<archi->getNPETypes(); k++) printf("\t%d (x%d)", stat.actorTimes[j][k]/stat.actorIterations[j][k], stat.actorIterations[j][k]); printf("\n"); } free_stereo(topPisdf, &pisdfStack); // } } catch(const char* s) { printf("Exception : %s\n", s); } printf("finished\n"); spider_free(); return 0; }
// Method building PiSDFGraphdaq_fft PiSDFGraph* daq_fft(Archi* archi, Stack* stack) { PiSDFGraph* graph = CREATE(stack, PiSDFGraph)( /*Edges*/ 8, /*Params*/ 5, /*InputIf*/ 0, /*OutputIf*/ 0, /*Config*/ 1, /*Body*/ 9, /*Archi*/ archi, /*Stack*/ stack); /* Parameters */ PiSDFParam *param_Nr = graph->addDynamicParam("Nr"); PiSDFParam *param_Nc = graph->addDynamicParam("Nc"); PiSDFParam *param_N1 = graph->addDynamicParam("n1"); PiSDFParam *param_N2 = graph->addDynamicParam("n2"); PiSDFParam *param_size = graph->addStaticParam("size", 2*64*1024); /* Vertices */ PiSDFVertex* bo_src = graph->addBodyVertex( /*Name*/ "src", /*FctId*/ SRC_FCT, /*InData*/ 0, /*OutData*/ 1, /*InParam*/ 1); bo_src->addInParam(0, param_size); bo_src->isExecutableOnPE(CORE_ARM0); bo_src->isExecutableOnPE(CORE_DSP0); bo_src->setTimingOnType(CORE_TYPE_C6678, "1000", stack); bo_src->setTimingOnType(CORE_TYPE_CORTEXA15, "1000", stack); PiSDFVertex* bo_T_1 = graph->addBodyVertex( /*Name*/ "T_1", /*FctId*/ T_1_FCT, /*InData*/ 1, /*OutData*/ 1, /*InParam*/ 2); bo_T_1->addInParam(0, param_Nc); bo_T_1->addInParam(1, param_Nr); bo_T_1->isExecutableOnPE(CORE_DSP0); bo_T_1->isExecutableOnPE(CORE_DSP3); bo_T_1->isExecutableOnPE(CORE_DSP4); bo_T_1->isExecutableOnPE(CORE_DSP1); bo_T_1->isExecutableOnPE(CORE_DSP2); bo_T_1->isExecutableOnPE(CORE_DSP7); bo_T_1->isExecutableOnPE(CORE_DSP5); bo_T_1->isExecutableOnPE(CORE_DSP6); // bo_T_1->isExecutableOnPE(CORE_ARM0); bo_T_1->setTimingOnType(CORE_TYPE_C6678, "1000", stack); bo_T_1->setTimingOnType(CORE_TYPE_CORTEXA15, "1000", stack); PiSDFVertex* bo_FFT_2 = graph->addBodyVertex( /*Name*/ "FFT_2", /*FctId*/ FFT_2_FCT, /*InData*/ 1, /*OutData*/ 1, /*InParam*/ 2); bo_FFT_2->addInParam(0, param_Nr); bo_FFT_2->addInParam(1, param_N1); bo_FFT_2->isExecutableOnPE(CORE_DSP0); bo_FFT_2->isExecutableOnPE(CORE_DSP3); bo_FFT_2->isExecutableOnPE(CORE_DSP4); bo_FFT_2->isExecutableOnPE(CORE_DSP1); bo_FFT_2->isExecutableOnPE(CORE_DSP2); bo_FFT_2->isExecutableOnPE(CORE_DSP7); bo_FFT_2->isExecutableOnPE(CORE_DSP5); bo_FFT_2->isExecutableOnPE(CORE_DSP6); // bo_FFT_2->isExecutableOnPE(CORE_ARM0); // bo_FFT_2->isExecutableOnPE(CORE_ARM1); bo_FFT_2->setTimingOnType(CORE_TYPE_C6678, "32000", stack); bo_FFT_2->setTimingOnType(CORE_TYPE_CORTEXA15, "17000", stack); PiSDFVertex* bo_T_3 = graph->addBodyVertex( /*Name*/ "T_3", /*FctId*/ T_3_FCT, /*InData*/ 1, /*OutData*/ 1, /*InParam*/ 2); bo_T_3->addInParam(0, param_Nr); bo_T_3->addInParam(1, param_Nc); bo_T_3->isExecutableOnPE(CORE_DSP0); bo_T_3->isExecutableOnPE(CORE_DSP3); bo_T_3->isExecutableOnPE(CORE_DSP4); bo_T_3->isExecutableOnPE(CORE_DSP1); bo_T_3->isExecutableOnPE(CORE_DSP2); bo_T_3->isExecutableOnPE(CORE_DSP7); bo_T_3->isExecutableOnPE(CORE_DSP5); bo_T_3->isExecutableOnPE(CORE_DSP6); // bo_T_3->isExecutableOnPE(CORE_ARM0); bo_T_3->setTimingOnType(CORE_TYPE_C6678, "1000", stack); bo_T_3->setTimingOnType(CORE_TYPE_CORTEXA15, "1000", stack); PiSDFVertex* bo_Twi_4 = graph->addBodyVertex( /*Name*/ "Twi_4", /*FctId*/ TWI_4_FCT, /*InData*/ 2, /*OutData*/ 1, /*InParam*/ 2); bo_Twi_4->addInParam(0, param_Nc); bo_Twi_4->addInParam(1, param_N2); bo_Twi_4->isExecutableOnPE(CORE_DSP0); bo_Twi_4->isExecutableOnPE(CORE_DSP3); bo_Twi_4->isExecutableOnPE(CORE_DSP4); bo_Twi_4->isExecutableOnPE(CORE_DSP1); bo_Twi_4->isExecutableOnPE(CORE_DSP2); bo_Twi_4->isExecutableOnPE(CORE_DSP7); bo_Twi_4->isExecutableOnPE(CORE_DSP5); bo_Twi_4->isExecutableOnPE(CORE_DSP6); // bo_Twi_4->isExecutableOnPE(CORE_ARM0); bo_Twi_4->setTimingOnType(CORE_TYPE_C6678, "14000", stack); bo_Twi_4->setTimingOnType(CORE_TYPE_CORTEXA15, "1000", stack); PiSDFVertex* bo_FFT_5 = graph->addBodyVertex( /*Name*/ "FFT_5", /*FctId*/ FFT_5_FCT, /*InData*/ 1, /*OutData*/ 1, /*InParam*/ 2); bo_FFT_5->addInParam(0, param_Nc); bo_FFT_5->addInParam(1, param_N2); bo_FFT_5->isExecutableOnPE(CORE_DSP0); bo_FFT_5->isExecutableOnPE(CORE_DSP3); bo_FFT_5->isExecutableOnPE(CORE_DSP4); bo_FFT_5->isExecutableOnPE(CORE_DSP1); bo_FFT_5->isExecutableOnPE(CORE_DSP2); bo_FFT_5->isExecutableOnPE(CORE_DSP7); bo_FFT_5->isExecutableOnPE(CORE_DSP5); bo_FFT_5->isExecutableOnPE(CORE_DSP6); // bo_FFT_5->isExecutableOnPE(CORE_ARM0); // bo_FFT_5->isExecutableOnPE(CORE_ARM1); bo_FFT_5->setTimingOnType(CORE_TYPE_C6678, "32000", stack); bo_FFT_5->setTimingOnType(CORE_TYPE_CORTEXA15, "17000", stack); PiSDFVertex* bo_T_6 = graph->addBodyVertex( /*Name*/ "T_6", /*FctId*/ T_6_FCT, /*InData*/ 1, /*OutData*/ 1, /*InParam*/ 2); bo_T_6->addInParam(0, param_Nc); bo_T_6->addInParam(1, param_Nr); bo_T_6->isExecutableOnPE(CORE_DSP0); bo_T_6->isExecutableOnPE(CORE_DSP3); bo_T_6->isExecutableOnPE(CORE_DSP4); bo_T_6->isExecutableOnPE(CORE_DSP1); bo_T_6->isExecutableOnPE(CORE_DSP2); bo_T_6->isExecutableOnPE(CORE_DSP7); bo_T_6->isExecutableOnPE(CORE_DSP5); bo_T_6->isExecutableOnPE(CORE_DSP6); // bo_T_6->isExecutableOnPE(CORE_ARM0); bo_T_6->setTimingOnType(CORE_TYPE_C6678, "1000", stack); bo_T_6->setTimingOnType(CORE_TYPE_CORTEXA15, "1000", stack); PiSDFVertex* bo_snk = graph->addBodyVertex( /*Name*/ "snk", /*FctId*/ SNK_FCT, /*InData*/ 1, /*OutData*/ 0, /*InParam*/ 1); bo_snk->addInParam(0, param_size); bo_snk->isExecutableOnPE(CORE_ARM0); bo_snk->setTimingOnType(CORE_TYPE_C6678, "1000", stack); bo_snk->setTimingOnType(CORE_TYPE_CORTEXA15, "1000", stack); PiSDFVertex* cf_cfg = graph->addConfigVertex( /*Name*/ "cfg", /*FctId*/ CFG_FCT, /*SubType*/ PISDF_SUBTYPE_NORMAL, /*InData*/ 0, /*OutData*/ 0, /*InParam*/ 1, /*OutParam*/4); cf_cfg->addOutParam(0, param_Nr); cf_cfg->addOutParam(1, param_Nc); cf_cfg->addOutParam(2, param_N1); cf_cfg->addOutParam(3, param_N2); cf_cfg->addInParam(0, param_size); cf_cfg->isExecutableOnPE(CORE_ARM0); cf_cfg->setTimingOnType(CORE_TYPE_C6678, "1000", stack); cf_cfg->setTimingOnType(CORE_TYPE_CORTEXA15, "1000", stack); PiSDFVertex* bo_genIx = graph->addBodyVertex( /*Name*/ "genIx", /*FctId*/ GENIX_FCT, /*InData*/ 0, /*OutData*/ 1, /*InParam*/ 2); bo_genIx->addInParam(0, param_Nr); bo_genIx->addInParam(1, param_N2); bo_genIx->isExecutableOnPE(CORE_ARM0); bo_genIx->isExecutableOnPE(CORE_DSP0); bo_genIx->setTimingOnType(CORE_TYPE_C6678, "1000", stack); bo_genIx->setTimingOnType(CORE_TYPE_CORTEXA15, "1000", stack); /* Edges */ graph->connect( /*Src*/ bo_src, /*SrcPrt*/ 0, /*Prod*/ "4*(size)", /*Snk*/ bo_T_1, /*SnkPrt*/ 0, /*Cons*/ "4*(Nc*Nr)", /*Delay*/ "0",0); graph->connect( /*Src*/ bo_T_1, /*SrcPrt*/ 0, /*Prod*/ "4*(Nc*Nr)", /*Snk*/ bo_FFT_2, /*SnkPrt*/ 0, /*Cons*/ "4*(Nr*n1)", /*Delay*/ "0",0); graph->connect( /*Src*/ bo_FFT_2, /*SrcPrt*/ 0, /*Prod*/ "4*(Nr*n1)", /*Snk*/ bo_T_3, /*SnkPrt*/ 0, /*Cons*/ "4*(Nc*Nr)", /*Delay*/ "0",0); graph->connect( /*Src*/ bo_T_3, /*SrcPrt*/ 0, /*Prod*/ "4*(Nc*Nr)", /*Snk*/ bo_Twi_4, /*SnkPrt*/ 1, /*Cons*/ "4*(Nc*n2)", /*Delay*/ "0",0); graph->connect( /*Src*/ bo_Twi_4, /*SrcPrt*/ 0, /*Prod*/ "4*(Nc*n2)", /*Snk*/ bo_FFT_5, /*SnkPrt*/ 0, /*Cons*/ "4*(Nc*n2)", /*Delay*/ "0",0); graph->connect( /*Src*/ bo_FFT_5, /*SrcPrt*/ 0, /*Prod*/ "4*(Nc*n2)", /*Snk*/ bo_T_6, /*SnkPrt*/ 0, /*Cons*/ "4*(Nc*Nr)", /*Delay*/ "0",0); graph->connect( /*Src*/ bo_T_6, /*SrcPrt*/ 0, /*Prod*/ "4*(Nc*Nr)", /*Snk*/ bo_snk, /*SnkPrt*/ 0, /*Cons*/ "4*(size)", /*Delay*/ "0",0); graph->connect( /*Src*/ bo_genIx, /*SrcPrt*/ 0, /*Prod*/ "4*(Nr/n2)", /*Snk*/ bo_Twi_4, /*SnkPrt*/ 0, /*Cons*/ "4*(1)", /*Delay*/ "0",0); return graph; }
// Method building PiSDFGraphRadix2_Stage PiSDFGraph* Radix2_Stage(Archi* archi, Stack* stack){ PiSDFGraph* graph = CREATE(stack, PiSDFGraph)( /*Edges*/ 8, /*Params*/ 5, /*InputIf*/ 2, /*OutputIf*/ 1, /*Config*/ 1, /*Body*/ 4, /*Archi*/ archi, /*Stack*/ stack); /* Parameters */ PiSDFParam *param_N1 = graph->addHeritedParam("N1", 0); PiSDFParam *param_N2 = graph->addHeritedParam("N2", 1); PiSDFParam *param_n1 = graph->addHeritedParam("n1", 2); PiSDFParam *param_p = graph->addDynamicParam("p"); PiSDFParam *param_nDFT2 = graph->addDependentParam("nDFT2", "N2*N1/n1/2"); /* Vertices */ PiSDFVertex* bo_DFT_2 = graph->addBodyVertex( /*Name*/ "DFT_2", /*FctId*/ RADIX2_STAGE_DFT_2_FCT, /*InData*/ 3, /*OutData*/ 2, /*InParam*/ 4); bo_DFT_2->addInParam(0, param_n1); bo_DFT_2->addInParam(1, param_p); bo_DFT_2->addInParam(2, param_N1); bo_DFT_2->addInParam(3, param_N2); // bo_DFT_2->isExecutableOnPE(CORE_ARM1); // bo_DFT_2->isExecutableOnPE(CORE_ARM0); bo_DFT_2->isExecutableOnPE(CORE_DSP0); bo_DFT_2->isExecutableOnPE(CORE_DSP1); bo_DFT_2->isExecutableOnPE(CORE_DSP2); bo_DFT_2->isExecutableOnPE(CORE_DSP3); bo_DFT_2->isExecutableOnPE(CORE_DSP4); bo_DFT_2->isExecutableOnPE(CORE_DSP5); bo_DFT_2->isExecutableOnPE(CORE_DSP6); bo_DFT_2->isExecutableOnPE(CORE_DSP7); bo_DFT_2->setTimingOnType(CORE_TYPE_C6X, "100", stack); bo_DFT_2->setTimingOnType(CORE_TYPE_ARM, "100", stack); PiSDFVertex* if_pValue = graph->addInputIf( /*Name*/ "if_pValue", /*InParam*/ 0); PiSDFVertex* if_in = graph->addInputIf( /*Name*/ "if_in", /*InParam*/ 2); if_in->addInParam(0, param_N1); if_in->addInParam(1, param_N2); PiSDFVertex* if_out = graph->addOutputIf( /*Name*/ "if_out", /*InParam*/ 2); if_out->addInParam(0, param_N1); if_out->addInParam(1, param_N2); PiSDFVertex* bo_F = graph->addSpecialVertex( /*Type*/ PISDF_SUBTYPE_FORK, /*InData*/ 1, /*OutData*/ 2, /*InParam*/ 2); bo_F->addInParam(0, param_N2); bo_F->addInParam(1, param_p); PiSDFVertex* bo_J = graph->addSpecialVertex( /*Type*/ PISDF_SUBTYPE_JOIN, /*InData*/ 2, /*OutData*/ 1, /*InParam*/ 2); bo_J->addInParam(0, param_N2); bo_J->addInParam(1, param_p); PiSDFVertex* cf_cfg = graph->addConfigVertex( /*Name*/ "cfg", /*FctId*/ RADIX2_STAGE_CFG_FCT, /*SubType*/ PISDF_SUBTYPE_NORMAL, /*InData*/ 1, /*OutData*/ 0, /*InParam*/ 0, /*OutParam*/1); cf_cfg->addOutParam(0, param_p); cf_cfg->isExecutableOnPE(CORE_ARM0); // cf_cfg->isExecutableOnPE(CORE_ARM1); // cf_cfg->isExecutableOnPE(CORE_ARM2); // cf_cfg->isExecutableOnPE(CORE_ARM3); cf_cfg->setTimingOnType(CORE_TYPE_C6X, "100", stack); cf_cfg->setTimingOnType(CORE_TYPE_ARM, "100", stack); PiSDFVertex* bo_genIx = graph->addBodyVertex( /*Name*/ "genIx", /*FctId*/ RADIX2_STAGE_GENIX_FCT, /*InData*/ 0, /*OutData*/ 1, /*InParam*/ 1); bo_genIx->addInParam(0, param_nDFT2); // bo_genIx->isExecutableOnPE(CORE_ARM0); bo_genIx->isExecutableOnPE(CORE_ARM1); bo_genIx->isExecutableOnPE(CORE_ARM2); bo_genIx->isExecutableOnPE(CORE_ARM3); // bo_genIx->isExecutableOnPE(CORE_DSP0); // bo_genIx->isExecutableOnPE(CORE_DSP1); // bo_genIx->isExecutableOnPE(CORE_DSP2); // bo_genIx->isExecutableOnPE(CORE_DSP3); bo_genIx->setTimingOnType(CORE_TYPE_C6X, "100", stack); bo_genIx->setTimingOnType(CORE_TYPE_ARM, "100", stack); /* Edges */ graph->connect( /*Src*/ if_pValue, /*SrcPrt*/ 0, /*Prod*/ "(1)*4", /*Snk*/ cf_cfg, /*SnkPrt*/ 0, /*Cons*/ "(1)*4", /*Delay*/ "0",0); graph->connect( /*Src*/ if_in, /*SrcPrt*/ 0, /*Prod*/ "(N1*N2)*4", /*Snk*/ bo_F, /*SnkPrt*/ 0, /*Cons*/ "(N2*(2^(p+1)))*4", /*Delay*/ "0",0); graph->connect( /*Src*/ bo_F, /*SrcPrt*/ 0, /*Prod*/ "(N2*(2^p))*4", /*Snk*/ bo_DFT_2, /*SnkPrt*/ 0, /*Cons*/ "(n1)*4", /*Delay*/ "0",0); graph->connect( /*Src*/ bo_F, /*SrcPrt*/ 1, /*Prod*/ "(N2*(2^p))*4", /*Snk*/ bo_DFT_2, /*SnkPrt*/ 1, /*Cons*/ "(n1)*4", /*Delay*/ "0",0); graph->connect( /*Src*/ bo_DFT_2, /*SrcPrt*/ 0, /*Prod*/ "(n1)*4", /*Snk*/ bo_J, /*SnkPrt*/ 0, /*Cons*/ "(N2*(2^p))*4", /*Delay*/ "0",0); graph->connect( /*Src*/ bo_DFT_2, /*SrcPrt*/ 1, /*Prod*/ "(n1)*4", /*Snk*/ bo_J, /*SnkPrt*/ 1, /*Cons*/ "(N2*(2^p))*4", /*Delay*/ "0",0); graph->connect( /*Src*/ bo_J, /*SrcPrt*/ 0, /*Prod*/ "(N2*(2^(p+1)))*4", /*Snk*/ if_out, /*SnkPrt*/ 0, /*Cons*/ "(N1*N2)*4", /*Delay*/ "0",0); graph->connect( /*Src*/ bo_genIx, /*SrcPrt*/ 0, /*Prod*/ "(nDFT2)*4", /*Snk*/ bo_DFT_2, /*SnkPrt*/ 2, /*Cons*/ "(1)*4", /*Delay*/ "0",0); return graph; }
int main(int argc, char* argv[]){ SpiderConfig cfg; ExecutionStat stat; initActors(); DynStack pisdfStack("PisdfStack"); DynStack archiStack("ArchiStack"); //#define SH_MEM 0x00500000 #define SH_MEM 0x10000000 PlatformLinux platform(1, SH_MEM, &archiStack, top_fft_fcts, N_FCT_TOP_FFT); Archi* archi = platform.getArchi(); cfg.memAllocType = MEMALLOC_SPECIAL_ACTOR; cfg.memAllocStart = (void*)0; cfg.memAllocSize = SH_MEM; cfg.schedulerType = SCHEDULER_LIST; cfg.srdagStack = {STACK_DYNAMIC, "SrdagStack", 0, 0}; cfg.transfoStack = {STACK_DYNAMIC, "TransfoStack", 0, 0}; spider_init(cfg); printf("Start\n"); // try{ for(int i=1; i<=3; i++){ // printf("NStep = %d\n", i); char ganttPath[30]; sprintf(ganttPath, "radixFFT_%d.pgantt", i); char srdagPath[30]; sprintf(srdagPath, "radixFFT_%d.gv", i); pisdfStack.freeAll(); PiSDFGraph *topPisdf = init_top_fft(archi, &pisdfStack); topPisdf->print("topPisdf.gv"); Platform::get()->rstTime(); spider_launch(archi, topPisdf); // spider_printGantt(archi, spider_getLastSRDAG(), ganttPath, "latex.tex", &stat); spider_getLastSRDAG()->print(srdagPath); printf("EndTime = %d ms\n", stat.globalEndTime/1000000); printf("Memory use = "); if(stat.memoryUsed < 1024) printf("\t%5.1f B", stat.memoryUsed/1.); else if(stat.memoryUsed < 1024*1024) printf("\t%5.1f KB", stat.memoryUsed/1024.); else if(stat.memoryUsed < 1024*1024*1024) printf("\t%5.1f MB", stat.memoryUsed/1024./1024.); else printf("\t%5.1f GB", stat.memoryUsed/1024./1024./1024.); printf("\n"); // printf("Actors:\n"); // for(int j=0; j<stat.nbActor; j++){ // printf("\t%12s:", stat.actors[j]->getName()); // for(int k=0; k<archi->getNPETypes(); k++) // printf("\t%d (x%d)", // stat.actorTimes[j][k]/stat.actorIterations[j][k], // stat.actorIterations[j][k]); // printf("\n"); // } free_top_fft(topPisdf, &pisdfStack); } // }catch(const char* s){ // printf("Exception : %s\n", s); // } printf("finished\n"); spider_free(); return 0; }
PiSDFGraph* test0(Archi* archi, Stack* stack, int N){ PiSDFGraph* graph = CREATE(stack, PiSDFGraph)( /*Edges*/ 2, /*Params*/ 1, /*InIf*/ 0, /*OutIf*/ 0, /*Config*/ 1, /*Normal*/ 3, archi, stack); // Parameters. PiSDFParam *paramN = graph->addDynamicParam("N"); // Configure vertices. PiSDFVertex *vxC = graph->addConfigVertex( "C", /*Fct*/ 2, PISDF_SUBTYPE_NORMAL, /*In*/ 0, /*Out*/ 0, /*Par*/ 0, /*Cfg*/ 1); vxC->addOutParam(0, paramN); // Other vertices PiSDFVertex *vxA = graph->addBodyVertex( "A", /*Fct*/ 0, /*In*/ 0, /*Out*/ 1, /*Par*/ 0); PiSDFVertex *vxB = graph->addBodyVertex( "B", /*Fct*/ 1, /*In*/ 1, /*Out*/ 1, /*Par*/ 1); vxB->addInParam(0, paramN); PiSDFVertex *vxCheck = graph->addBodyVertex( "Check", /*Fct*/ 3, /*In*/ 1, /*Out*/ 0, /*Par*/ 1); vxCheck->addInParam(0, paramN); // Edges. graph->connect( /*Src*/ vxA, /*SrcPrt*/ 0, /*Prod*/ "2", /*Snk*/ vxB, /*SnkPrt*/ 0, /*Cons*/ "N", /*Delay*/ "0", 0); graph->connect( /*Src*/ vxB, /*SrcPrt*/ 0, /*Prod*/ "N", /*Snk*/ vxCheck, /*SnkPrt*/ 0, /*Cons*/ "4*(N/3)+2", /*Delay*/ "0", 0); // Timings vxA->isExecutableOnAllPE(); vxA->setTimingOnType(0, "10", stack); vxB->isExecutableOnAllPE(); vxB->setTimingOnType(0, "10", stack); vxC->isExecutableOnAllPE(); vxC->setTimingOnType(0, "10", stack); vxCheck->isExecutableOnPE(0); vxCheck->setTimingOnType(0, "10", stack); // Subgraphs return graph; }
// Method building PiSDFGraphstereo PiSDFGraph* stereo(Archi* archi, Stack* stack) { PiSDFGraph* graph = CREATE(stack, PiSDFGraph)( /*Edges*/ 16, /*Params*/ 11, /*InputIf*/ 0, /*OutputIf*/ 0, /*Config*/ 1, /*Body*/ 12, /*Archi*/ archi, /*Stack*/ stack); /* Parameters */ PiSDFParam *param_nSlice = graph->addDynamicParam("nSlice"); PiSDFParam *param_truncValue = graph->addDynamicParam("truncValue"); PiSDFParam *param_scale = graph->addDynamicParam("scale"); PiSDFParam *param_nIter = graph->addDynamicParam("nIter"); PiSDFParam *param_sizeFilter = graph->addDynamicParam("sizeFilter"); PiSDFParam *param_minDisp = graph->addDynamicParam("minDisp"); PiSDFParam *param_maxDisp = graph->addDynamicParam("maxDisp"); PiSDFParam *param_height = graph->addDynamicParam("height"); PiSDFParam *param_width = graph->addDynamicParam("width"); PiSDFParam *param_size = graph->addDependentParam("size", "width*height"); PiSDFParam *param_sliceHeight = graph->addDependentParam("sliceHeight", "height/nSlice+2*sizeFilter"); /* Vertices */ PiSDFVertex* cf_Config = graph->addConfigVertex( /*Name*/ "Config", /*FctId*/ STEREO_CONFIG_FCT, /*SubType*/ PISDF_SUBTYPE_NORMAL, /*InData*/ 0, /*OutData*/ 0, /*InParam*/ 0, /*OutParam*/9); cf_Config->addOutParam(0, param_scale); cf_Config->addOutParam(1, param_maxDisp); cf_Config->addOutParam(2, param_minDisp); cf_Config->addOutParam(3, param_nSlice); cf_Config->addOutParam(4, param_truncValue); cf_Config->addOutParam(5, param_height); cf_Config->addOutParam(6, param_width); cf_Config->addOutParam(7, param_sizeFilter); cf_Config->addOutParam(8, param_nIter); cf_Config->isExecutableOnPE(CORE_ARM0); cf_Config->setTimingOnType(CORE_TYPE_ARM, "940", stack); PiSDFVertex* bo_Camera = graph->addBodyVertex( /*Name*/ "Camera", /*FctId*/ STEREO_CAMERA_FCT, /*InData*/ 0, /*OutData*/ 2, /*InParam*/ 2); bo_Camera->addInParam(0, param_width); bo_Camera->addInParam(1, param_height); bo_Camera->isExecutableOnPE(CORE_ARM0); bo_Camera->setTimingOnType(CORE_TYPE_ARM, "99175505", stack); PiSDFVertex* bo_Br_rgbL = graph->addSpecialVertex( /*Type*/ PISDF_SUBTYPE_BROADCAST, /*InData*/ 1, /*OutData*/ 3, /*InParam*/ 1); bo_Br_rgbL->addInParam(0, param_size); PiSDFVertex* bo_RGB2Gray_L = graph->addBodyVertex( /*Name*/ "RGB2Gray_L", /*FctId*/ STEREO_RGB2GRAY_L_FCT, /*InData*/ 1, /*OutData*/ 1, /*InParam*/ 1); bo_RGB2Gray_L->addInParam(0, param_size); // bo_RGB2Gray_L->isExecutableOnPE(CORE_ARM0); bo_RGB2Gray_L->isExecutableOnPE(CORE_DSP0); bo_RGB2Gray_L->isExecutableOnPE(CORE_DSP1); bo_RGB2Gray_L->isExecutableOnPE(CORE_DSP2); bo_RGB2Gray_L->isExecutableOnPE(CORE_DSP3); bo_RGB2Gray_L->isExecutableOnPE(CORE_DSP4); bo_RGB2Gray_L->isExecutableOnPE(CORE_DSP5); bo_RGB2Gray_L->isExecutableOnPE(CORE_DSP6); bo_RGB2Gray_L->isExecutableOnPE(CORE_DSP7); bo_RGB2Gray_L->setTimingOnType(CORE_TYPE_C6X, "39804751", stack); bo_RGB2Gray_L->setTimingOnType(CORE_TYPE_ARM, "216379565", stack); PiSDFVertex* bo_RGB2Gray_R = graph->addBodyVertex( /*Name*/ "RGB2Gray_R", /*FctId*/ STEREO_RGB2GRAY_R_FCT, /*InData*/ 1, /*OutData*/ 1, /*InParam*/ 1); bo_RGB2Gray_R->addInParam(0, param_size); // bo_RGB2Gray_R->isExecutableOnPE(CORE_ARM0); bo_RGB2Gray_R->isExecutableOnPE(CORE_DSP0); bo_RGB2Gray_R->isExecutableOnPE(CORE_DSP1); bo_RGB2Gray_R->isExecutableOnPE(CORE_DSP2); bo_RGB2Gray_R->isExecutableOnPE(CORE_DSP3); bo_RGB2Gray_R->isExecutableOnPE(CORE_DSP4); bo_RGB2Gray_R->isExecutableOnPE(CORE_DSP5); bo_RGB2Gray_R->isExecutableOnPE(CORE_DSP6); bo_RGB2Gray_R->isExecutableOnPE(CORE_DSP7); bo_RGB2Gray_R->setTimingOnType(CORE_TYPE_C6X, "39804751", stack); bo_RGB2Gray_R->setTimingOnType(CORE_TYPE_ARM, "216379565", stack); PiSDFVertex* bo_Br_grayL = graph->addSpecialVertex( /*Type*/ PISDF_SUBTYPE_BROADCAST, /*InData*/ 1, /*OutData*/ 2, /*InParam*/ 1); bo_Br_grayL->addInParam(0, param_size); PiSDFVertex* bo_Br_grayR = graph->addSpecialVertex( /*Type*/ PISDF_SUBTYPE_BROADCAST, /*InData*/ 1, /*OutData*/ 2, /*InParam*/ 1); bo_Br_grayR->addInParam(0, param_size); PiSDFVertex* bo_Census_L = graph->addBodyVertex( /*Name*/ "Census_L", /*FctId*/ STEREO_CENSUS_L_FCT, /*InData*/ 1, /*OutData*/ 1, /*InParam*/ 2); bo_Census_L->addInParam(0, param_width); bo_Census_L->addInParam(1, param_height); // bo_Census_L->isExecutableOnPE(CORE_ARM0); bo_Census_L->isExecutableOnPE(CORE_DSP0); bo_Census_L->isExecutableOnPE(CORE_DSP1); bo_Census_L->isExecutableOnPE(CORE_DSP2); bo_Census_L->isExecutableOnPE(CORE_DSP3); bo_Census_L->isExecutableOnPE(CORE_DSP4); bo_Census_L->isExecutableOnPE(CORE_DSP5); bo_Census_L->isExecutableOnPE(CORE_DSP6); bo_Census_L->isExecutableOnPE(CORE_DSP7); bo_Census_L->setTimingOnType(CORE_TYPE_C6X, "24216886", stack); bo_Census_L->setTimingOnType(CORE_TYPE_ARM, "237117295", stack); PiSDFVertex* bo_Census_R = graph->addBodyVertex( /*Name*/ "Census_R", /*FctId*/ STEREO_CENSUS_R_FCT, /*InData*/ 1, /*OutData*/ 1, /*InParam*/ 2); bo_Census_R->addInParam(0, param_width); bo_Census_R->addInParam(1, param_height); // bo_Census_R->isExecutableOnPE(CORE_ARM0); bo_Census_R->isExecutableOnPE(CORE_DSP0); bo_Census_R->isExecutableOnPE(CORE_DSP1); bo_Census_R->isExecutableOnPE(CORE_DSP2); bo_Census_R->isExecutableOnPE(CORE_DSP3); bo_Census_R->isExecutableOnPE(CORE_DSP4); bo_Census_R->isExecutableOnPE(CORE_DSP5); bo_Census_R->isExecutableOnPE(CORE_DSP6); bo_Census_R->isExecutableOnPE(CORE_DSP7); bo_Census_R->setTimingOnType(CORE_TYPE_C6X, "24216886", stack); bo_Census_R->setTimingOnType(CORE_TYPE_ARM, "237990935", stack); PiSDFVertex* bo_Split = graph->addBodyVertex( /*Name*/ "Split", /*FctId*/ STEREO_SPLIT_FCT, /*InData*/ 1, /*OutData*/ 1, /*InParam*/ 4); bo_Split->addInParam(0, param_width); bo_Split->addInParam(1, param_height); bo_Split->addInParam(2, param_nSlice); bo_Split->addInParam(3, param_sizeFilter); // bo_Split->isExecutableOnPE(CORE_ARM0); bo_Split->isExecutableOnPE(CORE_DSP0); bo_Split->isExecutableOnPE(CORE_DSP1); bo_Split->isExecutableOnPE(CORE_DSP2); bo_Split->isExecutableOnPE(CORE_DSP3); bo_Split->isExecutableOnPE(CORE_DSP4); bo_Split->isExecutableOnPE(CORE_DSP5); bo_Split->isExecutableOnPE(CORE_DSP6); bo_Split->isExecutableOnPE(CORE_DSP7); bo_Split->setTimingOnType(CORE_TYPE_C6X, "2711699", stack); bo_Split->setTimingOnType(CORE_TYPE_ARM, "6844795", stack); PiSDFVertex* bo_MedianFilter = graph->addBodyVertex( /*Name*/ "MedianFilter", /*FctId*/ STEREO_MEDIANFILTER_FCT, /*InData*/ 1, /*OutData*/ 1, /*InParam*/ 3); bo_MedianFilter->addInParam(0, param_width); bo_MedianFilter->addInParam(1, param_sizeFilter); bo_MedianFilter->addInParam(2, param_sliceHeight); // bo_MedianFilter->isExecutableOnPE(CORE_ARM0); bo_MedianFilter->isExecutableOnPE(CORE_DSP0); bo_MedianFilter->isExecutableOnPE(CORE_DSP1); bo_MedianFilter->isExecutableOnPE(CORE_DSP2); bo_MedianFilter->isExecutableOnPE(CORE_DSP3); bo_MedianFilter->isExecutableOnPE(CORE_DSP4); bo_MedianFilter->isExecutableOnPE(CORE_DSP5); bo_MedianFilter->isExecutableOnPE(CORE_DSP6); bo_MedianFilter->isExecutableOnPE(CORE_DSP7); bo_MedianFilter->setTimingOnType(CORE_TYPE_C6X, "62002973", stack); bo_MedianFilter->setTimingOnType(CORE_TYPE_ARM, "41294317", stack); PiSDFVertex* bo_Display = graph->addBodyVertex( /*Name*/ "Display", /*FctId*/ STEREO_DISPLAY_FCT, /*InData*/ 2, /*OutData*/ 0, /*InParam*/ 2); bo_Display->addInParam(0, param_width); bo_Display->addInParam(1, param_height); bo_Display->isExecutableOnPE(CORE_ARM0); bo_Display->setTimingOnType(CORE_TYPE_ARM, "422069685", stack); PiSDFVertex* bo_costParallel = graph->addHierVertex( /*Name*/ "costParallel", /*Graph*/ costParallel(archi, stack), /*InData*/ 5, /*OutData*/ 1, /*InParam*/ 7); bo_costParallel->addInParam(0, param_nIter); bo_costParallel->addInParam(1, param_height); bo_costParallel->addInParam(2, param_width); bo_costParallel->addInParam(3, param_maxDisp); bo_costParallel->addInParam(4, param_minDisp); bo_costParallel->addInParam(5, param_truncValue); bo_costParallel->addInParam(6, param_scale); /* Edges */ graph->connect( /*Src*/ bo_RGB2Gray_L, /*SrcPrt*/ 0, /*Prod*/ "(size)*1", /*Snk*/ bo_Br_grayL, /*SnkPrt*/ 0, /*Cons*/ "(size)*1", /*Delay*/ "0",0); graph->connect( /*Src*/ bo_RGB2Gray_R, /*SrcPrt*/ 0, /*Prod*/ "(size)*1", /*Snk*/ bo_Br_grayR, /*SnkPrt*/ 0, /*Cons*/ "(size)*1", /*Delay*/ "0",0); graph->connect( /*Src*/ bo_Camera, /*SrcPrt*/ 0, /*Prod*/ "(height*width)*3", /*Snk*/ bo_Br_rgbL, /*SnkPrt*/ 0, /*Cons*/ "(size)*3", /*Delay*/ "0",0); graph->connect( /*Src*/ bo_Br_rgbL, /*SrcPrt*/ 0, /*Prod*/ "(size)*3", /*Snk*/ bo_RGB2Gray_L, /*SnkPrt*/ 0, /*Cons*/ "(size)*3", /*Delay*/ "0",0); graph->connect( /*Src*/ bo_Br_rgbL, /*SrcPrt*/ 1, /*Prod*/ "(size)*3", /*Snk*/ bo_costParallel, /*SnkPrt*/ 4, /*Cons*/ "(width*height)*3", /*Delay*/ "0",0); graph->connect( /*Src*/ bo_Br_rgbL, /*SrcPrt*/ 2, /*Prod*/ "(size)*3", /*Snk*/ bo_Display, /*SnkPrt*/ 1, /*Cons*/ "(width*height)*3", /*Delay*/ "0",0); graph->connect( /*Src*/ bo_costParallel, /*SrcPrt*/ 0, /*Prod*/ "(height*width)*1", /*Snk*/ bo_Split, /*SnkPrt*/ 0, /*Cons*/ "(height*width)*1", /*Delay*/ "0",0); graph->connect( /*Src*/ bo_Split, /*SrcPrt*/ 0, /*Prod*/ "(nSlice*(height*width/nSlice+2*sizeFilter*width))*1", /*Snk*/ bo_MedianFilter, /*SnkPrt*/ 0, /*Cons*/ "(sliceHeight*width)*1", /*Delay*/ "0",0); graph->connect( /*Src*/ bo_MedianFilter, /*SrcPrt*/ 0, /*Prod*/ "(sliceHeight*width-2*sizeFilter*width)*1", /*Snk*/ bo_Display, /*SnkPrt*/ 0, /*Cons*/ "(height*width)*1", /*Delay*/ "0",0); graph->connect( /*Src*/ bo_Br_grayL, /*SrcPrt*/ 0, /*Prod*/ "(size)*1", /*Snk*/ bo_Census_L, /*SnkPrt*/ 0, /*Cons*/ "(height*width)*1", /*Delay*/ "0",0); graph->connect( /*Src*/ bo_Br_grayR, /*SrcPrt*/ 0, /*Prod*/ "(size)*1", /*Snk*/ bo_Census_R, /*SnkPrt*/ 0, /*Cons*/ "(height*width)*1", /*Delay*/ "0",0); graph->connect( /*Src*/ bo_Br_grayL, /*SrcPrt*/ 1, /*Prod*/ "(size)*1", /*Snk*/ bo_costParallel, /*SnkPrt*/ 2, /*Cons*/ "(height*width)*1", /*Delay*/ "0",0); graph->connect( /*Src*/ bo_Br_grayR, /*SrcPrt*/ 1, /*Prod*/ "(size)*1", /*Snk*/ bo_costParallel, /*SnkPrt*/ 3, /*Cons*/ "(height*width)*1", /*Delay*/ "0",0); graph->connect( /*Src*/ bo_Census_L, /*SrcPrt*/ 0, /*Prod*/ "(height*width)*1", /*Snk*/ bo_costParallel, /*SnkPrt*/ 0, /*Cons*/ "(height*width)*1", /*Delay*/ "0",0); graph->connect( /*Src*/ bo_Census_R, /*SrcPrt*/ 0, /*Prod*/ "(height*width)*1", /*Snk*/ bo_costParallel, /*SnkPrt*/ 1, /*Cons*/ "(height*width)*1", /*Delay*/ "0",0); graph->connect( /*Src*/ bo_Camera, /*SrcPrt*/ 1, /*Prod*/ "(height*width)*3", /*Snk*/ bo_RGB2Gray_R, /*SnkPrt*/ 0, /*Cons*/ "(size)*3", /*Delay*/ "0",0); return graph; }
int main(int argc, char* argv[]){ SpiderConfig cfg; ExecutionStat stat; initActors(); DynStack pisdfStack("PisdfStack"); DynStack archiStack("ArchiStack"); #define SH_MEM 0x00500000 PlatformK2Arm platform(4, 8, SH_MEM, &archiStack, daq_fft_fcts, N_FCT_DAQ_FFT); Archi* archi = platform.getArchi(); cfg.memAllocType = MEMALLOC_SPECIAL_ACTOR; cfg.memAllocStart = (void*)0; cfg.memAllocSize = SH_MEM; cfg.schedulerType = SCHEDULER_LIST; cfg.srdagStack = {STACK_DYNAMIC, "SrdagStack", 0, 0}; cfg.transfoStack = {STACK_DYNAMIC, "TransfoStack", 0, 0}; spider_init(cfg); printf("Start\n"); try{ PiSDFGraph *topPisdf = init_daq_fft(archi, &pisdfStack); topPisdf->print("topPisdf.gv"); for(int i=0; i<2; i++){ Platform::get()->rstTime(); spider_launch(archi, topPisdf); spider_printGantt(archi, spider_getLastSRDAG(), "dac_fft_group_fixed.pgantt", "dac_fft_group_fixed.tex", &stat); spider_getLastSRDAG()->print("dac_fft_group.gv"); printf("EndTime = %ld ms\n", stat.globalEndTime/1000000); printf("Memory use = "); if(stat.memoryUsed < 1024) printf("\t%5.1f B", stat.memoryUsed/1.); else if(stat.memoryUsed < 1024*1024) printf("\t%5.1f KB", stat.memoryUsed/1024.); else if(stat.memoryUsed < 1024*1024*1024) printf("\t%5.1f MB", stat.memoryUsed/1024./1024.); else printf("\t%5.1f GB", stat.memoryUsed/1024./1024./1024.); printf("\n"); FILE* f = fopen("timings.csv", "w+"); fprintf(f, "Actors,c6678,CortexA15\n"); Time fftTime = 0; printf("Actors:\n"); for(int j=0; j<stat.nbActor; j++){ printf("\t%12s:", stat.actors[j]->getName()); fprintf(f, "%s", stat.actors[j]->getName()); for(int k=0; k<archi->getNPETypes(); k++){ if(stat.actorIterations[j][k] > 0){ printf("\t(%d): %8ld (x%ld)", k, stat.actorTimes[j][k]/stat.actorIterations[j][k], stat.actorIterations[j][k]); fprintf(f, ",%ld", stat.actorTimes[j][k]/stat.actorIterations[j][k]); }else{ printf("\t(%d): 0 (x0)", k); fprintf(f, ",%ld", (Time)-1); } } if(strcmp(stat.actors[j]->getName(), "T_1") == 0){ fftTime -= stat.actorFisrt[j]; } if(strcmp(stat.actors[j]->getName(), "T_6") == 0){ fftTime += stat.actorLast[j]; } printf("\n"); fprintf(f, "\n"); } printf("fftTime = %ld us\n", fftTime/1000); } free_daq_fft(topPisdf, &pisdfStack); }catch(const char* s){ printf("Exception : %s\n", s); } printf("finished\n"); spider_free(); return 0; }
// Method building PiSDFGraphDFT_Radix2 PiSDFGraph* DFT_Radix2(Archi* archi, Stack* stack){ PiSDFGraph* graph = CREATE(stack, PiSDFGraph)( /*Edges*/ 4, /*Params*/ 5, /*InputIf*/ 1, /*OutputIf*/ 1, /*Config*/ 0, /*Body*/ 3, /*Archi*/ archi, /*Stack*/ stack); /* Parameters */ PiSDFParam *param_N1 = graph->addHeritedParam("N1", 0); PiSDFParam *param_N2 = graph->addHeritedParam("N2", 1); PiSDFParam *param_n1 = graph->addHeritedParam("n1", 2); PiSDFParam *param_P = graph->addHeritedParam("P", 3); PiSDFParam *param_size = graph->addDependentParam("size", "N1*N2"); /* Vertices */ PiSDFVertex* bo_Br = graph->addSpecialVertex( /*Type*/ PISDF_SUBTYPE_BROADCAST, /*InData*/ 1, /*OutData*/ 2, /*InParam*/ 1); bo_Br->addInParam(0, param_size); PiSDFVertex* if_out = graph->addOutputIf( /*Name*/ "if_out", /*InParam*/ 1); if_out->addInParam(0, param_size); PiSDFVertex* if_in = graph->addInputIf( /*Name*/ "if_in", /*InParam*/ 1); if_in->addInParam(0, param_size); PiSDFVertex* bo_genIx = graph->addBodyVertex( /*Name*/ "genIx", /*FctId*/ DFT_RADIX2_GENIX_FCT, /*InData*/ 0, /*OutData*/ 1, /*InParam*/ 1); bo_genIx->addInParam(0, param_P); // bo_genIx->isExecutableOnPE(CORE_ARM0); // bo_genIx->isExecutableOnPE(CORE_ARM1); // bo_genIx->isExecutableOnPE(CORE_ARM2); // bo_genIx->isExecutableOnPE(CORE_ARM3); bo_genIx->isExecutableOnPE(CORE_DSP0); bo_genIx->isExecutableOnPE(CORE_DSP1); bo_genIx->isExecutableOnPE(CORE_DSP2); bo_genIx->isExecutableOnPE(CORE_DSP3); bo_genIx->setTimingOnType(CORE_TYPE_C6X, "100", stack); bo_genIx->setTimingOnType(CORE_TYPE_ARM, "100", stack); PiSDFVertex* bo_Radix2_Stage = graph->addHierVertex( /*Name*/ "Radix2_Stage", /*Graph*/ Radix2_Stage(archi, stack), /*InData*/ 2, /*OutData*/ 1, /*InParam*/ 3); bo_Radix2_Stage->addInParam(0, param_N1); bo_Radix2_Stage->addInParam(1, param_N2); bo_Radix2_Stage->addInParam(2, param_n1); /* Edges */ graph->connect( /*Src*/ bo_genIx, /*SrcPrt*/ 0, /*Prod*/ "(P)*4", /*Snk*/ bo_Radix2_Stage, /*SnkPrt*/ 0, /*Cons*/ "(1)*4", /*Delay*/ "0",0); graph->connect( /*Src*/ bo_Radix2_Stage, /*SrcPrt*/ 0, /*Prod*/ "(N1*N2)*4", /*Snk*/ bo_Br, /*SnkPrt*/ 0, /*Cons*/ "(size)*4", /*Delay*/ "0",0); graph->connect( /*Src*/ bo_Br, /*SrcPrt*/ 0, /*Prod*/ "(size)*4", /*Snk*/ if_out, /*SnkPrt*/ 0, /*Cons*/ "(size)*4", /*Delay*/ "0",0); graph->connect( /*Src*/ bo_Br, /*SrcPrt*/ 1, /*Prod*/ "(size)*4", /*Snk*/ bo_Radix2_Stage, /*SnkPrt*/ 1, /*Cons*/ "(N1*N2)*4", /*Delay*/ "(size)*4",if_in); return graph; }