From 13545b89472f3db4c8e6ec5fb817d26bbcca4036 Mon Sep 17 00:00:00 2001 From: Jiajie Chen Date: Wed, 17 Jul 2024 12:58:33 +0800 Subject: [PATCH] Add vshuf/vshuf4i figures --- docs/diagram/gen.py | 121 +++++-- docs/diagram/vshuf4i_b.svg | 124 +++++++ docs/diagram/vshuf4i_d.svg | 34 ++ docs/diagram/vshuf4i_h.svg | 68 ++++ docs/diagram/vshuf4i_w.svg | 40 +++ docs/diagram/vshuf_b.svg | 643 +++++++++++++++++++++++++++++++++++++ docs/diagram/vshuf_d.svg | 41 +++ docs/diagram/vshuf_h.svg | 203 ++++++++++++ docs/diagram/vshuf_w.svg | 79 +++++ 9 files changed, 1333 insertions(+), 20 deletions(-) create mode 100644 docs/diagram/vshuf4i_b.svg create mode 100644 docs/diagram/vshuf4i_d.svg create mode 100644 docs/diagram/vshuf4i_h.svg create mode 100644 docs/diagram/vshuf4i_w.svg create mode 100644 docs/diagram/vshuf_b.svg create mode 100644 docs/diagram/vshuf_d.svg create mode 100644 docs/diagram/vshuf_h.svg create mode 100644 docs/diagram/vshuf_w.svg diff --git a/docs/diagram/gen.py b/docs/diagram/gen.py index 8993bd9a..0e7adb21 100644 --- a/docs/diagram/gen.py +++ b/docs/diagram/gen.py @@ -9,11 +9,16 @@ desc_y_off = 15 element_x = 10 element_x_unit = 2 -col_space = 570 +col_space = -1 box_height = 26 def init(f, rows, cols): + global col_space + if vlen == 256: + col_space = 570 + else: + col_space = 300 print( f""" 8 else "a", + "data", + indices=list(range(vlen // elen * 2 - 1, vlen // elen - 1, -1)), + ) + add_box( + f, + "c" if elen > 8 else "b", + "data", + indices=list(range(vlen // elen - 1, -1, -1)), + ) + add_row(f) + add_box(f, "a" if elen > 8 else "c", "indices") + add_row(f) + add_box(f, "ret", "returns") + + # b to a & c to a + for i in range(vlen // elen): + for j in range(vlen // elen): + add_line(f, 1, 0, j, 2, 0, i) + add_line(f, 1, 1, j, 2, 0, i) + + # a to ret + for i in range(vlen // elen): + add_line(f, 2, 0, i, 3, 0, i) + end(f) + +def vshuf4i_d(): + global elen, vlen + elen = 64 + vlen = 128 + with open("vshuf4i_d.svg", "w") as f: + init(f, 2, 2) + add_row(f) + add_box( + f, + "b", + "data", + indices=[3, 2], + ) + add_box( + f, + "a", + "data", + indices=[1, 0], + ) + add_row(f) + add_box(f, "ret", "returns") + + # a & b to returns + add_line(f, 1, 0, 0, 2, 0, 1) + add_line(f, 1, 0, 1, 2, 0, 1) + add_line(f, 1, 1, 0, 2, 0, 1) + add_line(f, 1, 1, 1, 2, 0, 1) + add_line(f, 1, 0, 0, 2, 0, 0) + add_line(f, 1, 0, 1, 2, 0, 0) + add_line(f, 1, 1, 0, 2, 0, 0) + add_line(f, 1, 1, 1, 2, 0, 0) + end(f) + + if __name__ == "__main__": xvshuf() xvshuf4i_bhw() xvshuf4i_d() + vshuf() + vshuf4i_d() diff --git a/docs/diagram/vshuf4i_b.svg b/docs/diagram/vshuf4i_b.svg new file mode 100644 index 00000000..c2bc66b4 --- /dev/null +++ b/docs/diagram/vshuf4i_b.svg @@ -0,0 +1,124 @@ + +(1) +a +data + +3 + +2 + +1 + +0 + +3 + +2 + +1 + +0 + +3 + +2 + +1 + +0 + +3 + +2 + +1 + +0 +upper +lower +(2) +ret +returns + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/diagram/vshuf4i_d.svg b/docs/diagram/vshuf4i_d.svg new file mode 100644 index 00000000..10a24caf --- /dev/null +++ b/docs/diagram/vshuf4i_d.svg @@ -0,0 +1,34 @@ + +(1) +b +data + +3 + +2 +upper +lower +a +data + +1 + +0 +upper +lower +(2) +ret +returns + + + + + + + + + + + diff --git a/docs/diagram/vshuf4i_h.svg b/docs/diagram/vshuf4i_h.svg new file mode 100644 index 00000000..3893dc4d --- /dev/null +++ b/docs/diagram/vshuf4i_h.svg @@ -0,0 +1,68 @@ + +(1) +a +data + +3 + +2 + +1 + +0 + +3 + +2 + +1 + +0 +upper +lower +(2) +ret +returns + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/diagram/vshuf4i_w.svg b/docs/diagram/vshuf4i_w.svg new file mode 100644 index 00000000..1ae56c19 --- /dev/null +++ b/docs/diagram/vshuf4i_w.svg @@ -0,0 +1,40 @@ + +(1) +a +data + +3 + +2 + +1 + +0 +upper +lower +(2) +ret +returns + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/diagram/vshuf_b.svg b/docs/diagram/vshuf_b.svg new file mode 100644 index 00000000..8d80113f --- /dev/null +++ b/docs/diagram/vshuf_b.svg @@ -0,0 +1,643 @@ + +(1) +a +data + +31 + +30 + +29 + +28 + +27 + +26 + +25 + +24 + +23 + +22 + +21 + +20 + +19 + +18 + +17 + +16 +upper +lower +b +data + +15 + +14 + +13 + +12 + +11 + +10 + +9 + +8 + +7 + +6 + +5 + +4 + +3 + +2 + +1 + +0 +upper +lower +(2) +c +indices + + + + + + + + + + + + + + + + +(3) +ret +returns + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/diagram/vshuf_d.svg b/docs/diagram/vshuf_d.svg new file mode 100644 index 00000000..677c9548 --- /dev/null +++ b/docs/diagram/vshuf_d.svg @@ -0,0 +1,41 @@ + +(1) +b +data + +3 + +2 +upper +lower +c +data + +1 + +0 +upper +lower +(2) +a +indices + + +(3) +ret +returns + + + + + + + + + + + + + diff --git a/docs/diagram/vshuf_h.svg b/docs/diagram/vshuf_h.svg new file mode 100644 index 00000000..5c528285 --- /dev/null +++ b/docs/diagram/vshuf_h.svg @@ -0,0 +1,203 @@ + +(1) +b +data + +15 + +14 + +13 + +12 + +11 + +10 + +9 + +8 +upper +lower +c +data + +7 + +6 + +5 + +4 + +3 + +2 + +1 + +0 +upper +lower +(2) +a +indices + + + + + + + + +(3) +ret +returns + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/diagram/vshuf_w.svg b/docs/diagram/vshuf_w.svg new file mode 100644 index 00000000..5ddf2000 --- /dev/null +++ b/docs/diagram/vshuf_w.svg @@ -0,0 +1,79 @@ + +(1) +b +data + +7 + +6 + +5 + +4 +upper +lower +c +data + +3 + +2 + +1 + +0 +upper +lower +(2) +a +indices + + + + +(3) +ret +returns + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +