CS243: Program Analysis and Optimization Winter 2018This page is updated frequently, so check back often. All materials for the course will be posted here.
What do we teach?
This course teaches program analysis techniques used in compilers and software development tools to improve productivity, reliability, and security. Emphasis on the methodology of applying mathematical abstractions such as graphs, fixpoint computations and binary decision diagrams to writing complex software, using compilers as an example.
How do you learn this?
This is a course where math and programming meet. Learning compiler techniques has much in common with learning mathematical proofs. You learn by trying, finding your own insights. This means the assignments can take a variable amount of time! We want you to formulate your own variations of problems and solve them.
How is the course structured?
- Highly interactive lectures, textbook reading.
- Programming assignments analyze Java code.
- Problem sessions for discussion.
- Piazza for offline questions.
- Midterm and Final.
Logistics When, where, what and how
|Lectures||Monday and Wednesday 4:30 pm - 5:50pm in Gates B01|
|Review Session||Friday 11:30am - 12:20pm in Skilling Aud|
|Prerequisites||CS 103 or CS 103B, and CS 107; Java programming language experience|
|Textbook||Compilers: Principles, Techniques, & Tools (Second Edition), Alfred V. Aho, Monica S. Lam, Ravi Sethi, Jeffrey D. Ullman, Addison-Wesley, 2007.|
|Class Q&A Website||CS243 on Piazza - for all questions related to the material. Access code: mivifDydOrtictefWa|
|Videos of Lectures||SCPD Webcast for Stanford Students|
|Staff Mailing List||for administrative questions|
|Midterm||February 12 in Gates B01|
|Final||March 23 (Friday) 3:30pm-6:30pm, Location: TBD|
Staff Professor and TA details
IMPORTANT Contact us using the for administrative questions.
Monica Lam, Instructor
|Office Hours||By arrangement via|
Dan Moreau, Admin
Giovanni Campagna, TA
|Office Hours||Tuesday 10:00am-12:00pm, Friday 3:30-5:30pm, Monday 6:30-7:30pm (SCPD only)|
Tentative Schedule Subject to change
|Date||Topic||Reading||Lecture notes||Assignment out||Assignment due|
|Jan 8 [Mon]||Introduction||1.1-5, 8.4, 8.5, 9.1||Lecture 1 Handout|
|Jan 10 [Wed]||Dataflow Analysis Introduction||9.2||Lecture 2 Handout, Slides|
|Jan 15 [Mon]||holiday|
|Jan 17 [Wed]||Dataflow Analysis Foundation||9.3||Lecture 3 Handout, Slides||HW1 Solution||Jan 24|
|Jan 22 [Mon]||Constant Propagation, Loops||9.4, 9.6||Lecture 4 Handout, Slides|
|Jan 24 [Wed]||JoeQ Framework||JoeQ Handout, Slides||HW2 hw2.zip||Jan 31|
|Jan 29 [Mon]||Partial Redundancy Elimination||9.5||Lecture 5 Handout, Slides|
|Jan 31 [Wed]||Register Allocation||8.8||Lecture 6 Handout, Slides||HW3 Solution||Feb 7|
|Feb 5 [Mon]||Instruction Scheduling||10.1-10.4||Lecture 7 Handout, Slides|
|Feb 7 [Wed]||Software Pipelining||10.5||Lecture 8 Handout, Slides||HW4 hw4.zip||Feb 21|
|Feb 12 [Mon]||Midterm||Midterm Solutions||Sample Midterm (Solution)|
|Feb 14 [Wed]||Parallelization||11.1-11.4, 11.6||Lecture 9 Handout, Slides|
|Feb 19 [Mon]||holiday|
|Feb 21 [Wed]||Loop Transformations||11.7-11.9||Lecture 10 Handout, Slides||HW5 Solution||Feb 28|
|Feb 26 [Mon]||Pipelined Parallelism||11.8, 11.9||Lecture 11 Handout, Slides|
|Feb 28 [Wed]||Pointer Analysis||12||Lecture 12 Handout||HW6 hw6.zip||March 9|
|Mar 5 [Mon]||BDDs in Pointer Analysis||12||Lecture 13 Handout|
|Mar 7 [Wed]||Satisfiability Modulo Theories (SMT)||Lecture 14 Handout, Slides||HW7 Solution||March 14|
|Mar 12 [Mon]||Garbage Collection||7.4 - 7.7.4||Lecture 15 Handout, Slides|
|Mar 14 [Wed]||Advanced Topics|
|Mar 23 [Fri]||Final (3:30 pm - 6:30 pm, |
|Sample Finals: 2014, 2013||Solution of the final|
Review Sessions Friday 11:30am - 12:20pm at Skilling Aud
Handouts and Graded Assignments What happens with physical materials
CS243 will be using the Gradiance automated homework system for some of the required work. You should open your free account at www.gradiance.com/services and then sign up for the class using the "class token" BD776655.
Gradiance looks like multiple-choice questions, but it is really quite different. You are given problems to work out, just as you would in an ordinary homework. You are then given a multiple-choice question to test whether or not you have the correct solution. If you get a choice wrong, you are given a hint and encouraged to try again. You are allowed to try as many times as you like, and the goal is to get everything right eventually. To avoid repeated guessing on one problem at a time, you need to repeat all the questions each time you submit, and you will be given a different set of choices each time.
SCPD students: Please download the lecture notes before the lecture; the material will be available by the morning of the lecture. Please submit written assignments to us by emailing them to the staff mailing list and include the homework route form with your submission. We will return the graded homeworks back to you through SCPD distribution (SCPD students only).
Homework will consist of both written and programming assignments. You are encouraged to work on the programming assignments in groups of two, but you must do the written assignments by yourself.
In general, no late assignments are accepted. However, you have two grace days for the entire quarter. That means you can be late by one day for two assignments, or use the two days up for one assignment.
Programming assignments will have specific submission instructions included with the handouts. We will use a certain amount of automatic grading to help us deal with the massive amounts of code everyone submits, so please follow the submission instructions exactly as written!
Some of the written homework should be submitted via Gradiance, as described above. If you have any issues accessing the Gradiance site, please contact the TAs.
Honor Code Cheating and Plagiarism is a no-no
You are free to discuss the assignment and solutions with others. However, you must write your own assignment, and must not represent any portion of others' work as your own. Anybody violating the honor code will be referred to the Judical-Affairs Office. If convicted, the normal penalty is a quarter suspension or worse.