(no commit message)
[libreriscv.git] / 3d_gpu / architecture / dynamic_simd / shape.mdwn
index d3981c7a7d3cfcc51f93a8a267db40b7ec012d14..dddf664835ef8820b04b54c173f3fa30cfa855c6 100644 (file)
@@ -33,4 +33,52 @@ Exponent:
 * 4xFP16: 5 bits, four exponents
 * 4xBF16: 8 bits, four exponents
 
+`SimdShape` needs this information in addition to the normal
+information (width, sign) in order to create the partitions
+that allow standard nmigen operations to **transparently**
+and naturally take place at **all** of these non-uniform
+widths, as if they were in fact scalar Signals *at* those
+widths.
+
+A minor wrinkle which emerges from deep analysis is that the overall
+available width (`Shape.width`) does in fact need to be explicitly
+declared, and
+the sub-partitions fit onto power-of-two boundaries, in order to allow
+straight wire-connections rather than allow the SimdSignal to be
+arbitrary-sized (compact).  Although on shallow inspection this
+initially would seem to imply that it would result in large unused
+sub-partitions (padding partitions) these gates can in fact be eliminated
+with a "blanking" mask, created from static analysis of the SimdShape
+context.
+
+Example:
+
+* all 32 and 16-bit values are actually to be truncated to 11 bit
+* all 8-bit values to 5-bit
+
+from these we can write out the allocations, bearing in mind that
+in each partition the sub-signal must start on a power-2 boundary,
+and that "x" marks unused (padding) portions:
+          |31|  |  |  |     16|15|  |   8|7     0 |
+    32bit | x| x| x|  |      x| x| x|10 ....    0 |
+    16bit | x| x|26    ... 16 | x| x|10 ....    0 |
+    8bit  | x|28 .. 24|  20.16| x|12 .. 8|x|4.. 0 |
+
+thus, we deduce, we *actually* need breakpoints at these positions,
+and that unused portions common to **all** cases can be deduced
+and marked "x"
+
+          |  |28|26|24| |20|16|  |12|10|8| |4     |
+            x                   x
+
+These 100% unused "x"s therefore define the "blanking" mask, and in
+these sub-portions it is unnecessary to allocate computational gates.
+
+Also in order to save gates, in the example above there are only three
+cases (32 bit, 16 bit, 8 bit) therefore only three sets of logic
+are required to construct the larger overall computational result
+from the "smaller chunks", rather than at first glance, with there
+being 9 actual partitions (28, 26, 24, 20, 16, 12, 10, 8, 4), it
+would appear that 2^9 (512!) cases were required.