UIUC ECE 408 应用并行编程 · 开篇与课程概览

目录 · l1 →

课程来源:伊利诺伊大学厄巴纳-香槟分校(University of Illinois Urbana-Champaign) 课程主页https://ece.illinois.edu/academics/courses/ece408 教材:D. Kirk and W. Hwu, Programming Massively Parallel Processors, Morgan Kaufmann, 3rd Edition 公开讲义:Prof. Steven S. Lumetta 公开课程网站(Summer 2024 / Summer 2025 共 22 个 Slide Deck) 笔记语言:中文(技术术语保留英文原文) 笔记定位:以 CUDA 实现与硬件映射 为主线,覆盖 GPU 硬件架构、CUDA 编程模型、 七种核心并行模式的具体实现与性能优化,以及最终项目的性能工程方法论。


课程概览(Course Overview)

一、这门课到底在教什么

ECE408 的官方定位是一句话:“Parallel programming with emphasis on developing applications for processors with many computation cores.”——重点不是”并行编程理论”,而是动手把计算映射到并行硬件上, 并让它跑得快

官方对”大规模并行处理器(massively parallel processor)”给了非常工程化的定义:

“In general, we refer to a processor as massively parallel if it has the ability to complete more than 64 arithmetic operations per clock cycle.” ——只要一个处理器每时钟周期能完成 超过 64 次算术运算,就算大规模并行。

这个门槛很有意思:现代 CPU 一个周期通常完成 4–8 次浮点运算,而一块 A100 GPU 有 6912 个 FP32 CUDA core,每个周期可发起上万次运算。两者差了两三个数量级,这种量级差异正是本课程全部技术内容的根源: 为了喂饱这么多运算单元,必须重新思考线程组织、内存访问、同步方式。

官方进一步指出,有效编程这类处理器需要三类知识的组合:

  1. 并行编程原理(parallel programming principles)——什么是并行模式、什么是数据复用、什么是负载均衡;
  2. 并行与通信模型(parallelism models, communication models)——SIMT、共享内存通信、warp 级原语;
  3. 硬件组织与资源限制(hardware organizations, resource limitations)——SM、warp、寄存器、共享内存、 带宽与延迟的物理约束。

本课程面向两类受众:想为这类处理器开发应用的学生,以及想开发编程工具和未来处理器设计的学生。 换句话说,它既是一门”应用课”,也是一门”体系结构课”。

二、课程目标(Course Goals,官方原文)

“The aim of this course is to provide students with knowledge and hands-on experience in developing applications software for processors with massively parallel computing resources. … Effectively programming these processors requires in-depth knowledge about parallel programming principles, as well as parallelism models, communication models, hardware organizations, and resource limitations of these processors.”

拆解成可执行的三条:

目标具体含义对应本笔记
知识(knowledge)理解并行模式、通信模型、硬件约束全部 Lecture 的核心概念部分
动手经验(hands-on experience)从零写出能通过正确性测试、并达到性能要求的 CUDA 程序每个 Lecture 的完整 .cu 代码
性能工程能力设计实验、定位瓶颈、在硬件约束下优化Lecture 10 + 各讲的性能分析

三、教学目标(Instructional Objectives,官方 17 条)

官方把 17 条教学目标分成三个阶段,这实际上就是本课程的能力成长路线图

阶段 A:完成 7 个机器学习问题(Machine Problems)后 ≈ 20 次 75 分钟讲座

编号目标解读
A1Analyze and implement common parallel algorithm patterns in a parallel programming model such as CUDA能识别并行模式并实现——这是”会写”
A2Design experiments to analyze the performance bottlenecks in their parallel code能设计实验定位瓶颈——这是”会测”
A3Apply common parallel techniques to improve performance given hardware constraints能在约束下优化——这是”会调”
A4Learn about the features of a parallel debugger and use them to identify and repair code defects会用调试器——这是”会修”
A5Learn about the features of a parallel profiler and use them to identify performance bottlenecks会用 profiler——这是”会剖”

A 组是整门课的重心:它要求的不是”知道”,而是”能做到”。这解释了为什么课程以 8 个 Lab(机器问题)为主体。

阶段 B:第二次考试前 ≈ 29 次讲座

编号目标解读
B6Understand and apply common parallel algorithm patterns从”会写”上升到”会用”
B7Understand the major types of hardware limitations that limit parallel program performance硬件约束的系统认知(带宽、延迟、占用率、bank conflict)
B8Understand and apply common parallel programming interface featuresAPI 层面的熟练
B9Review a parallel code segment and identify its behavior and potential problems代码审查能力——考试的核心题型

阶段 C:最终项目结束时(Proposal / Workshop / Presentation / Report)

编号目标
C10Identify and solve a computational problem with parallel algorithm design and program
C11Learn the necessary domain knowledge in order to solve the identified problem
C12Work with domain experts and teammates from different disciplines
C13Properly divide up the responsibilities among teammates
C14Identify design space and explore optimization opportunities
C15Motivate the problem and approach in a presentation
C16Properly explain the solutions experimented and justify the final decision and outcome
C17Identify limitations of the solutions and future directions

C14 和 C17 特别值得注意:课程要求你不仅”做出一个快程序”,还要能说清你探索过哪些设计点哪些尝试失败了方案的边界在哪里。这是工程师与”调参侠”的分水岭。

四、先修要求与教材

Topical Prerequisites(先修主题)

  • C programming——CUDA 是 C/C++ 的扩展,指针、数组、内存布局必须熟;
  • Basic data structures——用于理解 CSR 稀疏格式、树形归约等;
  • Introduction to computer organization——cache、内存层次、流水线的基本概念。

官方正式先修课程是 ECE 220CS 225

Texts(教材)

D. Kirk and W. Hwu, Programming Massively Parallel Processors, Morgan Kaufmann, 3rd Edition.(Required)

Kirk & Hwu 是本课程作者之一 Wen-mei Hwu 的著作,也是 ECE408 的”原生教材”—— 课程讲义中的大量插图、术语、代码骨架直接来自这本书。强烈建议配合阅读: 讲义给”课堂节奏”,教材给”完整推导”。

五、课程范围:CUDA 编程 + 并行算法模式 + 性能优化

本课程的知识版图可以分成三层,本笔记的 12 讲严格按这个结构组织:

┌──────────────────────────────────────────────────────────────────────┐
│ 第三层:性能优化方法论(Lecture 10 + 贯穿全部)                        │
│   Roofline 模型 / 算术强度 / 占用率 / 合并访问 / 原子操作 / profiling   │
├──────────────────────────────────────────────────────────────────────┤
│ 第二层:七种核心并行模式(Lecture 3 – Lecture 9)                      │
│   vecAdd → matmul → tiled matmul → reduction → scan → convolution     │
│          → sparse matvec                                               │
│   每种模式 = 一个 Lab + 一套访存/同步/负载均衡技巧                      │
├──────────────────────────────────────────────────────────────────────┤
│ 第一层:硬件与编程模型基础(Lecture 1 – Lecture 2)                    │
│   GPU 架构(SM / warp / 内存层次) + CUDA 模型(kernel / 线程层次 /     │
│   内存空间) + 执行模型(SIMT / 延迟隐藏 / 占用率)                     │
├──────────────────────────────────────────────────────────────────────┤
│ 顶层综合:最终项目(Lecture 11 高级主题 + Lecture 12 项目方法论)       │
└──────────────────────────────────────────────────────────────────────┘

第一层:CUDA 编程模型(Lecture 1–2)

  • Host/Device 异构模型:CPU 负责控制流与串行部分,GPU 负责数据并行部分;
  • Kernel 与线程层次grid → block → thread,二维/三维索引,<<<grid, block>>> 执行配置;
  • 内存空间:寄存器、局部内存、共享内存、全局内存、常量内存、纹理内存—— 各自的作用域、生命周期、延迟与带宽差了几个数量级;
  • SIMT 执行模型:32 线程一个 warp,warp 是调度单位,分歧与锁步。

第二层:并行算法模式(Lecture 3–9)

课程把”并行计算模式(parallel computation patterns)”作为组织单元,每种模式对应一个 Lab:

Lecture并行模式核心 CUDA 机制关键性能问题
3向量加法(element-wise)一维 thread→data 映射合并访存、带宽受限
4基础矩阵乘法二维 thread→output 映射跨步访存、算术强度过低
5分块矩阵乘法共享内存 + tiling + 屏障数据复用、bank conflict
6归约共享内存树 + warp shufflewarp 发散、延迟受限
7扫描/前缀和双缓冲 + 层次化算法工作高效性 vs 并行度
8分块卷积常量内存 + halo 加载边界处理、常量缓存广播
9稀疏矩阵向量乘压缩格式 + 负载均衡不规则访存、load imbalance

这七种模式不是七个孤立技巧,而是一套可迁移的思维工具:任何新问题都可以先问 “它像哪个模式?”——这正是 A1 目标”analyze and implement common parallel algorithm patterns”的含义。

第三层:性能优化方法论(Lecture 10)

  • Roofline 模型:用算术强度判断”内存受限还是计算受限”,并算出性能天花板;
  • 占用率(occupancy):多少 warp 常驻 SM 才能隐藏延迟;
  • 合并访问(coalescing):32 次访问如何变成 1 次 128 字节事务;
  • 原子操作与私有化(privatization):消除同地址竞争;
  • 测量方法学cudaEvent 计时、profiler 指标、有效带宽计算。

六、实验项目(Lab Projects)

课程有两套 Lab 编号,历史版本(官方课程目录页)与近年实际执行版本(2024/2025 时间线)不同, 本笔记两套编号同时标注

官方课程目录页(Hwu 版本)2024/2025 实际(Lumetta 版本)覆盖内容
Lab 0 - installation and test of programming environmentLab 0: Device QueryLecture 1
Lab 1 - Parallel Vector AdditionLab 1: Vector AdditionLecture 3
Lab 2 - Parallel Matrix MultiplicationLab 2: Simple Matrix MultiplyLecture 4
Lab 3 - Tiled Parallel Matrix MultiplicationLab 3: Tiled Matrix MultiplyLecture 5
Lab 4 - Parallel ReductionLab 4: 3D ConvolutionLecture 6 / Lecture 8
Lab 5 - Parallel ScanLab 5: List ReductionLecture 7 / Lecture 6
Lab 6 - Tiled Parallel ConvolutionLab 6: ScanLecture 8 / Lecture 7
Lab 7 - Sparse Matrix-Vector MultiplicationLab 7: HistogrammingLecture 9 / Lecture 10
(无)Lab 8: Sparse Matrix MultiplyLecture 9

重要提示:从 2024/2025 时间线看,3D Convolution 是 Lab 4,而 Reduction 是 Lab 5 (List Reduction)Scan 是 Lab 6。学习时务必以自己学期的时间线为准。

实验环境(Lab Equipment / Lab Software,官方)

  • Lab Equipment: “Linux based cluster system”——近年实际使用 NCSA Delta 集群(NVIDIA A100, sm_80);
  • Lab Software: “C Programming Language and CUDA Software Development Kit, WebGPU for labs, RAI for final project

这一点非常值得注意:课程近年同时使用 CUDA 与 WebGPU 两套技术栈—— Lab 部分在 GPU 上做 CUDA,也引入了 WebGPU(浏览器内 GPU 计算,用 WGSL 着色器语言), 而最终项目使用基于 WebGPU 的 RAI 框架。本笔记 Lecture 11 专门给出 CUDA ↔ WebGPU 的逐项对照表, 帮助有 CUDA 基础的学习者快速迁移。

评分构成(2025 夏季官方)

  • Exams 50%(两次等权重考试,第二次是第二次期中而非期末统考);
  • Labs (Machine Problems) 25%(每个 Lab 等权;其中通过测试占 90%,PrairieLearn quiz 占 10%; Lab 0 例外,100% 为 quiz);
  • Project 25%(demo / 功能 / 代码风格约占 50%;在功能完整前提下的性能约占 50%)。

注意最后一条:性能占项目成绩的一半,但前提是功能完整—— 一个跑得飞快但结果错误的程序得零分。这与 A2 目标(设计实验分析瓶颈)和 C16 目标 (justify the final decision and outcome)一脉相承。

延期政策:每人自动获得两次 48 小时延期,但必须在 deadline 之前提交申请; 最低的 lab+quiz 组合成绩会被丢弃。

七、最终项目要求(Final Project)

官方的表述是:

“Final Project that involves Project Proposal, Project Workshop, Project Presentation, and Project Report,并且 “A final project report is required”

四个交付物

┌────────────┐   ┌────────────┐   ┌───────────────┐   ┌────────────┐
│  Proposal  │──▶│  Workshop  │──▶│  Presentation │──▶│   Report   │
│  选题与动机 │   │ 方案讨论    │   │  答辩演示      │   │  技术报告   │
└────────────┘   └────────────┘   └───────────────┘   └────────────┘
      ↓                 ↓                  ↓                 ↓
  问题定义         设计空间探索        性能与正确性        完整实验记录
  可行性论证       算法方案选择        的可视化呈现        + 局限与展望

三个硬性预期(来自官方 Instructional Objectives C 组):

  1. 必须真的探索设计空间(C14)——报告里要有”我试过 A、B、C 三组参数,最终选 B 因为……”;
  2. 必须能说明为什么(C16)——”properly explain the solutions experimented and justify the final decision and outcome”,不能只给结果;
  3. 必须诚实报告局限(C17)——”identify limitations of the solutions and future directions”。

性能与正确性的双重要求:项目评分约 50% 给”功能完整前提下的性能”。 这意味着最终提交的程序必须同时满足:

  • 对任意合法的(包括非 2 的幂、非整数倍 tile 的)输入尺寸都给出正确结果;
  • 在给定硬件上达到有竞争力的性能,并且能定量解释性能来源

学术诚信与 AI 工具政策(官方原文要点):课程明确规定——

  • 使用课程材料(教材、讲义)与教学人员(教授、助教)之外的任何工具,风险自负
  • AI 工具”routinely fabricate information”,若据此在作业或考试中使用错误信息,不予给分
  • 若工具输出了他人代码导致查重命中,学生承担全部学术诚信责任
  • quiz 与考试期间严禁使用任何未被明确允许的材料,包括 AI 工具

如何使用这份笔记

  1. 每一讲独立成篇:结构统一为「概述 → 核心概念与架构图解 → 代码示例与性能分析 → 优化技巧 → 关键要点 → 常见陷阱 → 思考题」,可以按需跳读。
  2. 代码可直接编译运行:所有 .cu 示例都是完整的(含 main、错误检查、计时、CPU 校验), 编译命令写在文件头部注释里,统一使用 nvcc -O3 -arch=sm_80
  3. 性能数字有出处:所有吞吐量、带宽、延迟数字都标注了对应的 GPU 型号, 性能分析基准机为 NVIDIA A100 (sm_80)(课程实验集群所用 GPU),必要时对比 RTX 4090。
  4. 两套 Lab 编号都标注:看到 “Lab 4” 时请对照上表确认是 Reduction 还是 3D Convolution。
  5. 配合原版讲义:笔记中每讲都标注了对应的公开 Slide Deck 编号,可在 https://lumetta.web.engr.illinois.edu/408-Sum25/ 下载原始 PDF 对照阅读。

硬件档案(全书性能分析共用)

GPU架构SM 数每 SM warp 上限每 SM 线程上限寄存器/SM共享内存/SM显存带宽FP32 峰值
A100 (80GB SXM)Ampere sm_8010864204865536164 KB1555 GB/s19.5 TFLOPS
H100 SXMHopper sm_9013264204865536228 KB3350 GB/s67 TFLOPS
RTX 4090Ada sm_8912848153665536100 KB1008 GB/s82.6 TFLOPS
RTX 2080 TiTuring sm_75683210246553664 KB616 GB/s13.4 TFLOPS

关键派生量(机器平衡点 machine balance = FP32 峰值 / 带宽)

GPU机器平衡点含义
A10019.5 TFLOPS ÷ 1555 GB/s ≈ 12.5 FLOP/Byte算术强度低于此值 → 带宽受限
H10067 ÷ 3350 ≈ 20.0 FLOP/Byte更高的平衡点,更”饿”数据
RTX 409082.6 ÷ 1008 ≈ 82 FLOP/Byte极端偏计算,访存优化收益巨大
RTX 2080 Ti13.4 ÷ 616 ≈ 21.8 FLOP/Byte

内存层次延迟与带宽(数量级)

层次延迟带宽(A100)作用域
寄存器~1 cycle(无冲突时)极高(数万 GB/s 等效)单线程
共享内存 / L1~20–30 cycles~19 TB/s 聚合单 block
L2 Cache~200 cycles~5–7 TB/s全 GPU(40–50 MB on A100)
全局内存(DRAM)~400–800 cycles1555 GB/s全 GPU,跨 kernel 持久

事务粒度:一个 warp 的 32 个线程若访问连续 4 字节地址,硬件合并为 1 次 128 字节事务 (= 1 条 cache line);这是全书一切访存优化的基本单位。


本笔记基于 UIUC 公开课程资料整理:官方课程目录页、官方 Course Goals 与 17 条 Instructional Objectives、官方 Lab Projects 列表,以及 Prof. Steven S. Lumetta 公开课程网站上的全部 22 个 Slide Deck(Summer 2025 / Summer 2024)与历年公开考试资料。实验指导书、项目计划与评分标准未公开, 笔记中相应内容依据官方描述与讲义重建。


附:分讲结构化数据记录(Phase 1 数据获取与整理)

以下为每一讲的资料记录,字段说明:

  • lecture_topic:讲座主题;
  • related_lab:对应的实验项目;
  • key_concepts_raw:本讲涉及的关键概念(原始词表);
  • learning_objectives:对应的官方教学目标;
  • available_public_info:该主题公开可得的信息摘要;
  • source_slide_decks / local_source_texts:对应的公开讲义 Slide Deck 与已归档的讲义文本文件。

L01 · Course Overview, Motivation for Parallel Computing, and GPU Architecture Introduction

{
  "lecture_topic": "Course Overview, Motivation for Parallel Computing, and GPU Architecture Introduction",
  "related_lab": "Lab 0: Device Query",
  "key_concepts_raw": [
    "power wall (2004)",
    "multicore transition",
    "massively parallel processor (>64 ops/clock)",
    "heterogeneous computing (host/device)",
    "SM (Streaming Multiprocessor)",
    "SIMT / warp",
    "latency hiding vs throughput",
    "arithmetic intensity",
    "Amdahl's law",
    "unified shader architecture",
    "device query and CUDA environment setup",
  ],
  "learning_objectives": [
    "Analyze and implement common parallel algorithm patterns in a parallel programming model such as CUDA",
    "Understand the major types of hardware limitations that limit parallel program performance",
  ],
  "available_public_info": "公开的课程目录页给出 Official Description、Course Goals、Instructional Objectives A1-A17、Lab 0 (installation and test of programming environment)。公开讲义 Slide Deck 1 (Introduction)、Extra Deck 1 (A Historical Perspective)、Extra Deck 2 (Generalizing Parallelism)、Slide Deck 19 (GPUs in the PC Architecture) 均可公开下载。Lab 0 的 handout 本身未公开(通过 GitHub + NCSA Delta 分发)。",
  "source_slide_decks": [
    "Slide Deck 1: Introduction",
    "Extra Slide Deck 1: A Historical Perspective",
    "Extra Slide Deck 2: Generalizing Parallelism",
    "Slide Deck 19: GPUs in the PC Architecture",
  ]
}

L02 · CUDA Programming Model Fundamentals: Kernels, Thread Hierarchy, and Memory Model

{
  "lecture_topic": "CUDA Programming Model Fundamentals: Kernels, Thread Hierarchy, and Memory Model",
  "related_lab": "Lab 0 / Lab 1 (foundation)",
  "key_concepts_raw": [
    "__global__ / __device__ / __host__ qualifiers",
    "kernel launch <<<grid, block>>>",
    "grid-block-thread hierarchy",
    "gridDim/blockDim/blockIdx/threadIdx",
    "warp = 32 threads",
    "SIMT execution and warp divergence",
    "register / local / shared / global / constant / texture memory",
    "scope and lifetime of each memory space",
    "__syncthreads() block barrier",
    "cudaDeviceSynchronize vs asynchronous kernel launch",
    "thread coarsening (motivation)",
  ],
  "learning_objectives": [
    "Understand and apply common parallel programming interface features",
    "Review a parallel code segment and identify its behavior and potential problems",
  ],
  "available_public_info": "公开讲义 Slide Deck 2 (CUDA Introduction)、Slide Deck 3 (CUDA Parallelism Model)、Slide Deck 4 (CUDA Memory Model) 全部公开可下载,含二维线程索引、图片通道拆分、共享/常量内存的完整代码骨架。",
  "source_slide_decks": [
    "Slide Deck 2: CUDA Introduction",
    "Slide Deck 3: CUDA Parallelism Model",
    "Slide Deck 4: CUDA Memory Model",
  ]
}

L03 · Parallel Pattern 1 - Vector Addition: Thread Mapping and Memory Access

{
  "lecture_topic": "Parallel Pattern 1 - Vector Addition: Thread Mapping and Memory Access",
  "related_lab": "Lab 1: Vector Addition",
  "key_concepts_raw": [
    "data parallelism",
    "thread-to-data mapping i = blockIdx.x*blockDim.x + threadIdx.x",
    "grid sizing with ceiling division",
    "boundary checking",
    "coalesced global memory access",
    "memory bandwidth bound kernel",
    "arithmetic intensity of vector add (0.125 FLOP/Byte)",
    "occupancy and block size selection",
    "grid-stride loop",
    "__restrict__ pointers",
    "validating against a CPU golden reference",
  ],
  "learning_objectives": [
    "Analyze and implement common parallel algorithm patterns in a parallel programming model such as CUDA",
    "Design experiments to analyze the performance bottlenecks in their parallel code",
    "Apply common parallel techniques to improve performance given hardware constraints",
  ],
  "available_public_info": "公开讲义 Slide Deck 2/3/4 含 Review - Vector Addition Kernel 与 Review - Thread Assignment for vecAdd(gridDim.x / blockDim.x 的填空练习);Slide Deck 7 (DRAM) 提供带宽分析依据。Lab 1 的完整 handout(含测试数据与评分脚本)未公开,通过 GitHub 分发。",
  "source_slide_decks": [
    "Slide Deck 2: CUDA Introduction",
    "Slide Deck 3: CUDA Parallelism Model",
    "Slide Deck 7: DRAM",
  ]
}

L04 · Parallel Pattern 2 - Simple Matrix Multiplication and Its Performance Bottlenecks

{
  "lecture_topic": "Parallel Pattern 2 - Simple Matrix Multiplication and Its Performance Bottlenecks",
  "related_lab": "Lab 2: Simple Matrix Multiply",
  "key_concepts_raw": [
    "GEMM definition, FLOPs = 2*M*N*K",
    "row-major linearization M[row*Width + col]",
    "thread-per-output mapping with 2D block/grid",
    "2K global loads per output element",
    "strided (uncoalesced) access to B columns",
    "arithmetic intensity 0.25 FLOP/Byte",
    "Roofline ceiling for naive matmul",
    "data reuse counts (A used N times, B used M times)",
    "matrix transpose to restore coalescing",
    "thread coarsening for register reuse",
  ],
  "learning_objectives": [
    "Analyze and implement common parallel algorithm patterns in a parallel programming model such as CUDA",
    "Design experiments to analyze the performance bottlenecks in their parallel code",
  ],
  "available_public_info": "公开讲义 Slide Deck 5 (CUDA Tiled Matrix Multiplication) 的前半部分讲解基础矩阵乘法的访存问题;Slide Deck 7 (DRAM) 提供 DRAM burst 与合并访问的定量依据。Lab 2 的 handout 未公开。",
  "source_slide_decks": [
    "Slide Deck 5: CUDA Tiled Matrix Multiplication",
    "Slide Deck 6: More on Tiling",
    "Slide Deck 7: DRAM",
  ]
}

L05 · Tiled Parallel Matrix Multiplication: Shared Memory and Data Reuse

{
  "lecture_topic": "Tiled Parallel Matrix Multiplication: Shared Memory and Data Reuse",
  "related_lab": "Lab 3: Tiled Matrix Multiply",
  "key_concepts_raw": [
    "tiling",
    "shared memory (48KB-228KB/SM, ~20-30 cycle latency)",
    "data reuse, 2N -> 2N/TILE_WIDTH global accesses per output",
    "shared memory banks and bank conflicts",
    "padding to break bank conflicts",
    "__syncthreads() RAW/WAR hazards, two barriers per tile iteration",
    "arithmetic intensity TILE_WIDTH/4 FLOP/Byte",
    "thread coarsening with register accumulators",
    "occupancy vs shared memory tradeoff",
    "double buffering / cp.async prefetch (advanced)",
  ],
  "learning_objectives": [
    "Apply common parallel techniques to improve performance given hardware constraints",
    "Understand the major types of hardware limitations that limit parallel program performance",
    "Analyze and implement common parallel algorithm patterns in a parallel programming model such as CUDA",
  ],
  "available_public_info": "公开讲义 Slide Deck 5 (CUDA Tiled Matrix Multiplication) 与 Slide Deck 6 (More on Tiling) 完整公开,含 __shared__ float subTileM[TILE_WIDTH][TILE_WIDTH] 的完整 kernel 代码骨架、__syncthreads 语义、以及 bank conflict 与 padding 的讨论。Lab 3 的 handout 未公开。",
  "source_slide_decks": [
    "Slide Deck 5: CUDA Tiled Matrix Multiplication",
    "Slide Deck 6: More on Tiling",
  ]
}

L06 · Parallel Pattern 4 - Reduction: Reduction Trees and Warp-Level Primitives

{
  "lecture_topic": "Parallel Pattern 4 - Reduction: Reduction Trees and Warp-Level Primitives",
  "related_lab": "Lab 4: Parallel Reduction (catalog) / Lab 5: List Reduction (Sum 2025)",
  "key_concepts_raw": [
    "reduction with associative+commutative operator and identity",
    "reduction tree, log2(N) steps, N-1 work, work efficiency",
    "interleaved addressing (stride 1,2,4...) vs sequential addressing (stride blockDim/2...)",
    "warp divergence in reductions",
    "bank conflicts in shared memory reduction",
    "__syncthreads() inside a stride loop",
    "warp shuffle: __shfl_down_sync / __shfl_xor_sync",
    "independent thread scheduling on Volta+ and the _sync mask",
    "thread coarsening with grid-stride loop",
    "hierarchical multi-block reduction, atomicAdd",
    "latency/bandwidth-bound nature of reduction",
  ],
  "learning_objectives": [
    "Analyze and implement common parallel algorithm patterns in a parallel programming model such as CUDA",
    "Apply common parallel techniques to improve performance given hardware constraints",
    "Understand the major types of hardware limitations that limit parallel program performance",
  ],
  "available_public_info": "公开讲义 Slide Deck 11 (Reduction Trees) 完整公开,含 reduction 的定义、work-efficient 分析、交错/顺序寻址的对比与共享内存 reduction 代码。Lab 5: List Reduction 的 handout 未公开;Lab 4 在课程目录页上的名字是 Parallel Reduction,在 2024/2025 时间线上 Lab 4 是 3D Convolution。",
  "source_slide_decks": [
    "Slide Deck 11: Reduction Trees",
  ]
}

L07 · Parallel Pattern 5 - Prefix Sum / Scan: Double Buffering and Hierarchical Algorithms

{
  "lecture_topic": "Parallel Pattern 5 - Prefix Sum / Scan: Double Buffering and Hierarchical Algorithms",
  "related_lab": "Lab 5: Parallel Scan (catalog) / Lab 6: Scan (Sum 2025)",
  "key_concepts_raw": [
    "inclusive vs exclusive scan",
    "associative operator generalisation",
    "applications: recurrences, stream compaction, radix sort, histograms, polynomial evaluation",
    "Hillis-Steele (Kogge-Stone) scan: O(log N) steps, O(N log N) work, not work-efficient",
    "Blelloch work-efficient scan: up-sweep and down-sweep, O(N) work",
    "double buffering to avoid read-after-write hazards",
    "hierarchical multi-block scan (scan-scan-add three step)",
    "shared memory bank conflicts for different strides",
    "work efficiency vs latency tradeoff",
    "__syncthreads() between every scan step",
  ],
  "learning_objectives": [
    "Analyze and implement common parallel algorithm patterns in a parallel programming model such as CUDA",
    "Understand and apply common parallel algorithm patterns",
    "Apply common parallel techniques to improve performance given hardware constraints",
  ],
  "available_public_info": "公开讲义 Slide Deck 12 (Parallel Prefix, or Scan) 完整公开,含 Hillis-Steele、Blelloch、double buffering、hierarchical scan 与 '100-inch sandwich' 类比。Lab 6: Scan 的 handout 未公开。",
  "source_slide_decks": [
    "Slide Deck 12: Parallel Prefix, or Scan",
  ]
}

L08 · Parallel Pattern 6 - Tiled Convolution: Constant Memory and Boundary Handling

{
  "lecture_topic": "Parallel Pattern 6 - Tiled Convolution: Constant Memory and Boundary Handling",
  "related_lab": "Lab 6: Tiled Parallel Convolution (catalog) / Lab 4: 3D Convolution (Sum 2025)",
  "key_concepts_raw": [
    "1D/2D/3D convolution definition, mask/filter, halo/apron",
    "constant memory: 64KB, __constant__, cudaMemcpyToSymbol, broadcast in constant cache",
    "boundary handling: zero padding, clamp, wrap; ghost cells",
    "warp divergence at boundaries",
    "tiled convolution with halo (TILE+2r)^2 shared memory capacity",
    "reduction of global traffic by (TILE+2r)^2/TILE^2",
    "thread coarsening and register blocking",
    "arithmetic intensity of convolution (~1 FLOP/Byte naive)",
    "3D convolution: larger halo volume, register pressure, cudaPitchedPtr",
  ],
  "learning_objectives": [
    "Analyze and implement common parallel algorithm patterns in a parallel programming model such as CUDA",
    "Apply common parallel techniques to improve performance given hardware constraints",
    "Design experiments to analyze the performance bottlenecks in their parallel code",
  ],
  "available_public_info": "公开讲义 Slide Deck 8 (Convolution and Constant Memory)、Slide Deck 9 (Tiled Convolution)、Slide Deck 10 (Tiled Convolution Analysis) 全部公开。Slide Deck 9 明确写有 'prepare for MP-4: tiled 3D convolution',证明 Lab 4 = 3D Convolution。Lab handout 未公开。",
  "source_slide_decks": [
    "Slide Deck 8: Convolution and Constant Memory",
    "Slide Deck 9: Tiled Convolution",
    "Slide Deck 10: Tiled Convolution Analysis",
  ]
}

L09 · Parallel Pattern 7 - Sparse Matrix-Vector Multiplication: Compact Formats and Load Balance

{
  "lecture_topic": "Parallel Pattern 7 - Sparse Matrix-Vector Multiplication: Compact Formats and Load Balance",
  "related_lab": "Lab 7: Sparse Matrix-Vector Multiplication (catalog) / Lab 8: Sparse Matrix Multiply (Sum 2025)",
  "key_concepts_raw": [
    "sparsity in real systems, loss of regularity",
    "CSR: rowPtr[N+1], colIdx[nnz], values[nnz]",
    "ELL, ELLPACK, COO, JDS, hybrid ELL+COO",
    "load imbalance: rows with very different nnz within one warp",
    "indirect gather x[colIdx[j]] - uncoalesced and cache-unfriendly",
    "arithmetic intensity ~0.167 FLOP/Byte",
    "vectorised loads (float4), shared memory caching of x",
    "row reordering, warp-per-row with shuffle reduction",
    "compaction motivation (memory footprint and bandwidth)",
  ],
  "learning_objectives": [
    "Analyze and implement common parallel algorithm patterns in a parallel programming model such as CUDA",
    "Understand the major types of hardware limitations that limit parallel program performance",
    "Apply common parallel techniques to improve performance given hardware constraints",
  ],
  "available_public_info": "公开讲义 Slide Deck 14 (Parallel Sparse Methods) 与 Slide Deck 15 (Parallel Sparse Methods Part 2) 完整公开,含 'key techniques for compacting input data' 与 'challenge: retaining regularity'。Lab 8: Sparse Matrix Multiply 的 handout 未公开。",
  "source_slide_decks": [
    "Slide Deck 14: Parallel Sparse Methods",
    "Slide Deck 15: Parallel Sparse Methods (Part 2)",
  ]
}

L10 · Performance Analysis and Optimisation Methodology: Roofline, Occupancy, Coalescing, Atomics

{
  "lecture_topic": "Performance Analysis and Optimisation Methodology: Roofline, Occupancy, Coalescing, Atomics",
  "related_lab": "Applies to all labs",
  "key_concepts_raw": [
    "DRAM organisation, burst length, row buffer",
    "coalescing: 32 accesses -> 1..32 transactions of 128 bytes",
    "arithmetic intensity and machine balance (A100 = 12.5 FLOP/Byte)",
    "Roofline model: bandwidth-bound vs compute-bound knee",
    "Little's law for latency hiding, memory-level parallelism",
    "occupancy calculation and the 'good enough' rule",
    "cudaOccupancyMaxActiveBlocksPerMultiprocessor, nvcc --ptxas-options=-v",
    "atomic operations, serialisation on the same address",
    "data locality / privatisation (shared memory private histogram)",
    "profiling with nvprof / Nsight Compute, stall reasons",
  ],
  "learning_objectives": [
    "Design experiments to analyze the performance bottlenecks in their parallel code",
    "Learn about the features of a parallel profiler and use them to identify performance bottlenecks in their code",
    "Learn about the features of a parallel debugger and use them to identify and repair code defects",
  ],
  "available_public_info": "公开讲义 Slide Deck 7 (DRAM)、Slide Deck 6 (More on Tiling)、Slide Deck 10 (Tiled Convolution Analysis)、Slide Deck 13 (Atomic Operations and Histograms) 全部公开。Slide Deck 13 对应 Lab 7: Histogramming,是原子操作与私有化技术的最佳案例。",
  "source_slide_decks": [
    "Slide Deck 7: DRAM",
    "Slide Deck 6: More on Tiling",
    "Slide Deck 10: Tiled Convolution Analysis",
    "Slide Deck 13: Atomic Operations and Histograms",
  ]
}

L11 · Advanced Topics: Multi-Stream, Data Transfer, Tensor Cores, Deep Learning, Alternatives to CUDA (WebGPU/RAI)

{
  "lecture_topic": "Advanced Topics: Multi-Stream, Data Transfer, Tensor Cores, Deep Learning, Alternatives to CUDA (WebGPU/RAI)",
  "related_lab": "Final Project",
  "key_concepts_raw": [
    "GPU in the PC architecture: PCIe 3.0/4.0/5.0 bandwidth, NVLink, NVSwitch",
    "unified memory / cudaMallocManaged and page migration",
    "pinned (page-locked) host memory and true DMA",
    "CUDA streams, cudaMemcpyAsync, overlapping transfer with compute",
    "default stream semantics and events for inter-stream sync",
    "Tensor Cores, WMMA API, FP16/BF16/TF32 with FP32 accumulate",
    "deep learning: feedforward nets, gradient descent, convolution as GEMM (im2col)",
    "alternatives: OpenCL, SYCL, HIP, OpenACC, OpenMP offload, Vulkan/Metal, WebGPU (WGSL), RAI",
    "CUDA-to-WebGPU mapping table (grid/block/thread vs workgroup/invocation)",
  ],
  "learning_objectives": [
    "Identify design space and explore optimization opportunities for the solutions",
    "Identify limitations of the solutions and future directions",
    "Understand and apply common parallel programming interface features",
  ],
  "available_public_info": "公开讲义 Slide Deck 16 (Machine and Deep Learning)、Slide Deck 17 (Feedforward Networks and Gradient Descent)、Slide Deck 18 (Computation in Deep Neural Networks)、Slide Deck 19 (GPUs in the PC Architecture)、Slide Deck 20 (GPU Data Transfer)、Slide Deck 21 (Tensor Operations)、Slide Deck 22 (Alternatives to CUDA) 全部公开。课程目录页确认 'WebGPU for labs, RAI for final project'。",
  "source_slide_decks": [
    "Slide Deck 16: Machine and Deep Learning",
    "Slide Deck 17: Feedforward Networks and Gradient Descent",
    "Slide Deck 18: Computation in Deep Neural Networks",
    "Slide Deck 19: GPUs in the PC Architecture",
    "Slide Deck 20: GPU Data Transfer",
    "Slide Deck 21: Tensor Operations",
    "Slide Deck 22: Alternatives to CUDA",
  ]
}

L12 · Final Project: Problem Definition, Design, Optimisation, and Reporting

{
  "lecture_topic": "Final Project: Problem Definition, Design, Optimisation, and Reporting",
  "related_lab": "Final Project: Proposal + Workshop + Presentation + Report",
  "key_concepts_raw": [
    "project deliverables and grading (25% of course; ~50% correctness, ~50% performance)",
    "problem selection: data parallelism, arithmetic intensity, regularity, scale",
    "performance engineering cycle: baseline, profile, hypothesise, change one variable, re-measure",
    "design space exploration: block size, tile size, coarsening factor, padding, vectorisation, streams",
    "golden reference construction and floating-point tolerance",
    "robustness: arbitrary sizes, boundary handling, multi-architecture builds",
    "technical report structure and honest reporting of failed attempts",
    "academic integrity and the AI-tool policy",
    "team work decomposition and interface contracts",
  ],
  "learning_objectives": [
    "Identify and solve a computational problem with parallel algorithm design and program",
    "Work with domain experts and teammates from different disciplines to maximize the effectiveness of solutions",
    "Properly divide up the responsibilities among teammates and support each other towards success",
    "Motivate the problem and approach in a presentation",
    "Properly explain the solutions experimented and justify the final decision and outcome",
    "Identify limitations of the solutions and future directions",
  ],
  "available_public_info": "课程目录页确认 'A final project report is required' 与 'Final Project that involves Project Proposal, Project Workshop, Project Presentation, and Project Report'。2025 夏季课程页确认 project 占 25%、含 demo/functionality/coding style 约 50% 与 performance with full functionality 约 50%。公开的 Project Plan PDF 与 Final Report Rubric 均为 404(未公开)。",
  "source_slide_decks": [
    "Slide Deck 10: Tiled Convolution Analysis (as methodology reference)",
  ]
}