1(18) Using Constraint Programming for Embedded System Radoslaw Szymanek Department of Computer Science Lund Institute of Technology Sweden Email: Radoslaw.Szymanek@cs.lth.se 2(18) Embedded System performs computation but it is not a general purpose computer usually performs computation to achieve given goal/functionality mobile phones, home appliances, security and safety systems Radoslaw Szymanek January 13, 2004 3(18) Issuses within Embedded Systems minimal cost and maximal functionality memory issues - increased audio/video requirements early good optimization can achieve substanstial gains Radoslaw Szymanek January 13, 2004 4(18) Scheduling Problem heterogeneous multiprocessor system parallel computation and communication heterogeneous constraints - time, memory constraints Radoslaw Szymanek January 13, 2004 5(18) Constraint description of Scheduling Problem diffn, cumulative, element constraints arithmetic constraints resource constrained scheduling Radoslaw Szymanek January 13, 2004 6(18) Optimization requires search heuristic resource based criteria in optimization function reneweable (data memory) and non reneweable resources (time and code memory) Radoslaw Szymanek January 13, 2004 7(18) Result easy to extend the model easy to answer ad-hoc questions, what if? guided search methods Radoslaw Szymanek January 13, 2004 8(18) Memory Intricacies current memory systems allow fast access under given conditions high penalties if conditions not respected high number of memory modules to increase effectiveness Radoslaw Szymanek January 13, 2004 9(18) SDRAM memory high bandwidth can be obtained if used with care U=2 P=2 B0 B1 P0 P1 S=4 S1 Radoslaw Szymanek S2 January 13, 2004 S3 S4 t 10(18) SDRAM memory page buffers requires special access patterns U=2 P=2 B0 B1 P0 P1 S=4 S1 Radoslaw Szymanek S2 January 13, 2004 S3 S4 t 11(18) SDRAM memory interleaved data access possible from multiple open page buffers U=2 P=2 B0 B1 P0 P1 S=4 S1 Radoslaw Szymanek S2 January 13, 2004 S3 S4 t 12(18) Memory Bandwidth Modeling main bottleneck in current applications diffn constraints for page reservation during data access cumulative constraints for size constraints cumulative for memory bandwidth constraints Radoslaw Szymanek January 13, 2004 13(18) Application Execution Flexibility each task can execute in fixed number of possible ways each execution option indicates optimal operation scheduling within a task operation scheduling freedom restricted to few representative choices application execution flexibility obtained by task execution flexibility Radoslaw Szymanek January 13, 2004 14(18) Time and Energy Pareto Application Diagram Hierarchical composition of application task Pareto Diagrams T2 TN time T1 App time TN−1 time energy energy energy energy energy Energy consumption is a sum of execution consumption of tasks time time Task energy consumption depends on the option chosen Execution time of the application depends on scheduling and task execution option Radoslaw Szymanek January 13, 2004 15(18) Conflict Graph Constraints Specifies relation between task data which needs to be satisfied Memory conflict constraint requires two data to be stored in different memory Page conflict constraint requires two data to be stored in such a way that they are accessed from different pages Memory compatibility specifies that two data must be stored in the same memory Bank compatibility can be used to facilitates page sharing during data access Radoslaw Szymanek January 13, 2004 16(18) Application execution optimization Find for each task appropriate execution option Find best assignment from bandwidth and size point of view Find best scheduling for given tasks execution options and data assignment Compute constraints for assignment improvement Find better assignment and reschedule application Radoslaw Szymanek January 13, 2004 17(18) Memory conclusions Problem divided into 3 subproblems Estimates used for the unknown parameters Solution to each step gives possibility to improve results of the previous stage Global constraints and tailored search methods Radoslaw Szymanek January 13, 2004 18(18) Conclusions Heterogeneous problems and specific search methods Adaptability Global constraints and search methods JaCoP - our own constraint solver written in Java Radoslaw Szymanek January 13, 2004