TraceDotGraph.dumpGraph(initList, partitioner.io, "inittraces.dot", true); TraceDotGraph.dumpGraph(schedule, partitioner.io, "steadyforrest.dot", true);
TraceDotGraph.dumpGraph(scheduler.getInitSchedule(), partitioner.io, "inittraces.dot", true); TraceDotGraph.dumpGraph(scheduler.getSchedule(), partitioner.io, "steadyforrest.dot", true);
    public static void run(SIRStream str,			   JInterfaceDeclaration[] 			   interfaces,			   SIRInterfaceTable[]			   interfaceTables,			   SIRStructure[]			   structs) {	structures = structs;		//first of all enable altcodegen by default	KjcOptions.altcodegen = true;	int rawRows = -1;	int rawColumns = -1;	//set number of columns/rows	rawRows = KjcOptions.raw;	if(KjcOptions.rawcol>-1)	    rawColumns = KjcOptions.rawcol;	else	    rawColumns = KjcOptions.raw;	//create the RawChip	RawChip rawChip = new RawChip(rawColumns, rawRows);	// move field initializations into init function	FieldInitMover.moveStreamInitialAssignments(str);			// propagate constants and unroll loop	System.out.println("Running Constant Prop and Unroll...");	ConstantProp.propagateAndUnroll(str);	System.out.println("Done Constant Prop and Unroll...");	// add initPath functions        EnqueueToInitPath.doInitPath(str);	// construct stream hierarchy from SIRInitStatements	ConstructSIRTree.doit(str);	//VarDecl Raise to move array assignments up	new VarDeclRaiser().raiseVars(str);	// do constant propagation on fields        if (KjcOptions.nofieldprop) {	} else {	    System.out.println("Running Constant Field Propagation...");	    FieldProp.doPropagate(str);	    System.out.println("Done Constant Field Propagation...");	}	Lifter.liftAggressiveSync(str);       	StreamItDot.printGraph(str, "before-partition.dot");	//	str = Partitioner.doit(str, 32);	//VarDecl Raise to move array assignments up	new VarDeclRaiser().raiseVars(str);		//VarDecl Raise to move peek index up so	//constant prop propagates the peek buffer index	new VarDeclRaiser().raiseVars(str);	//this must be run now, other pass rely on it...	RenameAll.renameOverAllFilters(str);		//SIRPrinter printer1 = new SIRPrinter();	//IterFactory.createFactory().createIter(str).accept(printer1);	//printer1.close();		//Linear Analysis	LinearAnalyzer lfa=null;	if(KjcOptions.linearanalysis||KjcOptions.linearpartition) {	    System.out.println("Running linear analysis... ");	    lfa=LinearAnalyzer.findLinearFilters(str,KjcOptions.debug,false);	    System.out.println("Done with linear analysis.");	    LinearDot.printGraph(str,"linear.dot",lfa);	    LinearDotSimple.printGraph(str,"linear-simple.dot",lfa,null);	}		//get the execution counts from the scheduler	HashMap[] executionCounts=SIRScheduler.getExecutionCounts(str);	//flatten the graph by running (super?) synch removal	FlattenGraph.flattenGraph(str,lfa,executionCounts);	UnflatFilter[] topNodes=FlattenGraph.getTopLevelNodes();	System.out.println("Top Nodes:");	for(int i=0;i<topNodes.length;i++)	    System.out.println(topNodes[i]);	Trace[] traces=null;	Trace[] traceGraph=null; //used if REAL	//get the work estimation	WorkEstimate work = WorkEstimate.getWorkEstimate(str);	SimplePartitioner partitioner = new SimplePartitioner(topNodes,executionCounts,lfa, work, rawChip);	traceGraph = partitioner.partition();	System.out.println("UnPrunnedTraces: "+traceGraph.length);	partitioner.dumpGraph("traces.dot");    	/*System.gc();	  System.out.println("MEM: "+(Runtime.getRuntime().totalMemory()-Runtime.getRuntime().freeMemory()));*/	StreaMITMain.clearParams();	FlattenGraph.clear();	AutoCloner.clear();	SIRContainer.destroy();	UnflatEdge.clear();	str=null;	interfaces=null;	interfaceTables=null;	structs=null;	structures=null;	lfa=null;	executionCounts=null;	topNodes=null;	System.gc();	//----------------------- This Is The Line -----------------------	//No Structure, No SIRStreams, Old Stuff Restricted Past This Point	//Violators Will Be Garbage Collected		LinkedList schedule = (new SimpleScheduler(partitioner, rawChip)).schedule();	SchedulePrimePump.doit(schedule);		//mgordon's stuff	assert !KjcOptions.magicdram : 	    "Magic DRAM support is not working";		List initList = InitSchedule.getInitSchedule(partitioner.topTraces);		TraceDotGraph.dumpGraph(schedule, partitioner.io, "preDRAMsteady.dot", false);	//assign the buffers not assigned by Jasp to drams	BufferDRAMAssignment.run(schedule, rawChip, partitioner.io);	//communicate the addresses for the off-chip buffers	if (!KjcOptions.magicdram) {	    //so right now, this pass does not communicate addresses	    //but it generates the declarations of the buffers	    //on the corresponding tile.	    CommunicateAddrs.doit(rawChip);	}	TraceDotGraph.dumpGraph(initList, partitioner.io, "inittraces.dot", true);	TraceDotGraph.dumpGraph(schedule, partitioner.io, "steadyforrest.dot", true);	//create the raw execution code and switch code for the initialization phase	System.out.println("Creating Initialization Stage");	Rawify.run(initList.iterator(), rawChip, true); 	//create the raw execution code and switch for the steady-state	System.out.println("Creating Steady-State Stage");	Rawify.run(schedule.iterator(), rawChip, false);	//dump the layout	LayoutDot.dumpLayout(rawChip, "layout.dot");	//generate the switch code assembly files...	GenerateSwitchCode.run(rawChip);	//generate the compute code from the SIR	GenerateComputeCode.run(rawChip);	//generate the magic dram code if enabled	if (KjcOptions.magicdram) {	    MagicDram.GenerateCode(rawChip);	}	Makefile.generate(rawChip);	//generate the bc file depending on if we have number gathering enabled	if (KjcOptions.numbers > 0)	    BCFile.generate(rawChip, NumberGathering.doit(rawChip, partitioner.io));	else 	    BCFile.generate(rawChip, null);    }