Lecture 04-2 · Pruning and Sparsity IIالمحاضرة 04-2 · التقليم والتناثر II

EIE results and lessons

نتائج EIE ودروسه

Slides 71–77الشرائح 71–77 P3 SKIM

EIE's biggest win is not skipping zeros but never touching DRAM. Know the four energy factors, how they multiply to the theoretical number, why the measured number is lower, and what the authors kept and dropped seven years later.

أكبر مكاسب EIE ليس تخطي الأصفار بل عدم لمس DRAM أبداً. احفظ عوامل الطاقة الأربعة، وكيف تتضاعف إلى الرقم النظري، ولماذا الرقم المقاس أقل، وما الذي أبقاه المؤلفون وما الذي تخلّوا عنه بعد سبع سنوات.

What gets askedما الذي يُسأل عنه

Short recall: 120 x 10 x 8 x 3 = 28,800x theoretical; measured 24,000x vs CPU and 3,400x vs GPU; batch size 1. Possibly a density calculation (FLOP reduction) and one pro or con from the retrospective.

استرجاع قصير: 120 x 10 x 8 x 3 = 28,800x نظرياً؛ والمقاس 24,000x مقابل CPU و3,400x مقابل GPU؛ عند batch size 1. وربما حساب كثافة (FLOP reduction) وميزة أو عيب واحد من المراجعة الاسترجاعية.

The loop closes on chip, slides 71 and 72

الحلقة تُغلق على الشريحة نفسها، الشريحتان 71 و72

After a PE finishes accumulating, ReLU clamps the destination registers and leading nonzero detection (LNZD) reports the next nonzero as a (value, index) pair. The CCU broadcasts only those pairs to the next layer. The output of one layer is already the sparse input of the next, and no dense vector is ever written off chip. Slide 72 highlights the special aspects: the activation queue (load balance), the sparse matrix SRAM with pointers (weight sparsity, all weights on chip), the weight decoder (weight sharing) and ReLU with LNZD (activation sparsity).

بعد أن ينهي PE الجمع، يحوّل ReLU القيم السالبة في سجلات الوجهة إلى صفر، ويُبلغ leading nonzero detection (LNZD) عن القيمة غير الصفرية التالية كزوج (value, index). تبثّ CCU هذه الأزواج فقط إلى الطبقة التالية. خرج طبقة هو أصلاً المدخل المتفرق للتالية، ولا يُكتب أي متجه كثيف خارج الشريحة. والشريحة 72 تبرز الجوانب الخاصة: activation queue (load balance)، وsparse matrix SRAM مع المؤشرات (تفرّق الأوزان، وكل الأوزان على الشريحة)، وweight decoder (weight sharing)، وReLU مع LNZD (تفرّق activations).

Where the energy saving comes from

من أين يأتي توفير الطاقة

All compressed weights live in per-PE SRAM. In the 45 nm energy table a 32-bit SRAM read is 5 pJ and a 32-bit DRAM access is 640 pJ: 640 / 5 = 128x, which the paper rounds to 120x. That is the largest factor. Compression is what makes the model small enough to fit, and fitting removes DRAM.

كل الأوزان المضغوطة تعيش في SRAM الخاصة بكل PE. في جدول الطاقة بتقنية 45 nm، قراءة 32-bit من SRAM تكلف 5 pJ والوصول إلى DRAM يكلف 640 pJ: 640 / 5 = 128x، ويقرّبها البحث إلى 120x. هذا هو العامل الأكبر. الضغط هو ما يجعل النموذج صغيراً بما يكفي ليتسع، والاتساع يلغي DRAM.

theoretical energy saving = 120 (SRAM vs DRAM) x 10 (weight sparsity) x 8 (4-bit sharing) x 3 (activation skip) = 28,800x

التوفير النظري في الطاقة = 120 (SRAM بدل DRAM) × 10 (تفرّق الأوزان) × 8 (مشاركة 4-bit) × 3 (تخطي activations) = 28,800x.

1x 10x 100x 1,000x 10,000x 100,000x SRAM instead of DRAM 120x weight sparsity 10x weight sharing 8x activation skipping 3x theory: product 28,800x measured vs CPU 24,000x measured vs GPU 3,400x log axis: each gridline is 10x; read gaps as decades, not exact ratios
The four factors (above the dashed line) multiply to 28,800x. Measured results are 24,000x against the CPU and 3,400x against the GPU, about 10x below theory for the GPU.العوامل الأربعة (فوق الخط المتقطع) يُضرب بعضها في بعض لتعطي 28,800x. والنتائج المقاسة 24,000x مقابل CPU و3,400x مقابل GPU، أي نحو 10x دون النظري في حالة GPU.

Theoretical vs measured. The product of the factors is 28,800x; measured energy efficiency on nine compressed FC and LSTM layers is 24,000x vs a Core i7 CPU and 3,400x vs a Titan X GPU. The authors give two reasons for the gap to the GPU: index overhead (every 4-bit weight carries a 4-bit index, plus pointers) and process node (EIE at 45 nm, the GPUs at 28 nm). Speed is a separate pair of numbers: 189x and 13x.

النظري مقابل المقاس. حاصل ضرب العوامل 28,800x؛ والكفاءة الطاقية المقاسة على تسع طبقات FC وLSTM مضغوطة هي 24,000x مقابل Core i7 CPU و3,400x مقابل Titan X GPU. يذكر المؤلفون سببين للفجوة مع GPU: عبء الـ index (كل وزن 4-bit يحمل index من 4-bit إضافة إلى المؤشرات) وprocess node (EIE بتقنية 45 nm وGPUs بتقنية 28 nm). والسرعة زوج أرقام منفصل: 189x و13x.

Benchmarks: the two densities multiply

اختبارات الأداء: الكثافتان تُضربان معاً

A multiply happens only where a surviving weight meets a nonzero activation, so the work fraction is weight density times activation density.

عملية الضرب تحدث فقط حيث يلتقي وزن باقٍ مع activation غير صفري، فنسبة العمل هي كثافة الأوزان مضروبة في كثافة activations.

FLOP reduction = 1dweight x dactivation

في الصيغة: dweight كثافة الأوزان (نسبة الباقي بعد pruning)، وdactivation كثافة activations (نسبة غير الصفرية بعد ReLU).

LayerالطبقةWeight densityكثافة الأوزانAct. densityكثافة activationsFLOP reductionFLOP reduction
AlexNet FC6 (4096 x 9216)9%35%33x
VGG FC6 (4096 x 25088)4%18%100x
NeuralTalk LSTM (2400 x 1201)10%100%10x
Workedمثال محلول
AlexNet FC6: 0.09 x 0.35 = 0.0315, about 3%    1 / 0.03 = 33x   (exact 1/0.0315 = 31.7x)
LSTM       : 0.10 x 1.00 = 0.10                 1 / 0.10 = 10x
LSTM gates use sigmoid and tanh, which never output exact zeros, so only pruning helps.

بوابات LSTM تستخدم sigmoid وtanh، ولا تُخرجان أصفاراً تامة أبداً، لذلك لا يفيد هنا إلا pruning.

Batch size 1 only. Every headline number is one input vector at a time, a matrix-vector product, which is the real-time embedded case. At batch 64 a GPU reuses each weight across inputs and EIE is only comparable to it in throughput. The cross-platform charts also mix 22, 28 and 45 nm chips, a projected 256-PE design and a bandwidth estimate for DaDianNao: read them as decades, not exact ratios.

Batch size 1 فقط. كل الأرقام الرئيسية لمتجه دخل واحد في كل مرة، أي ضرب مصفوفة في متجه، وهي حالة الأنظمة المدمجة في الزمن الحقيقي. عند batch 64 يعيد GPU استخدام كل وزن عبر المدخلات، ويصبح EIE مقارباً له فقط في throughput. كما أن رسوم المقارنة بين المنصات تخلط شرائح بتقنيات 22 و28 و45 nm، وتصميماً متوقعاً بـ 256 PEs، وتقديراً لعرض النطاق لـ DaDianNao: اقرأها كمراتب عشرية، لا كنسب دقيقة.

Retrospective: what held up, slides 76 and 77

نظرة استرجاعية: ما الذي صمد، الشريحتان 76 و77

Pros

المزايا

  • Special-purpose hardware makes sparse ops cost-effective up to 50% density.

    العتاد المخصص يجعل العمليات المتفرقة مجدية حتى كثافة 50%.

  • Both sparsities: skipping saves energy and also the cycle.

    التفرّقان معاً: التخطي يوفر الطاقة ويوفر الدورة أيضاً.

  • Fine-grained sparsity allows higher pruning ratios.

    Fine-grained sparsity تسمح بنسب pruning أعلى.

  • 4-bit weights decoded to 16-bit arithmetic: W4A16, reborn in LLM decoding (GPTQ, AWQ, llama.cpp, MLC LLM).

    أوزان 4-bit تُفك إلى حساب 16-bit: W4A16، وقد عاد للحياة في LLM decoding (GPTQ وAWQ وllama.cpp وMLC LLM).

Cons and their fixes

العيوب وحلولها

  • Hard to map onto vector processors: fix is structured N:M sparsity (2:4).

    يصعب تطبيقه على معالجات المتجهات: الحل هو N:M sparsity (2:4) المنظمة.

  • Control and storage overhead: fix is coarse-grained sparsity.

    عبء التحكم والتخزين: الحل هو coarse-grained sparsity.

  • FC layers only: but FC (matrix-vector) is reborn in LLMs.

    طبقات FC فقط: لكن FC (ضرب مصفوفة في متجه) عاد للحياة في LLMs.

  • Everything in SRAM: practical for TinyML.

    كل شيء في SRAM: عملي لـ TinyML.

Slide 77 states the first principle: be lazy. Avoid redundant computation, reject work quickly or delay it. The same idea appears as spatial sparsity (SIGE), token sparsity (SpAtten), temporal sparsity (TSM) and point-cloud sparsity (TorchSparse, PointAcc).

تذكر الشريحة 77 المبدأ الأول: كن كسولاً. تجنّب الحساب الزائد، وارفض العمل بسرعة أو أجّله. الفكرة نفسها تظهر في spatial sparsity (SIGE)، وtoken sparsity (SpAtten)، وtemporal sparsity (TSM)، وتفرّق point clouds (TorchSparse وPointAcc).

Exam trapفخ في الاختبار

28,800x is theory, 24,000x and 3,400x are measured. Do not quote 28,800x as a result. Do not mix pairs: 189x and 24,000x are vs CPU, 13x and 3,400x are vs GPU; the first number of each pair is speed, the second is energy. And everything is at batch size 1; at batch 64 the GPU catches up in throughput. Finally, the largest factor is the memory (120x), not the sparsity.

28,800x نظري، و24,000x و3,400x مقاسة. لا تذكر 28,800x كنتيجة. ولا تخلط الأزواج: 189x و24,000x مقابل CPU، و13x و3,400x مقابل GPU؛ الرقم الأول في كل زوج للسرعة والثاني للطاقة. وكل شيء عند batch size 1؛ عند batch 64 يلحق GPU في throughput. وأخيراً، العامل الأكبر هو الذاكرة (120x) لا التفرّق.

Memory trickحيلة للحفظ

"One-twenty, ten, eight, three." Memory, prune, share, skip. CPU pair is the big one (189, 24,000), GPU pair the small one (13, 3,400).

"120، 10، 8، 3." ذاكرة، تقليم، مشاركة، تخطٍّ. زوج CPU هو الكبير (189، 24,000)، وزوج GPU هو الصغير (13، 3,400).

Check yourself

اختبر نفسك

Which factor is the largest in EIE's 120 x 10 x 8 x 3 energy breakdown?

أي عامل هو الأكبر في تفكيك الطاقة 120 x 10 x 8 x 3 في EIE؟

B. 640 pJ for DRAM against 5 pJ for SRAM is 128x, rounded to 120x. A is 10x, C is 8x, D is about 3x.

الجواب B. 640 pJ لـ DRAM مقابل 5 pJ لـ SRAM يساوي 128x، ويُقرَّب إلى 120x. والخيار A هو 10x، وC هو 8x، وD نحو 3x.

What did EIE report against a desktop GPU?

ماذا أعلن EIE مقابل GPU مكتبي؟

C. A is the CPU pair. B pairs the GPU speedup with the theoretical product, which is not a measurement. D mixes the CPU speed with the GPU energy.

الجواب C. والخيار A هو زوج CPU. وB يقرن تسريع GPU بحاصل الضرب النظري، وهو ليس قياساً. وD يخلط سرعة CPU مع طاقة GPU.

A layer has 20% weight density and 25% activation density. What FLOP reduction does EIE see?

طبقة كثافة أوزانها 20% وكثافة activations فيها 25%. ما FLOP reduction الذي يراه EIE؟

D. 1 / (0.20 x 0.25) = 1 / 0.05 = 20x. A and B use only one density; C adds the two reductions (5 + 4) instead of multiplying them.

الجواب D. 1 / (0.20 x 0.25) = 1 / 0.05 = 20x. والخياران A وB يستخدمان كثافة واحدة فقط؛ وC يجمع التخفيضين (5 + 4) بدلاً من ضربهما.

Which EIE limitation led to 2:4 structured sparsity on sparse tensor cores?

أي قيد في EIE أدى إلى 2:4 structured sparsity في sparse tensor cores؟

A. Wide SIMD lanes need a regular pattern; N:M sparsity gives one. B is a real con but its remedy is not 2:4; C is false (W4A16 is listed as a pro); D is false, activation skipping is one of EIE's three savings.

الجواب A. ممرات SIMD العريضة تحتاج نمطاً منتظماً، وN:M sparsity يوفّره. والخيار B عيب حقيقي لكن علاجه ليس 2:4؛ وC خاطئ (W4A16 مذكور كميزة)؛ وD خاطئ، فتخطي activations أحد توفيرات EIE الثلاثة.