Majid Al-RaimiInside EIE: dataflow, the PE and its storage formatsداخل EIE: تدفق البيانات وعنصر المعالجة وصيغ التخزين

COE 592Lecture 4.2المحاضرة 4.2Part 08الجزء 08

Inside EIE: dataflow, the PE and its storage formatsداخل EIE: تدفق البيانات وعنصر المعالجة وصيغ التخزين

How a nonzero activation walks through the PE array, what one processing element contains, how load is balanced, and how activation sparsity, CSC weight storage and 4-bit codebooks are realised in hardware.كيف يمر تنشيط غير صفري عبر مصفوفة عناصر المعالجة (PE)، وما يحتويه عنصر معالجة واحد، وكيف يُوازَن الحمل، وكيف يُنفَّذ تناثر التنشيطات وتخزين الأوزان بصيغة CSC ودفاتر الترميز (codebooks) ذات 4 بت في العتاد.

Conceptsالمفاهيم
3
Slidesالشرائح
61-70
Readingمدة القراءة
18 min18 دقيقة
Understoodما فهمته
0/3 conceptsمفاهيم

Why this part mattersلماذا يهمّ هذا الجزء

Part 07 argued that a pruned, quantized network is only fast if the hardware never looks at a zero. This part is where that argument turns into wires and SRAM words. It follows one nonzero activation from the moment the controller finds it to the moment its products land in output registers, opens a single processing element to see the five stages inside, and then reads the storage format bit by bit.

Exam questions on EIE ask for exactly these three things: the dataflow, the PE stages in order, and the storage format with bit widths. Your research project on embedded inference needs the same reasoning whenever you choose a sparse format or an accelerator, because the questions never change: how much metadata does each nonzero cost, how do you keep parallel units equally busy, and how much of the model fits on chip. The running example is the same 8 x 4 matrix on four PEs that part 07 introduced.

بيّن الجزء 07 أن الشبكة المقلَّمة (pruned) والمكمَّاة (quantized) لا تكون سريعة إلا إذا لم ينظر العتاد إلى أي صفر على الإطلاق. وفي هذا الجزء تتحول تلك الحجة إلى أسلاك وكلمات SRAM. نتتبع تفعيلًا واحدًا غير صفري من لحظة عثور وحدة التحكم عليه إلى لحظة وصول نواتج ضربه إلى سجلات المخرجات، ثم نفتح عنصر معالجة (PE) واحدًا لنرى المراحل الخمس بداخله، وبعدها نقرأ صيغة التخزين بتًّا بتًّا.

أسئلة الامتحان عن EIE تطلب هذه الأمور الثلاثة تحديدًا: مسار البيانات (dataflow)، ومراحل الـ PE بالترتيب، وصيغة التخزين مع عرض كل حقل بالبتات. ومشروعك البحثي في الاستدلال على الأنظمة المدمجة (embedded inference) يحتاج المنطق نفسه كلما اخترت صيغة متناثرة أو مسرّعًا، لأن الأسئلة لا تتغير: كم من البيانات الوصفية (metadata) تكلّف كل قيمة غير صفرية، وكيف تُبقي الوحدات المتوازية مشغولة بالتساوي، وكم من النموذج يتسع على الشريحة. المثال المستمر هو المصفوفة نفسها 8 x 4 على أربعة PEs التي قدّمها الجزء 07.

By the end you canفي نهاية هذا الجزء ستستطيع

  1. Trace a sparse matrix-vector product through EIE's broadcast-and-accumulate dataflow for a given input vector, listing which PEs work on each broadcast.تتبّع ضرب مصفوفة متناثرة في متجه عبر مسار البيانات في EIE القائم على البث ثم التجميع (broadcast-and-accumulate) لمتجه دخل معطى، مع تحديد أي الـ PEs تعمل في كل عملية بث.
  2. Name the five PE stages in order and state what data crosses each boundary.تسمية مراحل الـ PE الخمس بالترتيب، وتحديد البيانات التي تعبر كل حدّ بين مرحلتين.
  3. Encode a column in EIE's relative-index CSC with 4-bit indices, including padding, and derive the pointer array.ترميز عمود بصيغة CSC ذات الفهرس النسبي في EIE بفهارس من 4 بتات، بما في ذلك الحشو (padding)، واستنتاج مصفوفة المؤشرات.
  4. Explain how the activation FIFO, leading nonzero detection, even and odd pointer banks and the bypass path each remove a stall.شرح كيف يزيل كلٌّ من طابور التفعيلات (FIFO)، وكشف أول قيمة غير صفرية (leading nonzero detection)، وبنكي المؤشرات الزوجي والفردي، ومسار التجاوز (bypass) توقفًا معينًا.
  5. Quote the key EIE numbers: 4-bit weights and indices, a 16-entry codebook, 16-bit fixed point, FIFO depth 8, 64 PEs and 162 KB of SRAM per PE.ذكر أرقام EIE الأساسية: أوزان وفهارس من 4 بتات، وجدول ترميز (codebook) من 16 مدخلًا، وتمثيل ثابت الفاصلة (fixed point) بـ 16 بت، وعمق FIFO يساوي 8، و64 PE، و162 KB من SRAM لكل PE.

Start with the picture from part 07. An 8 x 4 weight matrix is split across four processing elements by interleaving rows: PE0 owns rows 0 and 4, PE1 rows 1 and 5, PE2 rows 2 and 6, PE3 rows 3 and 7. In general, with N PEs, PE k holds every row i with i mod N = k, together with the output b_i it will produce and the input a_i of the same index (Han et al., 2016). The input vector for the layer is a = (0, a1, 0, a3): two of its four entries are zero, which is typical of what ReLU leaves behind.

ابدأ بالصورة من الجزء 07. مصفوفة أوزان 8 x 4 مقسّمة على أربعة عناصر معالجة (processing elements) بتوزيع الصفوف بالتناوب: PE0 يملك الصفين 0 و4، وPE1 الصفين 1 و5، وPE2 الصفين 2 و6، وPE3 الصفين 3 و7. وبشكل عام، مع N من الـ PEs، يحمل الـ PE رقم k كل صف i يحقق i mod N = k، ومعه المخرج b_i الذي سينتجه والمدخل a_i ذو الفهرس نفسه (Han et al., 2016). متجه الدخل لهذه الطبقة هو a = (0, a1, 0, a3): اثنان من مدخلاته الأربعة أصفار، وهذا معتاد فيما يتركه ReLU خلفه.

The whole computation is a sequence of broadcasts. A central control unit scans a for its next nonzero, finds a1 at index 1, and sends the pair (a1, 1) to every PE at once. Each PE then does something entirely local: it looks up column 1 of its own rows in compressed form, multiplies each nonzero weight it finds there by a1, and adds the product into the output entry for that row. When every PE has finished (or, as the next concept shows, has at least queued the work), the controller finds the next nonzero, a3, and the same thing happens for column 3. Columns 0 and 2 are never visited, because the activations that would multiply them are zero, and W x 0 = 0. Inside each visited column, the zero weights are never visited either, because 0 x A = 0 and the compressed format simply does not store them.

الحساب كله سلسلة من عمليات البث (broadcasts). وحدة تحكم مركزية تمسح a بحثًا عن القيمة غير الصفرية التالية، فتجد a1 عند الفهرس 1، وترسل الزوج (a1, 1) إلى كل الـ PEs دفعة واحدة. ثم يقوم كل PE بعمل محلي بالكامل: يبحث عن العمود 1 من صفوفه الخاصة في صيغته المضغوطة، ويضرب كل وزن غير صفري يجده هناك في a1، ويضيف الناتج إلى مدخل المخرجات الخاص بذلك الصف. وعندما ينتهي كل PE (أو، كما تبيّن الفكرة التالية، يكون على الأقل قد وضع العمل في طابوره)، تجد وحدة التحكم القيمة غير الصفرية التالية a3، ويتكرر الشيء نفسه مع العمود 3. العمودان 0 و2 لا يُزاران أبدًا، لأن التفعيلات التي كانت ستُضرب فيهما أصفار، وW x 0 = 0. وداخل كل عمود يُزار، لا تُزار الأوزان الصفرية أيضًا، لأن 0 x A = 0 والصيغة المضغوطة ببساطة لا تخزنها.

a1 and then a3 reach all four PEs; PE0, PE2 and PE3 find work for a1, PE0 and PE2 for a3, each PE ticks off only the nonzero weights it owns in that column, and five of the eight outputs receive a contributionتصل a1 ثم a3 إلى الـ PEs الأربعة: PE0 وPE2 وPE3 تجد عملًا لـ a1، وPE0 وPE2 لـ a3، وكل PE يعالج فقط الأوزان غير الصفرية التي يملكها في ذلك العمود، وخمسة من المخرجات الثمانية تتلقى مساهمة

Worked exampleمثال محلول

Two broadcasts finish the layerعمليتا بث تُنهيان الطبقة

  1. Skip a0تخطَّ a0

    The leading nonzero detector reports that the first nonzero of a is a1, not a0. Column 0 holds w00 (PE0) and w50 (PE1), and neither weight is ever read.
    يُبلغ كاشف أول قيمة غير صفرية (leading nonzero detector) أن أول قيمة غير صفرية في a هي a1 وليست a0. العمود 0 يحمل w00 (في PE0) وw50 (في PE1)، ولا يُقرأ أيٌّ من الوزنين أبدًا.
  2. Broadcast (a1, 1)بث (a1, 1)

    PE0 walks its column-1 slice and finds w01, so b0 += w01 a1. PE1 finds nothing in column 1. PE2 finds w21, so b2 += w21 a1. PE3 finds w71, so b7 += w71 a1. Multiplies this round: 1, 0, 1, 1.
    يمرّ PE0 على شريحته من العمود 1 فيجد w01، إذن b0 += w01 a1. لا يجد PE1 شيئًا في العمود 1. يجد PE2 الوزن w21، إذن b2 += w21 a1. يجد PE3 الوزن w71، إذن b7 += w71 a1. عدد عمليات الضرب في هذه الجولة: 1, 0, 1, 1.
  3. Skip a2تخطَّ a2

    Column 2 holds w12 (PE1) and w42 (PE0). Both stay untouched.
    العمود 2 يحمل w12 (في PE1) وw42 (في PE0). يبقى كلاهما دون أن يُمس.
  4. Broadcast (a3, 3)بث (a3, 3)

    PE0 finds w03 then w43: b0 += w03 a3 and b4 += w43 a3. PE2 finds w23 then w63: b2 += w23 a3 and b6 += w63 a3. PE1 and PE3 have nothing in column 3. Multiplies this round: 2, 0, 2, 0.
    يجد PE0 الوزن w03 ثم w43: b0 += w03 a3 وb4 += w43 a3. ويجد PE2 الوزن w23 ثم w63: b2 += w23 a3 وb6 += w63 a3. أما PE1 وPE3 فليس لديهما شيء في العمود 3. عدد عمليات الضرب في هذه الجولة: 2, 0, 2, 0.
  5. Seven multiplies instead of thirty-twoسبع عمليات ضرب بدلًا من اثنتين وثلاثين

    OutputالمخرجContributionsالمساهماتOwnerالمالكWhenمتى
    b0b0w01 a1 + w03 a3w01 a1 + w03 a3PE0PE0Both broadcastsعمليتا البث كلتاهما
    b2b2w21 a1 + w23 a3w21 a1 + w23 a3PE2PE2Both broadcastsعمليتا البث كلتاهما
    b4b4w43 a3w43 a3PE0PE0Second broadcast onlyالبث الثاني فقط
    b6b6w63 a3w63 a3PE2PE2Second broadcast onlyالبث الثاني فقط
    b7b7w71 a1w71 a1PE3PE3First broadcast onlyالبث الأول فقط
    b1, b3, b5b1, b3, b5no contributionلا مساهمةPE1, PE3, PE1PE1, PE3, PE1Never touchedلم تُلمس أبدًا
    What each output entry receivedما تلقّاه كل مدخل من مدخلات المخرج
    A dense multiply would have done 8 x 4 = 32 multiply-adds. EIE did 3 + 4 = 7, about 22%, and touched only the weights whose activation and value were both nonzero. ReLU then runs over b: the slide draws b2, b4 and b7 as negative, so they become zero, and the next layer's detector will skip them in turn.
    OutputالمخرجContributionsالمساهماتOwnerالمالكWhenمتى
    b0b0w01 a1 + w03 a3w01 a1 + w03 a3PE0PE0Both broadcastsعمليتا البث كلتاهما
    b2b2w21 a1 + w23 a3w21 a1 + w23 a3PE2PE2Both broadcastsعمليتا البث كلتاهما
    b4b4w43 a3w43 a3PE0PE0Second broadcast onlyالبث الثاني فقط
    b6b6w63 a3w63 a3PE2PE2Second broadcast onlyالبث الثاني فقط
    b7b7w71 a1w71 a1PE3PE3First broadcast onlyالبث الأول فقط
    b1, b3, b5b1, b3, b5no contributionلا مساهمةPE1, PE3, PE1PE1, PE3, PE1Never touchedلم تُلمس أبدًا
    What each output entry receivedما تلقّاه كل مدخل من مدخلات المخرج
    كان الضرب الكثيف (dense) سيجري 8 x 4 = 32 عملية ضرب وجمع. أما EIE فأجرى 3 + 4 = 7، أي نحو 22%، ولم يلمس إلا الأوزان التي كان تفعيلها وقيمتها كلاهما غير صفريين. بعد ذلك يعمل ReLU على b: الشريحة ترسم b2 وb4 وb7 سالبة، فتصبح أصفارًا، وسيتخطاها كاشف الطبقة التالية بدوره.

Written as a rule, each output is a sum over only the intersection of two index sets. X_i is the set of columns where row i has a nonzero weight, fixed once pruning is done, and Y is the set of nonzero activations, which changes with every input. That is the static versus dynamic distinction from part 07 written into the arithmetic: weight sparsity shrinks X_i before deployment, activation sparsity shrinks Y at run time, and the hardware only pays for pairs in both.

إذا كتبناها كقاعدة، فكل مخرج هو مجموع على تقاطع مجموعتين من الفهارس فقط. X_i هي مجموعة الأعمدة التي يملك فيها الصف i وزنًا غير صفري، وهي ثابتة بمجرد انتهاء التقليم، وY هي مجموعة التفعيلات غير الصفرية، وهي تتغير مع كل دخل. هذا هو التمييز بين التناثر الساكن والديناميكي (static versus dynamic) من الجزء 07 مكتوبًا داخل الحساب نفسه: تناثر الأوزان (weight sparsity) يقلّص X_i قبل النشر، وتناثر التفعيلات (activation sparsity) يقلّص Y وقت التشغيل، والعتاد لا يدفع إلا ثمن الأزواج الموجودة في المجموعتين معًا.

bi=ReLU(∑j∈Xi∩YS[Iij] aj)b_i = \mathrm{ReLU}\Big(\sum_{j \in X_i \cap Y} S[I_{ij}]\, a_j\Big)
One output activation. S is the 16-entry shared table and I_ij the 4-bit code stored for weight (i, j)تنشيط مخرج واحد. S هو الجدول المشترك ذو 16 مدخلًا، وI_ij الرمز ذو 4 بتات المخزن للوزن (i, j)

The S[I_ij] inside the sum is a reminder that the PE never stores the weight itself, only a 4-bit code into a shared table, which the third concept unpacks. Notice also what the four PEs did not do: they never exchanged a partial sum. Every product for row i is produced in the one PE that owns row i, so the only communication in the whole layer is the broadcast of (a_j, j) pairs, which the paper carries on an H-tree so that every PE receives it in the same cycle (Han et al., 2016).

الحد S[I_ij] داخل المجموع تذكير بأن الـ PE لا يخزن الوزن نفسه أبدًا، بل يخزن فقط رمزًا من 4 بتات يشير إلى جدول مشترك، وهذا ما تفصّله الفكرة الثالثة. لاحظ أيضًا ما لم تفعله الـ PEs الأربعة: لم تتبادل أي مجموع جزئي (partial sum) على الإطلاق. كل ناتج ضرب يخص الصف i يُنتَج داخل الـ PE الوحيد الذي يملك الصف i، لذا فالاتصال الوحيد في الطبقة كلها هو بث أزواج (a_j, j)، وتنقلها الورقة عبر شجرة H-tree كي يستقبلها كل PE في الدورة نفسها (Han et al., 2016).

Recall

What does the central control unit broadcast, and what does each PE do with it?ماذا تبث وحدة التحكم المركزية، وماذا يفعل كل PE بما يصله؟

The nonzero activation a_j together with its index j. Each PE reads the pointers p_j and p_(j+1), walks its own entries for column j, decodes each weight, works out the absolute row, and accumulates v x a_j into that row's output register.
التفعيل غير الصفري a_j مع فهرسه j. يقرأ كل PE المؤشرين p_j وp_(j+1)، ويمرّ على مدخلاته الخاصة للعمود j، ويفك ترميز كل وزن، ويحسب رقم الصف المطلق، ويجمع v x a_j في سجل المخرج الخاص بذلك الصف.

Recall

In the 8 x 4 example with a = (0, a1, 0, a3), which output entries receive a contribution, and how many multiplies happen in total?في مثال 8 x 4 مع a = (0, a1, 0, a3)، أي مدخلات المخرج تتلقى مساهمة، وكم عملية ضرب تحدث إجمالًا؟

b0, b2, b4, b6 and b7. Seven multiplies: three for a1 and four for a3, against 32 for the dense product.
b0 وb2 وb4 وb6 وb7. سبع عمليات ضرب: ثلاث لـ a1 وأربع لـ a3، مقابل 32 في الضرب الكثيف.

Quick checkاختبار سريع

In EIE, how is the weight matrix divided among the processing elements?في EIE، كيف تُقسَّم مصفوفة الأوزان على عناصر المعالجة؟

Now stand inside PE0 while (a3, 3) arrives. The pair lands in a small queue at the front of the PE. The index 3 is used to look up where column 3 starts and ends in this PE's compressed storage. Those two addresses fetch the entries for the column, each an encoded weight plus a relative row index. The weight code is expanded to a real number, the relative index is turned into an absolute row, the multiply and add happen, and the result is written into the destination register for that row. When the layer is complete, ReLU and a leading nonzero detector turn the destination registers into the next layer's input. The slide draws this as the queue, then four dashed regions, then a ReLU and detector tail, and every EIE exam answer should be able to name the five stages in order.

الآن قف داخل PE0 لحظة وصول (a3, 3). يدخل الزوج إلى طابور صغير في مقدمة الـ PE. يُستخدم الفهرس 3 لمعرفة أين يبدأ العمود 3 وأين ينتهي في التخزين المضغوط (compressed storage) الخاص بهذا الـ PE. هذان العنوانان يجلبان مدخلات العمود، وكل مدخل وزن مرمَّز مع فهرس صف نسبي. يُوسَّع رمز الوزن إلى عدد حقيقي، ويُحوَّل الفهرس النسبي إلى صف مطلق، ويحدث الضرب والجمع، وتُكتب النتيجة في سجل الوجهة الخاص بذلك الصف. وعند اكتمال الطبقة، يحوّل ReLU وكاشف أول قيمة غير صفرية سجلات الوجهة إلى دخل الطبقة التالية. ترسم الشريحة هذا على شكل الطابور، ثم أربع مناطق منقّطة، ثم ذيل فيه ReLU والكاشف، ويجب أن تستطيع كل إجابة امتحان عن EIE تسمية المراحل الخمس بالترتيب.

Act QueueAct Queue
value + index, depth 8قيمة + فهرس، بعمق 8

Holds broadcast (a_j, j) pairs so this PE can lag or lead the others.

تحتفظ بأزواج البث (a_j, j) حتى تتمكن هذه الـ PE من التأخر عن الوحدات الأخرى أو سبقها.

index jالفهرس j
Pointer ReadPointer Read
even and odd SRAM banksبنكا SRAM زوجي وفردي

Reads p_j and p_(j+1), the start and end of column j, in one cycle.

تقرأ p_j وp_(j+1)، أي بداية العمود j ونهايته، في دورة واحدة.

start, end addressعنوان البداية والنهاية
Sparse Matrix AccessSparse Matrix Access
128 KB Spmat SRAM

Fetches 8-bit entries, one 4-bit code and one 4-bit relative index each.

تجلب مدخلات بطول 8-bit، في كل منها رمز بطول 4-bit وفهرس نسبي بطول 4-bit.

Arithmetic UnitArithmetic Unit
decoder, address accumulator, multiply, addفك ترميز، مجمّع عناوين، ضرب، جمع

Code becomes a 16-bit weight, relative index becomes an absolute address, product is added with a bypass for back-to-back hits.

يصبح الرمز وزنًا بطول 16-bit، ويصبح الفهرس النسبي عنوانًا مطلقًا، ويُجمع حاصل الضرب مع مسار تجاوز (bypass) للإصابات المتتالية.

updated activationالتنشيط المحدَّث
Act R/WAct R/W
dest and src register files, 2 KB SRAMملفا سجلات dest وsrc، و2 KB SRAM

Destination file collects this layer, source file feeds it; they swap roles at the next layer.

يجمع ملف الوجهة خرج هذه الطبقة ويغذيها ملف المصدر، ثم يتبادلان الدورين في الطبقة التالية.

after the layerبعد الطبقة
ReLU and leading nonzero detectReLU وكشف أول قيمة غير صفرية
feeds the next layerيغذي الطبقة التالية

Clamps negatives to zero and finds the next nonzero to broadcast.

تقص القيم السالبة إلى صفر وتجد القيمة غير الصفرية التالية لبثها.

One processing element, left to right, with what crosses each boundaryعنصر معالجة واحد من اليسار إلى اليمين، مع ما يعبر كل حدّ بين المراحل

The same trace, with the paper's bit widthsالتتبّع نفسه، مع عرض البتات كما في الورقة

The queue head is (a3, 3). The pointer unit reads two 16-bit pointers, p3 and p4. In PE0's arrays for the running example they are 3 and 5 (the third concept derives them), so column 3 occupies entries 3 and 4. The sparse matrix unit fetches those entries. Each is 8 bits: a 4-bit weight code and a 4-bit relative index. The SRAM is 64 bits wide, so a single read returns eight entries; the high 13 bits of a pointer select the SRAM row and the low 3 bits select the entry inside it, and the unit hands one entry per cycle to the arithmetic unit (Han et al., 2016). Why eight? With 64 PEs and about 10 percent density, a column of length 4096 leaves each PE about 6.4 nonzeros per column, so one 64-bit read usually covers a whole column.

رأس الطابور هو (a3, 3). تقرأ وحدة المؤشرات مؤشرين بعرض 16 بت، هما p3 وp4. وفي مصفوفات PE0 للمثال المستمر قيمتاهما 3 و5 (تستنتجهما الفكرة الثالثة)، أي أن العمود 3 يشغل المدخلين 3 و4. تجلب وحدة المصفوفة المتناثرة هذين المدخلين. كل مدخل بعرض 8 bits: رمز وزن من 4 بتات وفهرس نسبي من 4 بتات. عرض الـ SRAM هو 64 bits، لذا تُرجع قراءة واحدة ثمانية مدخلات؛ وأعلى 13 bits من المؤشر تختار صف الـ SRAM وأدنى 3 bits تختار المدخل داخله، وتسلّم الوحدة مدخلًا واحدًا في كل دورة إلى الوحدة الحسابية (Han et al., 2016). لماذا ثمانية؟ مع 64 من الـ PEs وكثافة تقارب 10 percent، يترك عمود طوله 4096 لكل PE نحو 6.4 قيمة غير صفرية في العمود، لذا تغطي قراءة واحدة بعرض 64 بت عادةً العمود كله.

The two entries for column 3 are (code of w03, x = 0) and (code of w43, x = 0). The weight decoder expands each 4-bit code through the layer's 16-entry table into a 16-bit fixed-point value. The address accumulator keeps a running sum of the relative indices plus one per entry, producing local rows 0 and 1, which are absolute rows 0 and 4 for PE0. The multiplier forms a3 x w03, the adder adds it to destination register 0, then a3 x w43 is added to destination register 1. Had two consecutive entries hit the same register, the adder's output would have been routed straight back to its input through the bypass path instead of waiting for the register write (Han et al., 2016).

مدخلا العمود 3 هما (code of w03, x = 0) و(code of w43, x = 0). يوسّع فاكّ ترميز الأوزان (weight decoder) كل رمز من 4 بتات عبر جدول الطبقة ذي الـ 16 مدخلًا إلى قيمة ثابتة الفاصلة بعرض 16 بت. ويحتفظ مُراكِم العناوين (address accumulator) بمجموع جارٍ للفهارس النسبية مضافًا إليه واحد لكل مدخل، فينتج الصفين المحليين 0 و1، وهما الصفان المطلقان 0 و4 في PE0. يكوّن المضاعِف a3 x w03، ويضيفه الجامع إلى سجل الوجهة 0، ثم يُضاف a3 x w43 إلى سجل الوجهة 1. ولو أصاب مدخلان متتاليان السجل نفسه، لأُعيد خرج الجامع مباشرة إلى دخله عبر مسار التجاوز (bypass) بدلًا من انتظار الكتابة في السجل (Han et al., 2016).

The activation read and write unit is two register files, source and destination, each holding 64 activations of 16 bits, enough for a 4096-long vector across 64 PEs. The destination file collects this layer's outputs while the source file supplies this layer's inputs; when the layer is done they exchange roles, so no activation is ever copied between layers. Vectors longer than 4096 spill into a 2 KB activation SRAM and are processed in batches (Han et al., 2016).

وحدة قراءة وكتابة التفعيلات عبارة عن ملفّي سجلات، مصدر ووجهة، يحمل كل منهما 64 تفعيلًا بعرض 16 bits، وهذا يكفي لمتجه طوله 4096 موزع على 64 من الـ PEs. يجمع ملف الوجهة مخرجات هذه الطبقة بينما يزوّد ملف المصدر مدخلاتها؛ وعند انتهاء الطبقة يتبادلان الدورين، فلا يُنسخ أي تفعيل بين الطبقات أبدًا. المتجهات الأطول من 4096 تفيض إلى SRAM تفعيلات بحجم 2 KB وتُعالج على دفعات (Han et al., 2016).

Column j = 5 needs p5 and p6. Their addresses differ in the least significant bit, so they always sit in different banks and both reads finish in one cycleالعمود j = 5 يحتاج p5 وp6. عنواناهما يختلفان في البت الأقل أهمية، لذا يقعان دائمًا في بنكين مختلفين وتنتهي القراءتان كلتاهما في دورة واحدة

The pointer read deserves one more sentence, because it is a favorite exam question. A single-ported SRAM serves one read per cycle, but every column needs two pointers. EIE stores the pointers in two banks and uses the least significant bit of the address to choose the bank. Since p_j and p_(j+1) are adjacent addresses, they always land in different banks, and both are read in the same cycle without paying for a dual-ported (larger, hotter) memory (Han et al., 2016).

قراءة المؤشرات تستحق جملة إضافية، لأنها سؤال امتحان مفضّل. الـ SRAM أحادية المنفذ (single-ported) تخدم قراءة واحدة في كل دورة، لكن كل عمود يحتاج مؤشرين. يخزن EIE المؤشرات في بنكين ويستخدم البت الأقل أهمية (least significant bit) من العنوان لاختيار البنك. ولأن p_j وp_(j+1) عنوانان متجاوران، فإنهما يقعان دائمًا في بنكين مختلفين، ويُقرآن كلاهما في الدورة نفسها دون دفع ثمن ذاكرة ثنائية المنفذ (dual-ported) أكبر حجمًا وأشد حرارة (Han et al., 2016).

What one PE holdsما يحمله PE واحد

Activation valueقيمة التفعيل
16-bit fixed pointثابتة الفاصلة بعرض 16 بت
Column pointerمؤشر العمود
16 bits16 بت
Sparse matrix entryمدخل المصفوفة المتناثرة
8 bits = 4-bit code v + 4-bit relative index x8 بتات = رمز v من 4 بتات + فهرس نسبي x من 4 بتات
One SRAM readقراءة SRAM واحدة
64 bits = 8 entries64 بت = 8 مدخلات
Pointer splitتقسيم المؤشر
13 high bits pick the SRAM row, 3 low bits pick the entryأعلى 13 بتًا تختار صف الـ SRAM، وأدنى 3 بتات تختار المدخل
Activation register filesملفات سجلات التفعيلات
2 files x 64 entries x 16 bits (source and destination)ملفان x 64 مدخلًا x 16 بت (مصدر ووجهة)
Activation SRAMSRAM التفعيلات
2 KB2 KB
Pointer SRAMSRAM المؤشرات
32 KB (two banks)32 KB (بنكان)
Sparse matrix SRAMSRAM المصفوفة المتناثرة
128 KB128 KB
SRAM per PESRAM لكل PE
162 KB (93% of PE area, 59% of PE power)162 KB (93% من مساحة الـ PE، و59% من قدرته)
Area and power per PEالمساحة والقدرة لكل PE
0.638 mm², 9.157 mW at 800 MHz, TSMC 45 nm0.638 mm²، و9.157 mW عند 800 MHz، بتقنية TSMC 45 nm

The last two rows explain the shape of the whole chip. SRAM is 93 percent of a PE's area and 59 percent of its power, and 64 PEs fill about 40.8 mm² at 590 mW (Han et al., 2016). That is the point, not a flaw: the paper's energy argument starts from the fact that a 32-bit DRAM access costs 640 pJ against 5 pJ for SRAM, about 128 times, which the paper rounds to a 120x energy saving, so a compressed model that fits entirely on chip wins before any arithmetic trick is counted. Everything in this PE is arranged to keep the model small enough to stay there.

يفسّر الصفّان الأخيران شكل الشريحة كلها. تشغل الـ SRAM نسبة 93 percent من مساحة الـ PE و59 percent من قدرته، و64 من الـ PEs تملأ نحو 40.8 mm² باستهلاك 590 mW (Han et al., 2016). وهذا هو المقصود وليس عيبًا: حجة الطاقة في الورقة تبدأ من أن الوصول إلى DRAM بعرض 32 بت يكلّف 640 pJ مقابل 5 pJ للـ SRAM، أي نحو 128 ضعفًا، وتقرّبها الورقة إلى توفير في الطاقة قدره 120x، لذا فالنموذج المضغوط الذي يتسع بالكامل على الشريحة يربح قبل احتساب أي حيلة حسابية. كل شيء في هذا الـ PE مرتّب لإبقاء النموذج صغيرًا بما يكفي ليبقى هناك.

Recall

Why can p_j and p_(j+1) always be read in one cycle?لماذا يمكن دائمًا قراءة p_j وp_(j+1) في دورة واحدة؟

They are adjacent addresses, so their least significant bits differ. EIE uses that bit to select between two single-ported banks, even and odd, so the two pointers are always in different banks and can be read simultaneously.
لأنهما عنوانان متجاوران، فيختلف البت الأقل أهمية في كل منهما. يستخدم EIE هذا البت للاختيار بين بنكين أحاديي المنفذ، زوجي وفردي، لذا يقع المؤشران دائمًا في بنكين مختلفين ويمكن قراءتهما في آن واحد.

Quick checkاختبار سريع

What do the even and odd pointer SRAM banks make possible?ما الذي يتيحه بنكا SRAM المؤشرات الزوجي والفردي؟

Go back to the worked example and count the multiplies per PE: 3, 0, 3, 1. That uneven count is the first of four problems the PE design must solve, and the slides walk through the solutions one dashed region at a time: a queue for load balance, a detector for activation sparsity, a compressed format for weight sparsity, a decoder for weight sharing, and finally the arithmetic and write-back that ties them together. The storage format is the thread through all of them, so this concept ends with its bit widths.

ارجع إلى المثال المحلول واحسب عمليات الضرب لكل PE: 3, 0, 3, 1. هذا العدد غير المتساوي هو أول أربع مشكلات يجب أن يحلها تصميم الـ PE، والشرائح تمرّ على الحلول منطقةً منقّطةً تلو الأخرى: طابور لـ موازنة الحمل (load balance)، وكاشف لـ تناثر التفعيلات (activation sparsity)، وصيغة مضغوطة لـ تناثر الأوزان (weight sparsity)، وفاكّ ترميز لـ مشاركة الأوزان (weight sharing)، وأخيرًا الحساب والكتابة الراجعة (write-back) اللذان يربطان كل ذلك معًا. صيغة التخزين هي الخيط الذي يمر عبرها جميعًا، لذا تنتهي هذه الفكرة بعرض حقولها بالبتات.

Load balance: let the fast PEs run aheadموازنة الحمل: دع الـ PEs السريعة تتقدّم

Because rows are interleaved, each PE may hold a different number of nonzeros in any given column. In the example, the a3 broadcast gives PE0 and PE2 two multiplies each and PE1 and PE3 none. If the controller waited for every PE before broadcasting the next activation, PE1 and PE3 would idle for two cycles on every such column. The activation queue is the fix. Each PE holds a FIFO of broadcast (value, index) pairs, the controller keeps broadcasting as long as no queue is full, and a PE with little to do in one column simply moves on to the next pair in its queue while a busier PE catches up. The paper puts it plainly: the queue lets each PE build up a backlog of work to even out load imbalance, and the broadcast is disabled only if some PE's queue is full (Han et al., 2016).

لأن الصفوف موزعة بالتناوب، قد يحمل كل PE عددًا مختلفًا من القيم غير الصفرية في أي عمود. في المثال، يعطي بث a3 كلًّا من PE0 وPE2 عمليتي ضرب، ولا يعطي PE1 وPE3 شيئًا. لو انتظرت وحدة التحكم كل الـ PEs قبل بث التفعيل التالي، لبقي PE1 وPE3 خاملين دورتين في كل عمود من هذا النوع. طابور التفعيلات هو الحل. يحمل كل PE طابور FIFO من أزواج (value, index) المبثوثة، وتستمر وحدة التحكم في البث ما دام لا يوجد طابور ممتلئ، والـ PE الذي لديه عمل قليل في عمود ما ينتقل ببساطة إلى الزوج التالي في طابوره بينما يلحق به PE أكثر انشغالًا. وتقولها الورقة صراحة: الطابور يتيح لكل PE أن يبني رصيدًا متراكمًا من العمل (backlog) لموازنة عدم توازن الحمل، ولا يُعطَّل البث إلا إذا امتلأ طابور أحد الـ PEs (Han et al., 2016).

Six broadcasts with uneven loads, one broadcast per cycle. With depth 1 each round waits for the slowest PE and the layer takes 11 cycles; with a queue each PE drains its own backlog and the same 24 multiplies finish in 7ست عمليات بث بأحمال غير متساوية، عملية بث واحدة في كل دورة. مع عمق 1 تنتظر كل جولة أبطأ PE فتستغرق الطبقة 11 دورة؛ ومع طابور يُفرغ كل PE رصيده المتراكم بنفسه فتنتهي عمليات الضرب الـ 24 نفسها في 7 دورات

The paper measured this. It swept the queue depth from 1 to 256 and defined load balance efficiency as one minus the starvation bubble cycles over the total. At depth 1, around half of all cycles are idle; efficiency climbs steeply to depth 8 and flattens afterwards, so 8 was chosen as the queue depth (Han et al., 2016, Figure 8). The visual above is illustrative and uses small integer loads, but the shape of the result is the paper's: a shallow queue wastes about half the machine.

قاست الورقة هذا فعلًا. غيّرت عمق الطابور من 1 إلى 256، وعرّفت كفاءة موازنة الحمل (load balance efficiency) بأنها واحد ناقص نسبة دورات الفقاعات الناتجة عن التجويع (starvation bubble cycles) إلى إجمالي الدورات. عند العمق 1 يكون نحو نصف الدورات كلها خاملًا؛ وترتفع الكفاءة بحدة حتى العمق 8 ثم تستوي بعده، لذا اختير 8 عمقًا للطابور (Han et al., 2016, Figure 8). الشكل أعلاه توضيحي ويستخدم أحمالًا صحيحة صغيرة، لكن شكل النتيجة هو ما في الورقة: الطابور الضحل يهدر نحو نصف الآلة.

Activation sparsity: never queue a zeroتناثر التفعيلات: لا تضع صفرًا في الطابور أبدًا

The queue only helps if what enters it is worth doing. Zero activations must be filtered out before the broadcast, and this is the job of leading nonzero detection. It is distributed, not central: each group of four PEs does a local detection over the activations it stores, the results feed up a quadtree of detector nodes, and the root of that tree is the central control unit, which selects the next nonzero and broadcasts it over an H-tree so that every PE receives it in the same cycle. For64 PEs that is 21 detector units (16 leaves, 4 intermediate, 1 root), each tiny at about 189 µm² and 0.023 mW (Han et al., 2016). Since about 70 percent of activations are zero after ReLU, this alone removes roughly two thirds of the potential broadcasts, which is the 3x factor in the paper's energy accounting.

الطابور لا يفيد إلا إذا كان ما يدخله يستحق التنفيذ. يجب تصفية التفعيلات الصفرية قبل البث، وهذه مهمة كشف أول قيمة غير صفرية (leading nonzero detection). وهو موزّع وليس مركزيًا: كل مجموعة من أربعة PEs تجري كشفًا محليًا على التفعيلات التي تخزنها، وتُغذّى النتائج صعودًا في شجرة رباعية (quadtree) من عُقد الكشف، وجذر تلك الشجرة هو وحدة التحكم المركزية، التي تختار القيمة غير الصفرية التالية وتبثها عبر شجرة H-tree كي يستقبلها كل PE في الدورة نفسها. ومع 64 من الـ PEs يكون ذلك 21 وحدة كشف (16 ورقة، و4 وسيطة، وجذر واحد)، كل منها صغيرة جدًا بنحو 189 µm² و0.023 mW (Han et al., 2016). ولأن نحو 70 percent من التفعيلات تكون أصفارًا بعد ReLU، فهذا وحده يزيل قرابة ثلثي عمليات البث المحتملة، وهو عامل الـ 3x في حساب الطاقة في الورقة.

Weight sparsity: CSC with a relative indexتناثر الأوزان: CSC بفهرس نسبي

The pointer read and sparse matrix access regions implement the compressed format, a variation of compressed sparse column. Standard CSC, as in SciPy's csc_matrix, stores three arrays: the nonzero values, the row index of each, and a pointer array such that column j occupies positions p_j to p_(j+1) - 1 (SciPy). EIE keeps the values and the pointers but replaces the absolute row index with a relative one: for each nonzero, the number of zeros since the previous nonzero in that PE's slice of the column. Both the value and the relative index are 4 bits. When more than 15 zeros precede a nonzero, the encoder inserts a padding entry with value 0 and index 15 and continues counting from there (Han et al., 2016).

منطقتا قراءة المؤشرات والوصول إلى المصفوفة المتناثرة تنفّذان الصيغة المضغوطة، وهي تنويع على العمود المتناثر المضغوط (compressed sparse column). صيغة CSC القياسية، كما في csc_matrix من SciPy، تخزن ثلاث مصفوفات: القيم غير الصفرية، وفهرس الصف لكل منها، ومصفوفة مؤشرات بحيث يشغل العمود j المواضع من p_j إلى p_(j+1) - 1 (SciPy). يحتفظ EIE بالقيم والمؤشرات لكنه يستبدل فهرس الصف المطلق بفهرس نسبي: لكل قيمة غير صفرية، عدد الأصفار منذ القيمة غير الصفرية السابقة في شريحة ذلك الـ PE من العمود. القيمة والفهرس النسبي كلاهما بعرض 4 bits. وعندما يسبق قيمةً غير صفرية أكثر من 15 صفرًا، يُدخل المرمِّز مدخل حشو (padding) قيمته 0 وفهرسه 15 ثم يواصل العد من هناك (Han et al., 2016).

Paper example: a column with nonzeros at rows 2, 3 and 22. Gaps of 2 and 0 encode directly; the gap of 18 exceeds 15, so a padding entry (0, 15) is inserted before (3, 2)مثال الورقة: عمود قيمه غير الصفرية في الصفوف 2 و3 و22. الفجوتان 2 و0 تُرمَّزان مباشرة؛ أما الفجوة 18 فتتجاوز 15، لذا يُدخَل مدخل حشو (0, 15) قبل (3, 2)

Worked exampleمثال محلول

Encode PE0's slice of the 8 x 4 exampleرمِّز شريحة PE0 من مثال 8 x 4

  1. Write PE0's two rowsاكتب صفّي PE0

    PE0 owns absolute rows 0 and 4, which are local rows 0 and 1. Its slice of the matrix is [w00, w01, 0, w03] over [0, 0, w42, w43].
    يملك PE0 الصفين المطلقين 0 و4، وهما الصفان المحليان 0 و1. شريحته من المصفوفة هي [w00, w01, 0, w03] فوق [0, 0, w42, w43].
  2. Walk the columnsامشِ على الأعمدة

    Column 0: w00 at local row 0, no zeros before it, relative index 0. Column 1: w01, index 0. Column 2: local row 0 is zero, then w42 at local row 1, so index 1. Column 3: w03 with index 0, then w43 immediately after with index 0.
    العمود 0: w00 في الصف المحلي 0، ولا أصفار قبله، فالفهرس النسبي 0. العمود 1: w01، بفهرس 0. العمود 2: الصف المحلي 0 صفر، ثم w42 في الصف المحلي 1، فالفهرس 1. العمود 3: w03 بفهرس 0، ثم w43 بعده مباشرة بفهرس 0.
  3. Build the pointersابنِ المؤشرات

    Column lengths are 1, 1, 1, 2, so the pointer array is the running sum with a final end marker: p = [0, 1, 2, 3, 5]. That is where the p3 = 3 and p4 = 5 of the previous concept came from.
    أطوال الأعمدة هي 1, 1, 1, 2، لذا فمصفوفة المؤشرات هي المجموع الجاري مع علامة نهاية أخيرة: p = [0, 1, 2, 3, 5]. ومن هنا جاء p3 = 3 وp4 = 5 في الفكرة السابقة.
  4. PE0's three arraysمصفوفات PE0 الثلاث

    v = [w00, w01, w42, w03, w43], x = [0, 0, 1, 0, 0], p = [0, 1, 2, 3, 5]. Five 8-bit entries and five 16-bit pointers for a slice that would take eight 16-bit weights dense.
    PEPEPointer array pمصفوفة المؤشرات pEntries per column (p(j+1) minus p(j))المدخلات لكل عمود (p(j+1) ناقص p(j))
    PE0 (rows 0, 4)PE0 (الصفان 0 و4)[0, 1, 2, 3, 5][0, 1, 2, 3, 5]1, 1, 1, 21, 1, 1, 2
    PE1 (rows 1, 5)PE1 (الصفان 1 و5)[0, 1, 1, 2, 2][0, 1, 1, 2, 2]1, 0, 1, 01, 0, 1, 0
    PE2 (rows 2, 6)PE2 (الصفان 2 و6)[0, 0, 1, 1, 3][0, 0, 1, 1, 3]0, 1, 0, 20, 1, 0, 2
    PE3 (rows 3, 7)PE3 (الصفان 3 و7)[0, 0, 1, 1, 1][0, 0, 1, 1, 1]0, 1, 0, 00, 1, 0, 0
    All four PEs: pointers and the per-column entry counts they implyالـ PEs الأربعة: المؤشرات وعدد المدخلات لكل عمود الناتج عنها
    Read the last column across the rows and you are looking at load imbalance in the data: for column 3, PE0 and PE2 have two entries while PE1 and PE3 have none. The pointer arrays are where the queue's job is written down.
    v = [w00, w01, w42, w03, w43]، x = [0, 0, 1, 0, 0]، p = [0, 1, 2, 3, 5]. خمسة مدخلات بعرض 8 بت وخمسة مؤشرات بعرض 16 بت لشريحة كانت ستحتاج ثمانية أوزان بعرض 16 بت في الصيغة الكثيفة.
    PEPEPointer array pمصفوفة المؤشرات pEntries per column (p(j+1) minus p(j))المدخلات لكل عمود (p(j+1) ناقص p(j))
    PE0 (rows 0, 4)PE0 (الصفان 0 و4)[0, 1, 2, 3, 5][0, 1, 2, 3, 5]1, 1, 1, 21, 1, 1, 2
    PE1 (rows 1, 5)PE1 (الصفان 1 و5)[0, 1, 1, 2, 2][0, 1, 1, 2, 2]1, 0, 1, 01, 0, 1, 0
    PE2 (rows 2, 6)PE2 (الصفان 2 و6)[0, 0, 1, 1, 3][0, 0, 1, 1, 3]0, 1, 0, 20, 1, 0, 2
    PE3 (rows 3, 7)PE3 (الصفان 3 و7)[0, 0, 1, 1, 1][0, 0, 1, 1, 1]0, 1, 0, 00, 1, 0, 0
    All four PEs: pointers and the per-column entry counts they implyالـ PEs الأربعة: المؤشرات وعدد المدخلات لكل عمود الناتج عنها
    اقرأ العمود الأخير عبر الصفوف وسترى عدم توازن الحمل في البيانات نفسها: في العمود 3، لدى PE0 وPE2 مدخلان لكل منهما بينما لا يملك PE1 وPE3 شيئًا. مصفوفات المؤشرات هي المكان الذي تُكتب فيه مهمة الطابور.
SimulatorمحاكيCSC encoder: from a sparse column to (v, z) pairs and pointersمرمِّز CSC: من عمود متناثر إلى أزواج (v, z) ومؤشرات
8 rows per column8 صفًا لكل عمود
Click a cell to cycle its 4-bit code through 0, 1, 2, 3, 7 and 15. Zero means pruned.انقر خلية لتدوير رمزها ذي 4-bit عبر 0, 1, 2, 3, 7 و15. الصفر يعني أنها مقلّمة.
col 0ع 0
column 0العمود 02 entries2 مدخلات
  • pos 2موضع 2v70111z20010
  • pos 7موضع 7v30011z40100
pointer array pمصفوفة المؤشرات p
  • p00
  • end2
Entries stored22 real, 0 padding2 حقيقية، 0 حشو
Compressed bits48bit8 per entry plus 16 per pointer8 لكل مدخل و16 لكل مؤشر
Dense 4-bit codes32bitevery cell, no indicesكل خلية، بلا فهارس
Dense 16-bit weights128bitunquantized, uncompressedبلا تكميم ولا ضغط

Each nonzero becomes one 8-bit entry: a 4-bit code v and a 4-bit relative index z counting the zeros since the previous entry. Whenever that count would pass 15, the encoder inserts a padding entry (teal) with v = 0 and z = 15, exactly as the EIE paper describes, and the padding entry is multiplied like any other. The pointer array holds one 16-bit start address per column plus one end marker, so p[j+1] minus p[j] is the number of entries the PE walks for column j. At low density the compressed bits fall well below the dense 4-bit total; at high density the index overhead makes compression a loss, which is why EIE only pays off on pruned layers.تصبح كل قيمة غير صفرية مدخلًا واحدًا بطول 8-bit: رمز v بطول 4-bit وفهرس نسبي z بطول 4-bit يعد الأصفار منذ المدخل السابق. وكلما كاد هذا العدد يتجاوز 15، يُدرج المرمِّز مدخل حشو (باللون الأزرق المخضر) فيه v = 0 وz = 15، تمامًا كما تصف ورقة EIE، ويُضرب مدخل الحشو كأي مدخل آخر. تحمل مصفوفة المؤشرات عنوان بداية واحدًا بطول 16-bit لكل عمود، إضافة إلى علامة نهاية واحدة، لذا فإن p[j+1] minus p[j] هو عدد المدخلات التي تمر عليها الـ PE للعمود j. عند الكثافة المنخفضة تقل البتات المضغوطة كثيرًا عن مجموع الرموز الكثيفة ذات 4-bit، وعند الكثافة العالية يجعل عبء الفهارس الضغط خسارة، ولهذا لا تؤتي EIE ثمارها إلا على الطبقات المقلّمة.

Why a relative index at all? For a layer with 4096 rows split across 64 PEs, each PE-local row still needs 6 bits to name absolutely, and the absolute row across the whole matrix needs 12. A 4-bit relative index cuts even the local figure by a third, and, more importantly, matches the 4-bit weight code so that one 8-bit entry carries both. The price is the occasional padding entry, and the paper notes that padding zeros are treated as nonzeros and lead to wasted computation; its Figure 12 shows that more PEs mean fewer padding zeros, because each PE's slice of a column is shorter and long gaps become rarer (Han et al., 2016).

لماذا الفهرس النسبي أصلًا؟ في طبقة ذات 4096 صفًّا مقسّمة على 64 من الـ PEs، يحتاج كل صف محلي داخل الـ PE إلى 6 bits لتسميته بشكل مطلق، والصف المطلق عبر المصفوفة كلها يحتاج 12. الفهرس النسبي بعرض 4 بتات يقلّص حتى الرقم المحلي بمقدار الثلث، والأهم أنه يطابق رمز الوزن ذا الـ 4 بتات بحيث يحمل مدخل واحد بعرض 8-bit الاثنين معًا. الثمن هو مدخل الحشو العرَضي، وتذكر الورقة أن أصفار الحشو تُعامل كقيم غير صفرية وتؤدي إلى حساب مهدر؛ ويبيّن الشكل 12 فيها أن زيادة عدد الـ PEs تعني أصفار حشو أقل، لأن شريحة كل PE من العمود تصبح أقصر وتصبح الفجوات الطويلة أندر (Han et al., 2016).

Weight sharing: 4-bit codes, 16-bit arithmeticمشاركة الأوزان: رموز من 4 بتات وحساب بـ 16 بت

The value stored in each entry is not a weight. It is a 4-bit index into a per-layer table of 16 shared weights, the codebook produced by the k-means quantization of Deep Compression (Han, Mao and Dally, 2016). The weight decoder reads the code out of the sparse matrix entry and looks up the 16-bit fixed-point value it stands for, every cycle, on the way to the multiplier. This is the 8x memory factor in the paper's accounting: the SRAM holds 4-bit codes, the multiplier sees 16-bit numbers, and the layer's whole set of distinct weight values is 16 entries long.

القيمة المخزنة في كل مدخل ليست وزنًا. إنها فهرس من 4 بتات يشير إلى جدول خاص بالطبقة من 16 وزنًا مشتركًا، وهو جدول الترميز (codebook) الناتج عن التكميم بخوارزمية k-means في Deep Compression (Han, Mao and Dally, 2016). يقرأ فاكّ ترميز الأوزان الرمز من مدخل المصفوفة المتناثرة ويبحث عن القيمة ثابتة الفاصلة ذات الـ 16 بت التي يمثلها، في كل دورة، في الطريق إلى المضاعِف. هذا هو عامل الذاكرة 8x في حسابات الورقة: الـ SRAM تحمل رموزًا من 4 بتات، والمضاعِف يرى أعدادًا بعرض 16 بت، ومجموعة قيم الأوزان المختلفة للطبقة كلها لا يتجاوز طولها 16 مدخلًا.

Precisionالدقة الحسابيةPrediction accuracyدقة التنبؤReadingالقراءة
32-bit floating pointفاصلة عائمة بعرض 32 بت80.3%80.3%Referenceالمرجع
16-bit fixed pointفاصلة ثابتة بعرض 16 بت79.8%79.8%EIE's choice, half a point lostاختيار EIE، بخسارة نصف نقطة
8-bit fixed pointفاصلة ثابتة بعرض 8 بت53.0%53.0%Collapses, unusable at this widthتنهار، غير صالحة للاستخدام بهذا العرض
AlexNet ImageNet prediction accuracy under different arithmetic precisions (the paper says only prediction accuracy; the values match AlexNet's top-5 range)دقة التنبؤ لـ AlexNet على ImageNet تحت دقات حسابية مختلفة (تذكر الورقة دقة التنبؤ فقط؛ والقيم تطابق نطاق top-5 لـ AlexNet)

The 16-bit choice is not arbitrary. The paper reports that 16-bit fixed point costs half a percentage point against 32-bit floating point, while 8-bit fixed point collapses to 53 percent, and that a 16-bit fixed multiply uses about 5 times less energy than a 32-bit fixed multiply and 6.2 times less than a 32-bit floating point one (Han et al., 2016). Four bits of storage and sixteen bits of arithmetic is the compromise that keeps both the SRAM and the accuracy where they need to be.

اختيار 16 بت ليس اعتباطيًا. تذكر الورقة أن تمثيل 16 بت ثابت الفاصلة يكلّف نصف نقطة مئوية مقارنة بالفاصلة العائمة (floating point) بعرض 32 بت، بينما ينهار تمثيل 8 بت ثابت الفاصلة إلى 53 percent، وأن الضرب ثابت الفاصلة بعرض 16 بت يستهلك طاقة أقل بنحو 5 مرات من الضرب ثابت الفاصلة بعرض 32 بت، وأقل بـ 6.2 مرة من الضرب بالفاصلة العائمة بعرض 32 بت (Han et al., 2016). أربعة بتات للتخزين وستة عشر بتًا للحساب هي التسوية التي تُبقي الـ SRAM والدقة كلتيهما حيث ينبغي أن تكونا.

Arithmetic and write-backالحساب والكتابة الراجعة

The last region closes the loop. The arithmetic unit computes b_x = b_x + v x a_j, where the address x comes from the address accumulator's running sum of relative indices and v from the decoder. The destination register selected by x is read, the product is added, and the sum is written back. If two adjacent cycles select the same accumulator, the bypass path forwards the adder output directly to its input so the second add does not wait on the register (Han et al., 2016). At the end of the layer the destination file becomes the source file, ReLU and the detector run over it, and the first nonzero of the next layer enters the queue.

المنطقة الأخيرة تُغلق الحلقة. تحسب الوحدة الحسابية b_x = b_x + v x a_j، حيث يأتي العنوان x من المجموع الجاري للفهارس النسبية في مُراكِم العناوين، وتأتي v من فاكّ الترميز. يُقرأ سجل الوجهة الذي يختاره x، ويُضاف إليه الناتج، ويُكتب المجموع مرة أخرى. وإذا اختارت دورتان متجاورتان المُراكِم نفسه، يمرّر مسار التجاوز (bypass) خرج الجامع مباشرة إلى دخله كي لا تنتظر عملية الجمع الثانية السجل (Han et al., 2016). وفي نهاية الطبقة يصبح ملف الوجهة ملف المصدر، ويعمل عليه ReLU والكاشف، وتدخل أول قيمة غير صفرية من الطبقة التالية إلى الطابور.

Storage formats and bit widthsصيغ التخزين وعرضها بالبتات

Weight code vرمز الوزن v
4 bits, index into the layer's 16-entry codebook4 بتات، فهرس يشير إلى جدول ترميز الطبقة ذي الـ 16 مدخلًا
Relative index x (or z)الفهرس النسبي x (أو z)
4 bits, zeros since the previous entry, at most 154 بتات، عدد الأصفار منذ المدخل السابق، بحد أقصى 15
Padding ruleقاعدة الحشو
gap above 15: insert v = 0, x = 15, then continue countingفجوة أكبر من 15: أدخِل v = 0 وx = 15، ثم واصل العد
Pointer p(j)المؤشر p(j)
16 bits, start of column j; p(j+1) minus p(j) is the entry count16 بت، بداية العمود j؛ وp(j+1) ناقص p(j) هو عدد المدخلات
Codebookجدول الترميز (codebook)
16 entries x 16-bit fixed point, one table per layer16 مدخلًا x قيم ثابتة الفاصلة بعرض 16 بت، جدول واحد لكل طبقة
Activationالتفعيل
16-bit fixed pointثابت الفاصلة بعرض 16 بت
Activation queueطابور التفعيلات
depth 8, holds (value, index) pairsعمقه 8، ويحمل أزواج (value, index)

Recall

Encode the column [0, 0, 5, 0, 0, 0, 0, 7] in EIE's relative format.رمِّز العمود [0, 0, 5, 0, 0, 0, 0, 7] بالصيغة النسبية في EIE.

v = [5, 7], z = [2, 4]. Two zeros precede the 5 and four zeros separate the 5 from the 7. No gap exceeds 15, so there is no padding.
v = [5, 7]، z = [2, 4]. صفران يسبقان الـ 5، وأربعة أصفار تفصل الـ 5 عن الـ 7. لا توجد فجوة تتجاوز 15، لذا لا يوجد حشو.

Recall

What did the paper measure at FIFO depth 1, and which depth did it choose?ماذا قاست الورقة عند عمق FIFO يساوي 1، وأي عمق اختارت؟

About half of all cycles were idle from starvation. It chose depth 8, beyond which the efficiency curve flattens.
كان نحو نصف الدورات كلها خاملًا بسبب التجويع (starvation). واختارت العمق 8، الذي يستوي منحنى الكفاءة بعده.

Quick checkاختبار سريع

A column in one PE's slice has 18 zeros before its next nonzero weight. What does the encoder store?عمود في شريحة PE واحد فيه 18 صفرًا قبل الوزن غير الصفري التالي. ماذا يخزن المرمِّز؟

Quick checkاختبار سريع

According to the paper, what happens to load balance at an activation FIFO depth of one?بحسب الورقة، ماذا يحدث لموازنة الحمل عند عمق FIFO للتفعيلات يساوي واحدًا؟

Recapالخلاصة

If you remember nothing elseإن لم تتذكر شيئاً آخر فتذكّر هذا

  • The CCU broadcasts only nonzero activations with their index; every PE multiplies that value by the nonzeros in its own slice of that column and accumulates locally.وحدة التحكم المركزية (CCU) تبث التفعيلات غير الصفرية فقط مع فهرس كل منها، وكل PE يضرب هذه القيمة في القيم غير الصفرية الموجودة في شريحته الخاصة من ذلك العمود ويجمع النتيجة محليًا.
  • Rows are interleaved across PEs (row i belongs to PE i mod N); activations are broadcast, never partitioned.الصفوف موزعة بالتناوب على الـ PEs (الصف i يتبع الـ PE رقم i mod N)، أما التفعيلات فتُبث للجميع ولا تُقسَّم أبدًا.
  • The PE pipeline is Act Queue, Pointer Read, Sparse Matrix Access, Arithmetic Unit, Act R/W, then ReLU and leading nonzero detection.خط المعالجة داخل الـ PE هو: Act Queue، ثم Pointer Read، ثم Sparse Matrix Access، ثم Arithmetic Unit، ثم Act R/W، وبعدها ReLU وكشف أول قيمة غير صفرية.
  • Weights live in relative-index CSC: a 4-bit code plus a 4-bit gap in one 8-bit entry, a padding zero whenever a gap exceeds 15, and 16-bit pointers with p(j+1) minus p(j) giving the column's entry count.الأوزان مخزنة بصيغة CSC ذات الفهرس النسبي: رمز من 4 بتات وفجوة من 4 بتات داخل مدخل واحد من 8 بتات، مع صفر حشو كلما تجاوزت الفجوة 15، ومؤشرات من 16 بت يعطي فيها p(j+1) ناقص p(j) عدد مدخلات العمود.
  • Even and odd pointer banks read both bounds of a column in one cycle from single-ported SRAM.بنكا المؤشرات الزوجي والفردي يقرآن حدّي العمود كليهما في دورة واحدة من SRAM أحادية المنفذ (single-ported).
  • The 16-entry codebook decodes 4-bit codes to 16-bit fixed point at compute time; 16-bit fixed point costs about half a percentage point of AlexNet accuracy.جدول الترميز ذو الـ 16 مدخلًا يفك الرموز ذات الـ 4 بتات إلى قيم ثابتة الفاصلة بـ 16 بت وقت الحساب، وتمثيل 16 بت ثابت الفاصلة يكلف نحو نصف نقطة مئوية فقط من دقة AlexNet.
  • Load imbalance comes from uneven nonzero counts per column per PE; a FIFO of depth 8 hides it, while depth 1 leaves about half of all cycles idle.عدم توازن الحمل ينشأ من اختلاف عدد القيم غير الصفرية في كل عمود لكل PE، وطابور FIFO بعمق 8 يخفيه، بينما يترك العمق 1 نحو نصف الدورات كلها خاملة.
  • The bypass path handles back-to-back updates to the same accumulator; source and destination register files swap roles between layers.مسار التجاوز (bypass) يعالج التحديثات المتتالية على المُراكِم (accumulator) نفسه، وملفّا السجلات المصدر والوجهة يتبادلان دوريهما بين الطبقات.
  • SRAM is 93 percent of PE area; one PE is 0.638 mm² and 9.157 mW at 800 MHz in 45 nm.تشغل SRAM نسبة 93 بالمئة من مساحة الـ PE، والـ PE الواحد مساحته 0.638 mm² ويستهلك 9.157 mW عند 800 MHz بتقنية 45 nm.

Sourcesالمصادر