add in skip mode implementation into matrix demo
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Mon, 5 Jul 2021 11:36:46 +0000 (12:36 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Mon, 5 Jul 2021 11:36:54 +0000 (12:36 +0100)
openpower/sv/remapmatrixprint.py
openpower/sv/remapyield.py
openpower/sv/shape_table_format.mdwn

index 94a4c4b5200bf2d7785356bc372a74ef219e1f80..577f2a7270849dc0569be036dbab1e1c0d99d251 100644 (file)
@@ -56,20 +56,23 @@ def matrixscheduledemo():
     SVSHAPE0.lims = [xdim2, ydim2, 1]
     SVSHAPE0.order = [0,1,2]  # result iterates through i and j (modulo)
     SVSHAPE0.mode = 0b00
+    SVSHAPE0.skip = 0b00
     SVSHAPE0.offset = 0       # no offset
     SVSHAPE0.invxyz = [0,0,0] # no inversion
     # X uses SVSHAPE1
     SVSHAPE1 = SVSHAPE()
     SVSHAPE1.lims = [xdim2, ydim2, ydim1]
     SVSHAPE1.order = [0,2,1]  # X iterates through i and k
-    SVSHAPE1.mode = 0b10
+    SVSHAPE1.mode = 0b00
+    SVSHAPE1.skip = 0b01
     SVSHAPE1.offset = 0       # no offset
     SVSHAPE1.invxyz = [0,0,0] # no inversion
     # y-selector uses SHAPE2
     SVSHAPE2 = SVSHAPE()
     SVSHAPE2.lims = [xdim2, ydim2, ydim1]
     SVSHAPE2.order = [0,2,1]  # X iterates through i and k
-    SVSHAPE2.mode = 0b01
+    SVSHAPE2.mode = 0b00
+    SVSHAPE2.skip = 0b11
     SVSHAPE2.offset = 0       # no offset
     SVSHAPE2.invxyz = [0,0,0] # no inversion
 
index 6c53f65b6919745700781baa9a7e6b37e5b3c144..7ff21c0b1bb55c3c4ac6c2de67797039568047d9 100644 (file)
@@ -28,23 +28,31 @@ def iterate_indices(SVSHAPE):
                             (SVSHAPE.lims[1], y, "y"),
                             (SVSHAPE.lims[2], z, "z")
                            ]
-                    # now select those by order:
+                    # now select those by order.  this allows us to
+                    # create schedules for [z][x], [x][y], or [y][z]
+                    # for matrix multiply.
                     vals = [vals[SVSHAPE.order[0]],
                             vals[SVSHAPE.order[1]],
                             vals[SVSHAPE.order[2]]
                            ]
-                    # ok now we can construct the result, using bits of
-                    # "order" to say which ones get stacked on
+                    # some of the dimensions can be "skipped".  the order
+                    # was actually selected above on all 3 dimensions,
+                    # e.g. [z][x][y] or [y][z][x].  "skip" allows one of
+                    # those to be knocked out
+                    if SVSHAPE.skip == 0b00:
+                        select = 0b111
+                    elif SVSHAPE.skip == 0b11:
+                        select = 0b011
+                    elif SVSHAPE.skip == 0b01:
+                        select = 0b110
+                    elif SVSHAPE.skip == 0b10:
+                        select = 0b101
+                    else:
+                        select = 0b111
                     result = 0
                     mult = 1
-                    if SVSHAPE.mode == 0b00:
-                        permute = 0b111
-                    elif SVSHAPE.mode == 0b01:
-                        permute = 0b011
-                    elif SVSHAPE.mode == 0b10:
-                        permute = 0b110
-                    else:
-                        permute = 0b111
+                    # ok now we can construct the result, using bits of
+                    # "order" to say which ones get stacked on
                     for i in range(3):
                         lim, idx, dbg = vals[i]
                         if permute & (1<<i):
index c219901e843d42018c187152c2ac780dd5cff1c6..cd1b50a6ce92a6836fff9e33d95218bb1fc19950 100644 (file)
@@ -3,13 +3,13 @@ disabled: the register's elements are a linear (1D) vector.
 
 | 31..30 | 29..28 | 27..24 | 23..21 | 20..18  | 17..12  | 11..6   | 5..0    |
 | ------ | ------ | ------ | ------ | ------- | ------- | ------- | ------- |
-| mode   | skip   | offset | invxyz | permute | zdimsz  | ydimsz  | xdimsz  |
-| 0b11   | skip   | offset | invxyz | submode | rsvd    | rsvd    | xdimsz  |
+| 0b00   | skip   | offset | invxyz | permute | zdimsz  | ydimsz  | xdimsz  |
+| 0b01   | submode| offset | invxyz | rsvd    | rsvd    | rsvd    | xdimsz  |
 
 mode sets different behaviours (straight matrix multiply, FFT, DCT).
 
-* **mode=0b00** sets straight permute/skip, for matrices
-* **mode=0b01** sets further sub-modes including "FFT / DCT" mode
+* **mode=0b00** sets straight Matrix Mode
+* **mode=0b01** sets "FFT / DCT" mode and activates submodes
 
 submode further selects schedules for FFT and DCT.