From eb5a8b00789574f6867e1a92c0e6c97c250bc4ce Mon Sep 17 00:00:00 2001 From: Georgy Evtushenko Date: Wed, 3 May 2023 10:32:57 +0400 Subject: [PATCH] A few definitions --- docs/tuning.rst | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 docs/tuning.rst diff --git a/docs/tuning.rst b/docs/tuning.rst new file mode 100644 index 0000000000..2536ae734d --- /dev/null +++ b/docs/tuning.rst @@ -0,0 +1,33 @@ +CUB Tuning Infrastructure +================================================================================ + +Device-scope algorithms in CUB have many knobs that do not affect the algorithms' correctness but can significantly impact performance. For instance, the number of threads per block and items per thread can be tuned to maximize performance for a given device and data type. +This document describes CUB Tuning Infrastructure, a set of tools facilitating the process of +selecting optimal tuning parameters for a given device and data type. + +Definitions +-------------------------------------------------------------------------------- + +Terms might be ambiguous in a generic context. Below, we omit the word "tuning" but assume it in all definitions. +Algorithms are tuned for different workloads. For instance, radix sort can be tuned for different key types, different number of keys, and different distribution of keys. We separate tuning parameters into two categories: + +* **Compile-time (ct) Workload** - a workload that can be recognized at compile time. For instance, the combination of key type and offset type is a compile-time workload for radix sort. + +* **Runtime (rt) Workload** - a workload that can be recognized only at runtime. For instance, the number of keys along with their distribution is a runtime workload for radix sort. + +* **Parameter** - a parameter that can be tuned to maximize performance for a given device and data type. For instance, the number of threads per block and items per thread are tuning parameters. + +* **Parameter Space** - the set of all possible values for a given tuning parameter. Parameter Space is specific to algorithm. For instance, the parameter space for the number of threads per block is :math:`\{32, 64, 96, 128, \dots, 1024\}` for radix sort, but :math:`\{32, 64, 128, 256, 512\}` for merge sort. + +* **Parameter Point** - a concrete value of a tuning parameter. For instance, the parameter point for the number of threads per block is :math:`threads\_per\_block=128`. + +* **Search Space** - Cartesian product of parameter spaces. For instance, search space for an algorithm with tunable items per thread and threads per block might look like :math:`\{(ipt \times tpb) | ipt \in \{1, \dots, 25\} \text{and} tpb \in \{32, 64, 96, 128, \dots, 1024\}\}`. + +* **Variant** - a point from corresponding search space. + +* **Base** - a variant that CUB uses by default. + +* **Score** - a single number representing the performance for a given compile-time workload and all runtime workloads. For instance, a weighted-sum of speedups of a given variant compared to its base for all runtime workloads is a score. + +* **Search** - a process consisting of covering all variants for all compile-time workloads to find a variant with maximal score. +