From 5449246dec15b16e29f2b1a1eed5f48edb0b4b70 Mon Sep 17 00:00:00 2001
From: Hashim Sharif <hsharif3@miranda.cs.illinois.edu>
Date: Tue, 30 Mar 2021 20:00:33 -0500
Subject: [PATCH] Describing Approximation Knobs

---
 .../developerdocs/configuration-format.rst    | 171 +++++++++++++++++-
 1 file changed, 170 insertions(+), 1 deletion(-)

diff --git a/hpvm/docs/developerdocs/configuration-format.rst b/hpvm/docs/developerdocs/configuration-format.rst
index 04efaba367..1616e58ed4 100644
--- a/hpvm/docs/developerdocs/configuration-format.rst
+++ b/hpvm/docs/developerdocs/configuration-format.rst
@@ -28,5 +28,174 @@ The `$config_id` is the configuration ID in the configuration file. A configurat
 
 `$real_accuracy` is the accuracy of the program on the tune set (inputs used for tuning) when no approximations are applied and `$accuracy_degradation` is the drop in accuracy when applying the configuration that follows - the specific knob settings that follow.
 
-`$hpvm_node_id` specifies the node ID to apply the approximation knobs for, `$device` specifies the device to offload to, `$tensor_op_type` specifies the type of tensor operation (conv, mul, add, relu etc.), and `$approximation_knob` is the knob setting corresponding to this tensor operation. The autotuner selects these knobs.  
+`$hpvm_node_id` specifies the node ID to apply the approximation knobs for, `$device` specifies the device to offload to, `$tensor_op_type` specifies the type of tensor operation (conv, mul, add, relu etc.), and `$approximation_knob` is the knob setting corresponding to this tensor operation. The autotuner selects these knobs.
+
+Approximation Knobs
+--------------------
+
+The `$approximation_knob` is an integer ID that represents an approximation knob.
+HPVM currently supports `fp16` and `fp32` for all
+types of tensor operations. For convolution operations, "sampling" and "perforation" are the
+supported algorithmic approximations with the following knobs.
+
+
+Perforation Knobs
+^^^^^^^^^^^^^^^^^
+
+.. list-table::
+   :header-rows: 1
+
+   * - Knob
+     - FP Precision
+     - PerforationRate (%)
+     - PerforationType
+     - StartOffset
+   * - 121
+     - FP32
+     - 50%
+     - Col
+     - 0
+   * - 122
+     - FP32
+     - 50%
+     - Col
+     - 1
+   * - 123
+     - FP32
+     - 50%
+     - Row
+     - 0
+   * - 124
+     - FP32
+     - 50%
+     - Row
+     - 1
+   * - 125
+     - FP32
+     - 33%
+     - Col
+     - 0
+   * - 126
+     - FP32
+     - 33%
+     - Col
+     - 1
+   * - 127
+     - FP32
+     - 33%
+     - Col
+     - 2
+   * - 128
+     - FP32
+     - 33%
+     - Row
+     - 0
+   * - 129
+     - FP32
+     - 33%
+     - Row
+     - 1
+   * - 130
+     - FP32
+     - 33%
+     - Row
+     - 2
+   * - 131
+     - FP32
+     - 25%
+     - Col
+     - 0
+   * - 132
+     - FP32
+     - 25%
+     - Col
+     - 1
+   * - 133
+     - FP32
+     - 25%
+     - Col
+     - 2
+   * - 134
+     - FP32
+     - 25%
+     - Col
+     - 3
+   * - 135
+     - FP32
+     - 25%
+     - Row
+     - 0
+   * - 136
+     - FP32
+     - 25%
+     - Row
+     - 1
+   * - 137
+     - FP32
+     - 25%
+     - Row
+     - 2
+   * - 138
+     - FP32
+     - 25%
+     - Row
+     - 3
+
+Note that knobs `151-168` have the exact same arguments in this order but use FP16 precision (available on GPUs).
+
+Sampling Knobs
+^^^^^^^^^^^^^^^
+
+.. list-table::
+   :header-rows: 1
+
+   * - Knob
+     - FP Precision
+     - SampingRate (%)
+     - StartOffset
+   * - 231
+     - FP32
+     - 50%
+     - 0
+   * - 232
+     - FP32
+     - 50%
+     - 1
+   * - 233
+     - FP32
+     - 33%
+     - 0
+   * - 234
+     - FP32
+     - 33%
+     - 1
+   * - 235
+     - FP32
+     - 33%
+     - 2
+   * - 236
+     - FP32
+     - 25%
+     - 0
+   * - 237
+     - FP32
+     - 25%
+     - 1
+   * - 238
+     - FP32
+     - 25%
+     - 2
+   * - 239
+     - FP32
+     - 25%
+     - 3
+  
+
+Note that knobs `261-269` have the exact same arguments in this order but use FP16 precision (available on GPUs).
+
+
+
+The mappings for these approximation knobs are parsed by  the HPVM Tensor Runtime from `hpvm/hpvm/projects/hpvm-tensor-rt/global_knobs.txt`.
+
+
 
-- 
GitLab