Instruction Scheduling Using MaxMin Ant System Optimization Gang

  • Slides: 35
Download presentation
Instruction Scheduling Using Max-Min Ant System Optimization Gang Wang, Wenrui Gong, and Ryan Kastner

Instruction Scheduling Using Max-Min Ant System Optimization Gang Wang, Wenrui Gong, and Ryan Kastner Dept. of Electrical and Computer Engineering University of California, Santa Barbara GLSVLSI’ 2005, Chicago, April 18, 2005

Instruction Scheduling v Instruction Scheduling is a fundamental synthesis problem v Software - compilers

Instruction Scheduling v Instruction Scheduling is a fundamental synthesis problem v Software - compilers for microprocessors v Hardware - behavioral synthesis for ASIC, FPGA v Requisite Moore’s Law reference v Moore transistors = moore computational resources v Larger applications = moore operations v How to best utilize the resources?

Instruction Scheduling Definition Given a set of instructions and collection of computational units v

Instruction Scheduling Definition Given a set of instructions and collection of computational units v Instruction modeled using data flow graph (DFG) v Directed acyclic graph v Each node is instruction v Each edge is a data dependence v Find schedule for instructions to minimize some function (latency, area, power, …) v We focus on resource constrained problem, i. e. minimize latency given a set of resources. v Auto Regressive Filter

Instruction Scheduling NP-hard v Fundamental problem - many different heuristic methods have been developed

Instruction Scheduling NP-hard v Fundamental problem - many different heuristic methods have been developed v ILP v Force directed v Genetic algorithm v Path based v Graph theoretic v Computational geometry v List scheduling start v 1 2 v 3 3 - v 4 4 v 2 - v 6 v 8 + v 10 v 7 + v 9 < v 5 end vn v 11

List Scheduling v Simple and effective Greedy strategy v Operation selection decided by criticality

List Scheduling v Simple and effective Greedy strategy v Operation selection decided by criticality v O(n) time complexity v Make a priority list of the instructions based on some measure (mobility, instruction depth, number of successors, etc. ) v No single priority function works well over all applications v Highly dependent on problem instance v Solution quality varies greatly across different functions v

List Scheduling Procedure List. Scheduling(G, R, L) Input: DFG(V, E), resource set R, priority

List Scheduling Procedure List. Scheduling(G, R, L) Input: DFG(V, E), resource set R, priority list L Output: instruction schedule start 1 v 1 2 v 3 3 - v 4 4 v 2 1. cycle 0 2. Ready. List successors of start v 6 v 8 + v 10 v 7 + v 9 < v 11 3. While node end is not scheduled do 4. 5. 6. - v 5 end vn for op in Ready. List in decending priority do if resource exists for op to start then schedule op at time cycle 7. end if 8. Update Ready. List 9. end for 10. cycle + 1 11. end while 12. return schedule

Our approach – Ant System Heuristic v Inspired by ethological study on the behavior

Our approach – Ant System Heuristic v Inspired by ethological study on the behavior of ants [Goss et al. 1989] v A meta heuristic v A multi-agent cooperative searching method v A new way for combining global/local heuristics v Extensible and flexible

Ant System Heuristic

Ant System Heuristic

Ant System Heuristic

Ant System Heuristic

Ant System Heuristic

Ant System Heuristic

Ant System Heuristic

Ant System Heuristic

Ant System Heuristic

Ant System Heuristic

Ant System Heuristic

Ant System Heuristic

Ant System Heuristic

Ant System Heuristic

Ant System Heuristic

Ant System Heuristic

Ant System Heuristic

Ant System Heuristic

Autocatalytic Effect

Autocatalytic Effect

Formulating Problems Using Ant Search Problem model – define search space, create decision variables

Formulating Problems Using Ant Search Problem model – define search space, create decision variables v Pheromone model – used as a global heuristic, distribution of pheromones, evaporation and strengthening strategies v Ant search strategy – local heuristics and solution space traversal v Solution construction – method of creating an answer from decision variables v Feedback – provide assessment of solution quality and adjust pheromones accordingly v

Hybrid Ants with Lists v Combine Ant System Optimization and List Scheduling v Ants

Hybrid Ants with Lists v Combine Ant System Optimization and List Scheduling v Ants determine priority list v List scheduling framework evaluates the “goodness” of the list v Iterative approach

Pheromone Model For Instruction Scheduling Each instruction also has a dynamic local heuristic op

Pheromone Model For Instruction Scheduling Each instruction also has a dynamic local heuristic op 1 1 op 2 2 op 3 3 op 4 4 op 5 5 op 6 6 Instructions Priority List Each instruction opi I associated with n pheromone trails where j = 1, …, n which indicate the favorableness of assign instruction i to position j

Ant Search Strategy v op 1 op 4 1 op 2 op 1 2

Ant Search Strategy v op 1 op 4 1 op 2 op 1 2 op 3 op 5 3 op 4 op 6 4 op 5 op 2 5 op 6 op 3 6 Instructions Priority List v v Multiple ants independently create their own priority list Fill one instruction at a time Iterative process

Ant Search Strategy v op 1 op 4 1 op 2 op 1 2

Ant Search Strategy v op 1 op 4 1 op 2 op 1 2 op 3 op 5 3 op 4 4 op 5 5 op 6 6 Instructions Priority List v v Each ant has memory about instructions already selected At step j ant has already selected j-1 instructions jth instruction selected probabilistically

Ant Search Strategy v ij(k) : global heuristic (pheromone) for selecting instruction i at

Ant Search Strategy v ij(k) : global heuristic (pheromone) for selecting instruction i at j position v j(k) : local heuristic – can use different properties Instruction mobility (IM) v Instruction depth (ID) v Latency weighted instruction depth (LWID) v Successor number (SN) v v , control influence of global and local heuristics

Pheromone Update v v Priority lists evaluated using list scheduling Latency Lh for the

Pheromone Update v v Priority lists evaluated using list scheduling Latency Lh for the result from ant h Evaporation – prevent stigmergy and punish “useless” trails Reinforcement – award trails with better quality

Pheromone Update Evaporation happens on all trails v Reward the used trails based on

Pheromone Update Evaporation happens on all trails v Reward the used trails based on the solution’s quality v op 1 op 4 1 op 2 op 1 2 op 3 op 5 3 op 4 op 6 4 op 5 op 2 5 op 6 op 3 6 Instructions Priority List

Max-Min Ant System (MMAS) v Risks of Ant System optimization Too much feedback v

Max-Min Ant System (MMAS) v Risks of Ant System optimization Too much feedback v Dynamic range of pheromone trails can increase rapidly v Limited search of solution space v v Unused trails can be repetitively punished, therefore certain schedules may never be selected v Premature convergence v MMAS is designed to address this problem Built upon original AS v Idea is to limit the pheromone trails within an evolving bound so that more broader exploration is possible v Better balance the exploration and exploitation v Prevent premature convergence v

Max-Min Ant System (MMAS) v Limit (t) within min(t) and max(t) v v Sgb

Max-Min Ant System (MMAS) v Limit (t) within min(t) and max(t) v v Sgb is the best global solution found so far at t-1 f(. ) is the quality evaluation function, e. g. latency in our case avg is the average size of decision choices Pbest (0, 1] is the controlling parameter v v Smaller Pbest tighter range for more emphasis on exploration When Pbest 0, we set min max

Other Algorithmic Refinements v Dynamically evolving local heuristics v Example: dynamically adjust instruction mobility

Other Algorithmic Refinements v Dynamically evolving local heuristics v Example: dynamically adjust instruction mobility v Benefit: dynamic search space reduction v Taking advantage of topological sorting of DFG when constructing priority list v Each step ants select from the ready instructions instead from all unscheduled instructions v Benefit: greatly reduce the search space

MMAS Instruction Scheduling Algorithm

MMAS Instruction Scheduling Algorithm

ARF Pheromones

ARF Pheromones

Experimental Results Benchmark (nodes/edges) Resources CPLEX (latency /runtime) Force Directed List Scheduling IM ID

Experimental Results Benchmark (nodes/edges) Resources CPLEX (latency /runtime) Force Directed List Scheduling IM ID LWID MMAS-IS (average over 5 runs) SN IM ID LWID SN HAL(21/25) la, lfm, lm, 3 i, 3 o 8/32 8 8 8 9 8 8 8 ARF(28/30) 2 a, lfm, 2 m 11/22 11 11 13 13 13 11 11 EWF(34/47) la, lfm, lm 27 /24000 28 28 31 31 28 27. 2 27 27. 2 FIR 1 (40/39) 2 a, 2 m, 3 i, 3 o 13/232 19 19 18 17. 2 17 17. 8 FIR 2(44/43) la, lfm, lm, 3 i, 3 o 14/11560 19 19 21 21 21 16. 2 16. 4 16. 2 17 COSINE 1(66/76) 2 a, 2 m, lfm, 3 i, 3 o 18 19 20 18 18 17. 4 18. 2 17. 6 COSINE 2(82/91) 2 a, 2 m, lfm, 3 i, 3 o 23 23 23 21. 2 18 18. 2 19. 3 20. 5 18. 5 16. 8 17. 0 16. 9 17. 1 Average v v ILP (optimal) using CPLEX List scheduling v v Instruction mobility (IM), instruction depth (ID), latency weighted instruction depth (LWID), successor number (SN) Ant scheduling results using different local heuristics (Averaged over 5 runs, each run 100 iteration with 5 ants)

Conclusion v Proposed a novel heuristic method for resourceconstrained instruction scheduling problem Hybrid MMAS

Conclusion v Proposed a novel heuristic method for resourceconstrained instruction scheduling problem Hybrid MMAS and List Scheduling v Create a mathematic model for combining global and local heuristics v v Experiment results are promising Near optimal results v Outperforms widely used force-directed approach v More stable and insensitive to choice of application/local heuristics v v Thanks! Questions?

Extra Slides

Extra Slides

DFG Size Distribution

DFG Size Distribution

Auto Regressive Filter

Auto Regressive Filter