Noting time is as 20230712
Author as below
Xiaochen Peng, Shanshi Huang, Yandong Luo, Xiaoyu Sun and Shimeng Yu School of Electrical and Computer Engineering, Georgia Institute of Technology, Atlanta, GA
[Paper Github](https://github.com/neurosim/DNN_NeuroSim_V1.0.)
### Abstract
DNN+NeuroSim 是一個整合式框架,去評估深度神經網絡的 compute-in-memory (CIM) accelerators ,包括層次設計選項,從 device-level 到 circuit-level 再到 algorithm-level.
開發了一個Python封裝器,用於將 NeuroSim 與流行的機器學習平台(如Pytorch和Tensorflow)進行介面連接
該 framework 支持自動算法到硬體的映射 並在有硬體限制下評估 chip-level performance 和 inference accuracy
該工作中,我們分析了在 “analog” synaptic devices 上的可靠性和在 inference accuracy 上 analog-to-digital converter (ADC) quantization 的影響
然後基於 SRAM 和 versatile emerging devices 包括 RRAM, PCM, FeFET and ECRAM 進行 CIM accelerators 基準測試。從 VGG 到 ResNet和從 CIFAR 到 ImageNet dataset, 揭露出 high on-state resistance 的好處
### Observation
裏頭提到,為了解決 the bottleneck of extensive data transfer in the conventional von Neumann architectures,在機器學習的硬體加速中,compute-in-memory (CIM)已成為有潛力的模範。
### Objective/Motivation
Device community 近期在研究 “analog” synaptic devices ,用於表示神經網路 (DNN) 中的權重。candidates 也包含 RRAM, PCM, FeFET and ECRAM
目前仍然缺乏一種從 CIM 系統角度評估這些新興設備特性的整體方法論,在2017年的IEDM(國際電子元件技術會議)中,先前的工作報告了一個名 MLP+NeuroSim的基準測試框架,可以評估設備非理想特性的影響。然而,先前的工作僅限於僅使用2層完全連接網絡進行 MNIST 數據集的評估。主要關注 synaptic-array level estimation,而 chip-level peripheries (such as buffers and interconnects) 並未被考慮進去。
為了能夠去適應靈活的神經網絡並支持 CIFAR 和 ImageNet這樣的大規模數據集,開發從 device-level 到 circuit-level 再到 algorithm-level 有著全面分層設計的模擬器相當重要
### Modeling/Application Scenario
該論文內,我們提出用於離線訓練的 end-to-end benchmarking framework for the inference engine。我們的方法便是去建構 python wrapper 將硬體巨集模型 NeuroSim 與流行的機器學習平台(如Pytorch和Tensorflow)進行介面連接。這種方法可以探索靈活網絡拓撲,像是 CIFAR-10 的 VGG-8, 和 ImageNet 的 ResNet-18 的CIM加速器設計,以及從CMOS(如SRAM)到超越CMOS(兩端和三端非揮發性記憶體)的多功能設備技術。
## Method
### INTEGRATED FRAMEWORK PRINCIPLES


>Fig. 1. Framework structure of DNN+NeuroSim. (a) DNN setup in python wrapper, software training with hardware constraints such as weight precision and partial sum quantization; (b) introduction of retention model and ADC quantization effects to inference accuracy;
A. Framework Structure
圖(a) 為彈性的DNN topologies 被設置在 Python wrappr 中(基於低精度訓練方法WAGE的Pytorch和TensorFlow),同時硬體限制像是 weight precision (受到設備多級狀態的限制)和 partial sum quantization (受到ADC精度的限制)會在軟體離線訓練階段引入
圖(b) 在hardware inference accuracy 階段引入了 device retention degradation model 和 ADC quantization

圖1(c)顯示 預定義的 network structure 作為輸入加載到NeuroSim 核心中,用於自動設計 chip floorplan (considering layer by layer computation)。同時引入 weight-duplication 以最大化記憶體利用率(定義為已使用記憶體佔總記憶體的百分比)。這是 convolutional layer 所需的一個功能,其中展開的 kernel size 小於 memory subarray size 大小,以加快 DNN 的處理速度。
> (c) pre-defined network structure is loaded as input to NeuroSim core, for automatic floor planning which weight-duplication to maximize memory utilization; (d) loading real trace (synaptic weights and neural activations) into NeuroSim, mapping data to conductance and digital voltage input cycles, which are to be partitioned and assigned to different locations of the CIM system; (e) hierarchical simulation from chip to tile, and from processing element (PE) to synaptic array
Fig. 1 (d) 指出在 python wrapper inference 期間, 真實 trace(synaptic weights and neural activations) 被展開 , 保存並發送到 NeuroSim 核心 , 然後根據自動化 floor planning rule,將數據映射到 conductance 和 digital voltage input cycles,並分割和分配给 CIM 系统中不同位置。
Fig. 1 (e) CIM系統的自上而下層級結構定義為 chip, tile, processing element (PE) and synaptic array.
framework outputs 包括受硬體限制的 inference accuracy(from python wrapper) 及 hardware metrics(指標),例如 chip area, latency, dynamic energy, leakage power,和每層計算模式下的 energy efficiency 和 throughput (from NeuroSim core)
所有 modular circuit component 的估計值,都是透過 PTM models 在 technology nodes 上進行 SPICE simulations 來校準的
B. Architecture of CIM Accelerators

圖 2 為 chip level 到 synaptic-array level 詳細系統架構。在不同 levels 上 , peripheries 被引進,包括 buffers, interconnects (based on H-tree routing), neural-functional units (such as pooling, accumulation and activation).
synaptic array 可由 SRAM, two-terminal devices(such as RRAM, PCM and STTMRAM) 或是 three-terminal devices(such as FeFET and ECRAM) 來實現。對這些 devices 來說 sequential (row-by-row) 和 parallel read-out schemes 都是可行的

> Fig. 2 (a) Architecture structure defined in the simulator, the top level of chip contains tiles, global buffer and neural-functional peripheries (including pooling, accumulation and activations). Inside a tile, it is further portioned into multiple processing elements (PEs), while each PE consists of several synaptic arrays, along with adder trees and local buffers. H-tree routing is used for interconnect.
Architecture structure 定義在 simulator, chip 的 top level 包含 tiles 和 global buffer 和 neural-functional peripheries (包含 pooling, accumulation 和 activations),在 tile 裡面會更進一步分割成多個 PEs(processing elements),而每一個 PE 會由許多的 synaptic arrays 所組成,然後沿著 adder trees 和 local buffers。 H-tree routing 會被用於 interconnect。

>(b) Parallel read-out synaptic arrays based on SRAM,two-terminal NVMs (RRAM, PCM and STT-MRAM), and three-terminal NVMs (FeFET and ECRAM). Sequential (row-by-row) read-out modes also available. The circuit modules are all calibrated by SPICE simulations across technology nodes with PTM model
圖 b 在說明parallel read-out synaptic arrays 會基於 SRAM 和 two-terminal NVMs (RRAM, PCM and STT-MRAM) 和 three-terminal NVMs (FeFET and ECRAM)。Sequential (row-by-row) read-out modes 也是可行的。circuit modules 都會通過PTM模型跨技術節點的SPICE simulations 進行校準
### BEHCMARK RESULTS
### Analyze
在 CIM inference engine 中,data retention 和 ADC quantization 對於 inference accuracy degradation 是關鍵因素。我們針對 CIFAR10 dataset ,具有 8-bit weight 和 8-bit activation precision 在VGG-8 的加速器設計上評估他們的影響和 benchmark。
接下來針對 Data Retention 和 ADC Quantization 進行討論
A. Data Retention
由於 analog intermediate state retention 仍需要更多實驗表徵,我們考慮 conductance drift 的 4種代表場景,其中 drifting 到 maximum, minimum, intermediate states, random drift。

>Fig. 3. (a) Different scenarios of conductance drift. Inference accuracy as a function of time for equivalent conductance drift by (b) 10%; (c) 6%; (d) 2% at 10 years, with different conductance uni-directional drifting targets (maximum 1 or minimum -1 or other intermediate states) or random drift of each weights.
圖 (a),conductance drift 的不同情況。equivalent conductance drift 的推理精度會隨時間變化的函數關係
在 Fig. 3 (b-d) 中 inference accuracy 作為時間函數,同時假設 conductance 朝不同最終狀態 drift (from -1 to 1, according to the algorithm weight range) 或是基於三種不同的 drift rate 的 randomly drift,這三種 drift rate 等同於 10 年內 conductance drift by 2%, 6% and 10 %。
結果表明,在固定 drift direction 下的場景中, drifting to maximum states 或是 drifting to maximum states 都比 drifting 到 middle states 更能快速地降低 accuracy,而 random drift 則是保持 inference accuracy 上的最佳場景(assuming the equivalent conductance drift by 2%).
B. ADC Quantization
通常 weight matrix size 比 memory sub-array size 還大(if unrolling the 4D kernels into 2D arrays in convolutional layers)。因此,經過 ADC 的 partial sum 需要從 multiple sub-arrays 被 accumulated 起來
這裡我們假設實際的數組大小從 64×64 到 256×256,具有三種 memory cell precision(1-bit/cell, 2-bit/cell and 4-bit/cell) 以及 sweep the ADC precision from 3-bit to 5-bit (with
nonlinear quantization),思考 inference accuracy 和 hardware overhead 之間的 trade-offs 尋找最佳設計方案
### Evaluation

>Fig. 4. Inference accuracy for VGG-8 for CIFAR10 as a function of ADC precision with different memory cell precision, at array size of (a) 64×64; (b) 128×128 and (c) 256×256, based on interface-engineered TaOx/HfOx RRAM [1]. 5-bit ADC is necessary for multi-bit per cell to maintain accuracy.
在圖 4 為 CIFAR10 的 VGG-8 inference accuracy 與不同存儲單元精度的 ADC accuracy 的函數關係,數組大小為 (a) 64×64 (b) 128×128 (c) 256×256並基於 interface-engineered TaOx/HfOx RRAM
其中 1-bit cell precision, 4-bit ADC 對於 64×64 和 128×128 synaptic array 都足以保證 89 % accuracy,而 5-bit ADC 在避免 multi-bit cell precisions 大的 accuracy loss 上和保持 accuracy 是必要的,

>Fig. 5. Comparison of inference accuracy, memory utilization, area, energy efficiency and throughput, across different synaptic array sizes with 4-bit cell precision for VGG-8 for CIFAR10, based on interface-engineered TaOx/HfOx RRAM [1]. 128×128 array size with 5-bit ADC is chosen as a balanced design option.
圖 5 為基於interface-engineered TaOx/HfOx RRAM,比較 CIFAR10 的 VGG-8 的 4-bit 單元精度的 synaptic array sizes 的 inference accuracy, memory utilization, area, energy efficiency, throughput。選擇具有 5-bit ADC 的 128×128 陣列尺寸作為平衡設計選項。
圖 5 顯示當增加 array size 時的 trade-offs,增加 array size 會導致更小的 chip area,但因 column 電流和 parasitic 負載電容較大,你的 throughput 和 energy efficiency 會變差。
雷達圖顯示,基於 128×128 array size 和 5-bit ADC 能在 accuracy, energy efficiency, throughput, area and memory utilization 之間實現相對平衡的 trade-offs

>Fig. 6. Impact of ADC precision and
cell precision on area and hardware
performance, with 128×128 array size
based on interface-engineered
TaOx/HfOx RRAM [1].
圖 6 為 ADC precision 和 cell precision 在面積和硬體效能上的影響,陣列大小為 128×128 基於 interface-engineered TaOx/HfOx RRAM
圖 6 顯示,較高的 ADC precision 對面積和能源效率不利,而較高的 memory cell precision 則有利,因為可以節省 peripheral circuitry(外圍電路)
C. Benchmark Across Device Technologies

表1. 在 CIFAR10 數據集上基於 SRAM(包括7nm和32nm的順序讀出和並行讀出)以及 “analog” synaptic devices(假設為 32nm 技術)上,VGG-8的DNN加速器的基準測試結果。綠色粗體數值表示性能良好的設備。
Table 1 顯示了最先進設備技術的 benchmarking results ,其中基於加速器的 sequential 和 parallel read-out SRAM 在 7nm 和 32nm 上評估以及基於加速器 parallel read-out NVM 在 32nm 上評估。(NVM 前面內容提過)
選擇32nm的原因是因為當前最先進的RRAM在22nm [11],PCM在40nm [12],FeFET在28nm [3]
考慮到 read-noise 和 on/off ratio,4-bit/cell 被假設為 [1, 2, 3, 4]
The benchmark results 顯示,大的 on-state resistance 𝑅𝑜𝑛 為實現好的硬體效能的關鍵因素。為了避免大的 voltage drop(壓降),1T1R 或 peripheral mux 中的 transistors 必須尺寸放大以適應較小的 𝑅𝑜𝑛,從而產生大量的 area overhead 。因此激活 synaptic arrays 的時間延長了(因為增加電容負載),從而增加延遲並降低吞吐量。
傳統的RRAM或PCM 即使每個單元具有多個 bit 皆不具競爭力
總體來說,基於具有大Ron(> 100kΩ)的 the “analog” synaptic device 的設計在 32nm上可以實現比基於7nm 設計 parallel SRAM,更優越的能源效率(in TOPS/W),同時具有非揮發性在即時啟動應用中的優勢
### FRAMEWORK PERFORMANCE
為了探索該 FRAMEWORK 在大規模系統中的 PERFORMANCE,使用更深的 DNN(即 ImageNet 的 ResNet-18),我們擴展了基於 FeFET 的 inference engine benchmarking,比較不同模擬方法的結果和運行時間。
真實 trace 模擬為 FRAMEWORK 中的默認方法(所有 trace 都以層級方式傳輸和訪問)
在偽 trace 模擬中,追蹤僅被存取過一次去產生 weight 的活動參數和每一層的激活,這些參數以層級方式作為輸入傳遞,而不是大規模的追蹤(節省模擬運行時間)。類似的,但沒有追蹤訪問,平均模擬只傳遞 user-assumed 的活動參數(例如 50%)。

>圖 7. ImageNet ResNet-18 上基於 FeFET 的 [3] DNN 加速器的基準測試結果,採用三種不同的估計方法(真實跡線、偽跡線和平均值)。綠色粗體值表明,儘管真實 trace 方法在工作站(Intel Xeon Gold-6136 24 核 3.0GHz,256GB DDR4)中運行速度較慢,但真實 trace 方法可實現更準確的估計,因為其他兩種方法低估了 CIM 性能
圖 7 顯示,合理的運行時間,真實追蹤 framework 實現最準確的結果,而其他兩個方法低估了效能(由於不準確的 column 電流估計)
### Conclusion
該論文裡,我們開發了 end-to-end framework 去 benchmark CIM-based inference engine,CIM-based inference engine 將有著 Pytorch 和 Tensorflow 的 NeuroSim 整合起來。
通過引入 device retention model 和 ADC quantization effects,能夠有效的去研究準確性、能量效率、吞吐量、面積和記憶體利用率之間的 trade-offs。
通過 parallel read-out scheme 和大的 R~on~,基於 “analog” synaptic device 的加速器顯示出很大的潛力。正在開發改進版的 DNN+NeuroSim,具有 on-chip training capability,用於未來發布。