From 61252c84504aad54c148eacf736cf5207c4c312e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Th=C3=A9ophile=20Bastian?= <contact@tobast.fr>
Date: Sat, 6 Jan 2024 13:04:08 +0100
Subject: [PATCH] Beginning of cyc{K} definition writeup

---
 .../20_foundations/20_code_analyzers.tex      | 44 ++++++++++++++++++-
 1 file changed, 43 insertions(+), 1 deletion(-)

diff --git a/manuscrit/20_foundations/20_code_analyzers.tex b/manuscrit/20_foundations/20_code_analyzers.tex
index 5ea3a03..380a6ec 100644
--- a/manuscrit/20_foundations/20_code_analyzers.tex
+++ b/manuscrit/20_foundations/20_code_analyzers.tex
@@ -163,8 +163,50 @@ be analyzed.
 
 \subsection{Examples with \llvmmca}
 
+\todo{}
+
 \subsection{Definitions}
 
-\subsubsection{Throughput and reverse-throughput}
+\subsubsection{Throughput and reciprocal throughput}
+
+Given a kernel $\kerK$ of straight-line assembly code, we have referred to
+$\cyc{\kerK}$ as the \emph{reciprocal throughput} of $\kerK$, that is, how many
+cycles $\kerK$ will require to complete its execution in steady-state. We
+define this notion here more formally.
+
+\begin{definition}[Reciprocal throughput of a kernel]
+    The \emph{reciprocal throughput} of a kernel $\kerK$, noted $\cyc{\kerK}$
+    and measured in \emph{cycles per iteration}, is also called the
+    steady-state execution time of a kernel.
+
+    It is defined as the
+    number of cycles, \emph{in steady-state}, from the moment the first
+    instruction of the kernel starts to be decoded to the moment the last
+    instruction of the kernel is issued.
+
+    This number may not be an integer if, \eg{}, \todo{}
+\end{definition}
+
+Due to the pipelined nature of execution units, this means that the same
+instruction of each iteration of $\kerK$ will be retired ---~\ie{} yield its
+result~--- every steady-state execution time. For this reason, the execution
+time is measured until the last instruction is issued, not retired.
+
+Throughout this manuscript, we mostly use reciprocal throughput as a metric, as
+we find it more relevant from an optimisation point of view ---~an opinion we
+detail in \autoref{chap:CesASMe}. However, the
+\emph{throughput} of a kernel is most widely used in the literature in its
+stead.
+
+\begin{definition}[Throughput of a kernel]
+    The \emph{throughput} of a kernel $\kerK$, measured in \emph{instructions
+    per cycle}, or IPC, is defined as the number of instructions in $\kerK$, divided
+    by the steady-state execution time of $\kerK$.
+\end{definition}
+
+In the literature or in analyzers' reports, the throughput of a kernel is often
+referred to as its \emph{IPC} (its unit).
+
+\todo{Measure of $\cyc{\kerK}$}
 
 \subsubsection{Basic block of an assembly-level program}