User Tools

Site Tools


schedule_code_generator_for_code_with_subsystem

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
schedule_code_generator_for_code_with_subsystem [2014/07/07 14:33]
yun [TargetMapping for the Matrix Multiplication Example]
schedule_code_generator_for_code_with_subsystem [2014/07/07 14:58]
yun [TargetMapping for the Matrix Multiplication Example]
Line 39: Line 39:
  
 In order for schedule code generator to generate the code, other than specify the schedule for the useEquation, a schedule has to be specified for each special statement of each input/ouput of the useEquation.  In order for schedule code generator to generate the code, other than specify the schedule for the useEquation, a schedule has to be specified for each special statement of each input/ouput of the useEquation. 
 +
 +The following command set the SpaceTimeMap for the (n)th input/output of a useEuqation identified with lable:
 +<sxh cs; gutter:false>
 +setSpaceTimeMapForUseEquationOptimization(program, system, label, isInput, n, SpaceTimeMapForMalloc, SpaceTimeMapForValueCopy, SpaceTimeMapForMemoryFree);
 +</sxh>
 +The parameter isInput sepcifies whether the SpaceTimeMap is specified for input or not, and the last three prarameter specifies the space time map for the three special statement attached to the current input/output. Those specification can also be specified separately with the following command:
 +<sxh cs; gutter:false>
 +setSpaceTimeMapForMemoryAllocation(program, system, label, isInput, n, SpaceTimeMap);
 +setSpaceTimeMapForValueCopy(program, system, label, isInput, n, SpaceTimeMap);
 +setSpaceTimeMapForMemoryFree(program, system, label, isInput, n, SpaceTimeMap);
 +</sxh>
 +
 +The following script consists all the commands that specifies the TargetMapping for the matrix multiplication example and generates the code.
 +<sxh cs; gutter:false>
 +prog = ReadAlphabets("./Matrix_product_SubSyst.ab");
 +rootSystem = "matrix_product_SubSyst";
 +subSystem = "dot_product";
 +outDir = "./test-out/"+ rootSystem;
 +CheckProgram(prog);
 +
 +#set the spacetimeMap for the subSystem first
 +setSpaceTimeMap(prog, subSystem, "temp", "(i->i)");
 +setSpaceTimeMap(prog, subSystem, "Res", "(->N)");
 +
 +#the identification lable for the useEquation
 +label = "UseEquation_C";
 +
 +#set the spacetimeMap for the rootSystem
 +#set the spacetimeMap for the main subsystem call
 +setSpaceTimeMap(prog, rootSystem, label, "(ip,jp->1,ip,jp,2)");
 +
 +#set the SpaceTimeMap for the first input of the useEquation
 +setSpaceTimeMapForMemoryAllocation(prog, rootSystem, label, 0, 0, "(ip,jp->0,0,0,0)");
 +setSpaceTimeMapForValueCopy(prog, rootSystem, label, 0, 0, "(ip,jp->1,ip,jp,0)");
 +setSpaceTimeMapForMemoryFree(prog, rootSystem, label, 0, 0, "(ip,jp->2,0,0,0)");
 +
 +#set the SpaceTimeMap for the second input of the useEquation
 +setSpaceTimeMapForUseEquationOptimization(prog, rootSystem, label, 0, 1, "(ip,jp->0,0,0,1)", "(ip,jp->1,ip,jp,1)", "(ip,jp->2,0,0,1)");
 +
 +#set the spaceTimeMap for the first output of the useEquation
 +setSpaceTimeMapForUseEquationOptimization(prog, rootSystem, label, 1, 0, "(ip,jp->0,0,0,2)", "(ip,jp->1,ip,jp,3)", "(ip,jp->2,0,0,2)");
 +
 +generateScheduledCode(prog, rootSystem, outDir);
 +generateWrapper(prog, rootSystem, outDir);
 +generateMakefile(prog, rootSystem, outDir);
 +</sxh>
 +
 +====TargetMapping for Optimization====
 +
  
  
  
schedule_code_generator_for_code_with_subsystem.txt ยท Last modified: 2017/04/19 13:31 (external edit)