Cornell CS 6120 Advanced Compilers Self-Guided Course

Cornell University's CS 6120 is a PhD-level course on programming language implementation and advanced compilers, now available as a self-guided online resource. The course provides a structured curriculum of videos, written notes, and implementation tasks designed to bridge the gap between abstract compiler theory and real-world code.

Course Curriculum and Technical Scope

The course covers a comprehensive range of compiler topics, splitting its focus between universal compiler fundamentals and specialized research-oriented subjects.

Core Compiler Fundamentals

The curriculum begins with the basics of program representation and local analysis, progressing through the following key areas:

  • Intermediate Representations (IR): The course utilizes LLVM and a specialized educational IR called Bril.
  • Local Analysis & Optimization: Focuses on simple dead code elimination and local value numbering.
  • Data Flow & Global Analysis: Covers data flow analysis and global optimization techniques.
  • Static Single Assignment (SSA): Detailed instruction on SSA form and provably correct peephole optimizations using tools like Alive.
  • Loop Optimization: Strategies for improving loop efficiency.
  • Interprocedural Analysis: Techniques for analyzing programs across function boundaries, including type-based alias analysis.

Advanced and Research Topics

Beyond standard optimizations, CS 6120 delves into complex memory and execution environments:

  • Alias Analysis & Memory Management: Covers the theory of garbage collection and fast conservative garbage collection.
  • Dynamic Compilers: Explores Just-In-Time (JIT) compilation and tracing via speculation.
  • Concurrency & Parallelism: Discusses the implementation of threads, superword level parallelism, and the formal verification of realistic compilers.
  • Fast Compilers: The final stage of the curriculum focuses on the efficiency of the compiler itself.

Learning Methodology and Resources

The self-guided version of CS 6120 is designed for independent study, removing the constraints of university deadlines and formal grading.

  • Instructional Materials: Each lesson consists of a combination of instructional videos and written notes.
  • Practical Application: The course emphasizes "open-source hacking tasks" to solidify understanding. These tasks are open-ended and require students to implement concepts in actual code.
  • Academic Grounding: The curriculum is interspersed with seminal research papers, such as those on empirical evaluation guidelines from SIGPLAN and formal verification from Xavier Leroy.
  • Open Source Access: The course materials are hosted on GitHub, allowing the community to report bugs and contribute to the curriculum.

Community Perspectives and Critiques

While the course is highly regarded for its accessibility, some technical discussions have emerged regarding its content:

  • On Dynamic Compilation: One contributor noted that the course's focus on dynamic compilers leans heavily toward trace compilation, which they argue is a "dead end" in modern practice. They suggest that concepts like type feedback, speculation, deoptimization, and tiered compilation are more critical for contemporary systems.

  • On Course Level: There is debate regarding the "advanced" designation of the course. Some learners argue that topics such as dead code elimination, data flow, and SSA form are typically covered in introductory compiler courses rather than PhD-level curricula.

"The section on dynamic compilers is more or less all about trace compilation. Generally, trace compilation is a dead end and has been abandoned repeatedly. The more important concepts here are type feedback and speculation and deoptimization, as well as making fast compilers and tiering."

Sources