public virtual bool Optimize( out InstructionGraph instructionGraph, out RegisterAssignment registerAssignment, out InstructionSchedule instructionSchedule) { return selector.Optimize(out instructionGraph, out registerAssignment, out instructionSchedule); }
public virtual InstructionSchedule Clone(IDictionary instructionMap) { InstructionSchedule clone = new InstructionSchedule(); foreach (InstructionNode[] step in instructions) { InstructionNode[] cloneStep = new InstructionNode[step.Length]; for (int i = 0; i < step.Length; i++) { if (step[i] != null) cloneStep[i] = (InstructionNode) instructionMap[step[i]]; else cloneStep[i] = null; } clone.instructions.Add(cloneStep); } return clone; }
public virtual bool Optimize( out InstructionGraph instructionGraph, out RegisterAssignment registerAssignment, out InstructionSchedule instructionSchedule) { Run(); if (Done != null) Done(this); if (BestGenome.IsValid) { instructionGraph = BestGenome.InstructionGraph; registerAssignment = BestGenome.RegisterAssignment; instructionSchedule = BestGenome.InstructionSchedule; return true; } else { instructionGraph = null; instructionSchedule = null; registerAssignment = null; return false; } }
public virtual bool Optimize( out RegisterAssignment registerAssignment, out InstructionSchedule instructionSchedule) { Run(); if (Done != null) Done(this); registerAssignment = BestGenome.GetRegisterAssignment(); instructionSchedule = BestGenome.GetInstructionSchedule(); return BestGenome.IsValid; }
public virtual void Initialize() { IDictionary valueInitialized = new Hashtable(); foreach (ValueNode val in ValueNodes) valueInitialized[val] = false; foreach (ValueNode val in ProgramGraph.OutputValues) InitializeValue(val, valueInitialized); instructionSchedule = null; registerAssignment = null; instructionGraph = null; /* bestSchedulingGenome = null; */ }
public virtual void Copy(IGenome otherGenome) { SelectionGenome other = (SelectionGenome) otherGenome; population = other.population; isValid = other.isValid; modified = other.modified; objective = other.objective; if (other.instructionGraph != null) { IDictionary instructionMap; IDictionary valueMap; instructionGraph = other.instructionGraph.Clone( out instructionMap, out valueMap); if (other.registerAssignment != null && other.instructionSchedule != null) { registerAssignment = other.registerAssignment.Clone(valueMap); instructionSchedule = other.instructionSchedule.Clone(instructionMap); /* bestSchedulingGenome = other.bestSchedulingGenome.Clone( instructionMap, valueMap); */ } else { registerAssignment = null; instructionSchedule = null; /* bestSchedulingGenome = null; */ } } else { instructionGraph = null; } foreach (OperationNode op in OperationNodes) selection[op] = other.selection[op]; }
public virtual InstructionSchedule GetInstructionSchedule() { InstructionSchedule instructionSchedule = new InstructionSchedule(); for (int i = 0; i < ScheduleLength; i++) { InstructionNode[] step = new InstructionNode[ MachineDescription.ExecutionUnits]; for (int j = 0; j < step.Length; j++) step[j] = Schedule[i, j]; instructionSchedule.Instructions.Add(step); } return instructionSchedule; }