Workload Arithmetic and Performance Contracts

Optimization starts with a workload and a falsifiable performance model. This stage traces one transformer request from prefill through decode, accounts for operations and bytes, and defines evidence strong enough to distinguish useful speed from a misleading microbenchmark.

Section 1 of 10 · 10 units · about 37 hours

0/10

By the end you can Predict operations, useful and allocated bytes, key-value memory, latency regimes and an end-to-end speedup bound for one request, then reconcile the model with a cold and warm trace under a versioned claim and artifact schema.

Units

Build it

Mini project · about 10 to 14 hours

Workload arithmetic and a falsifiable claim record for kernellab

Build the kernellab harness and fix one transformer workload with its operation and byte arithmetic. Sweep one batched matmul from floor to plateau, score latency with an SLO rule, and file a falsifiable claim record that later sections test. The harness, manifests and sweep carry into every later section.

  1. 1Create kernellab with harness/, kernels/cuda/, kernels/triton/, refs/, tests/, profiles/, reports/ and manifests/. Build every kernel with -arch=native, size work to fit your GPU's memory, and record hardware, toolkit and revision in manifests/env.json.
  2. 2Fix one workload card with medians, spread and arrival behavior, and keep separate cold and warm traces. Discard cold trials by rule, read the warm median from interleaved repeats, and keep raw samples with revision lineage.
  3. 3Derive dense operations, attention operations and parameter plus cache bytes for your workload closed-book. Check each line against an independent reference, for example a published shape manifest, and keep the arithmetic sheet.
  4. 4Sweep one batched matmul plus a device-to-device copy with event timing and interleaved repeats. Plot achieved throughput against batch, report the knee and floor, and name the bound on each side of the ridge.
  5. 5Implement Etalon Algorithm 1 in refs/ and score one real timestamp trace with a fitted prefill deadline. Bound one kernel share with Amdahl, reconcile one baseline prediction with named residuals, and keep both reports.
  6. 6File one claim record in manifests/ before profiling with workload, baseline, timing boundary, prediction and falsifier. Add the training-step operations and memory check as a derived prediction, and keep the lineage from revision to number.
What you hand in
  • kernellab with the environment manifest, workload card, and cold plus warm traces with raw samples.
  • The arithmetic sheet, batch sweep with knee and ridge bound, and the falsifiable claim record.
  • Etalon scores, Amdahl bounds and the baseline reconciliation with named residuals.
How to check it
  • Self-grade with the rubric below
How it's graded

Arithmetic before timing

Pass: The sheet derives operations and bytes against independent references, and every number traces to manifest and raw trials.

Great: Each residual names an independent line and leaves unexplained remainder unexplained.

Cold and warm separation

Pass: Cold trials are discarded by rule, warm medians come from interleaved repeats, and raw samples are kept.

Great: The report states which state each run preserves and shows convergence before the median.

SLO and bound discipline

Pass: Your Algorithm 1 implementation scores the paper's example traces, Amdahl bounds precede profiling, and the baseline matches workload.

Great: The write-up shows a case where peak throughput and SLO qualified rate rank systems differently.

Resources

  • How to Scale Your Model - InferenceJAX Scaling Book

    Work through the single-request, batching, key-value memory and parallelism arithmetic. Recompute every quantity for the small model and workload used by the track project, keeping symbols, units and assumptions visible.

  • Transformer Inference ArithmeticKipply

    Reproduce the FLOP, parameter-byte, key-value-byte and communication estimates for dense transformer inference. Compare the formulas with an instrumented framework trace and explain model residuals instead of fitting constants after measurement.

  • Efficiently Scaling Transformer InferenceMLSys

    Study the latency, memory and parallelism model. Use the paper to derive a batch and parallelism crossover for your workload, while reserving distributed execution for GPU-9.

  • How to Scale Your Model - TrainingJAX Scaling Book

    Work Some Problems to Work Questions 1 to 3 for training-step parameters, Adam and activation bytes and step time; read Data Parallelism and Fully-Sharded Data Parallelism for the comms-bound batch rule.

  • EtalonEtalon Authors

    Read the latency metric definitions, their pitfalls and fluidity-index. Add TTFT and TPOT SLOs to a small load generator, and show why peak token throughput can rank two systems differently from an SLO-qualified rate.

  • GPU Microbenchmark and Kernel SuiteRoadmap-Final

    Adopt the project harness schema, architecture constraints and hardware tiers now. Implement only the environment manifest, independent references, raw-trial storage and the initial operation and byte models in this stage.

  • DistServe: Disaggregating Prefill and Decoding for Goodput-optimized LLM ServingZhong et al. (OSDI 2024)

    Read Section 1 with Figure 1 for per-GPU goodput: the highest request rate served while a target share of requests meets the TTFT and TPOT SLOs.

  • AI Performance Engineering - Start HereWafer

    A curated, dated index. Its Start Here list names the readings this section already assigns; use the later sections only to find a primary source for a later section, never as the reading itself.

  • Amdahl's lawWikipedia

    Read Definition and Derivation for the overall-speedup formula with the worked share examples; apply it to kernel time shares at fixed workload.