TWI852888B - Accumulator and memory device for in-memory computing and operation method thereof - Google Patents

Accumulator and memory device for in-memory computing and operation method thereof Download PDF

Info

Publication number
TWI852888B
TWI852888B TW113105811A TW113105811A TWI852888B TW I852888 B TWI852888 B TW I852888B TW 113105811 A TW113105811 A TW 113105811A TW 113105811 A TW113105811 A TW 113105811A TW I852888 B TWI852888 B TW I852888B
Authority
TW
Taiwan
Prior art keywords
bit
result
generate
flip
accumulator
Prior art date
Application number
TW113105811A
Other languages
Chinese (zh)
Other versions
TW202520062A (en
Inventor
林柏榕
胡瀚文
李永駿
王淮慕
Original Assignee
旺宏電子股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 旺宏電子股份有限公司 filed Critical 旺宏電子股份有限公司
Application granted granted Critical
Publication of TWI852888B publication Critical patent/TWI852888B/en
Publication of TW202520062A publication Critical patent/TW202520062A/en

Links

Images

Landscapes

  • Complex Calculations (AREA)

Abstract

An accumulator provided by the present disclosure comprises: a counter for counting partial results generated by computing, to generate counting results; a weighting and extension unit for extending bits of each values of the counting results to generate bit extension results, and for moving corresponding bits of the bit extension results to generate weighting results based on a weight & extension table; a bit-flip unit for flipping the corresponding bits of the weighting results to generate flipping results based on a bit-flip table; a result summing unit for summing the flipping results to generate summing results; and a bias add unit for adding a bias value to the summing results to obtain final results.

Description

用於記憶體內運算之累加器、記憶體裝置及其操作方法Accumulator for in-memory calculation, memory device and operation method thereof

本發明係有關於一種用於記憶體內運算(In-Memory-Computing, IMC)的累加器、記憶體裝置及其操作方法。The present invention relates to an accumulator for in-memory computing (IMC), a memory device and an operation method thereof.

人工智慧(AI)已在許多領域中成為高度有效解決方案。AI的關鍵操作在於對大量的輸入資料(如輸入特徵圖(input feature maps))與權重值進行乘積累加運算(multiply-and-accumulate, MAC),而其中也包含了向量對向量乘積(vector-vector multiplication, VVM)操作。然而,以目前的AI架構而言,例如具有外部記憶體的CPU/GPU的馮紐曼架構(Von Neumann architecture),容易遇到輸出入瓶頸(I/O bottleneck)與低效率的MAC運算流程。然而,隨著所需運算的資料量增加,大量的運算資源消耗在資料的輸入/輸出(I/O),使I/O瓶頸變得更加嚴重,且效率將更低。Artificial intelligence (AI) has become a highly effective solution in many fields. The key operation of AI is to perform multiply-and-accumulate (MAC) operations on a large amount of input data (such as input feature maps) and weight values, which also includes vector-vector multiplication (VVM) operations. However, with the current AI architecture, such as the Von Neumann architecture of CPU/GPU with external memory, it is easy to encounter input/output bottlenecks (I/O bottlenecks) and inefficient MAC operation processes. However, as the amount of data required for calculation increases, a large amount of computing resources are consumed in data input/output (I/O), making the I/O bottleneck more serious and the efficiency will be lower.

本揭露之第一方面提供一種用於記憶體內運算(in-memory computing)的累加器,包括:計數器(counter),用於將記憶體內運算產生的多個部分結果的多個位元中具有第一位元值的對應對個位元進行計數,以產生計數結果;權重及延伸(weighting and extension)單元,耦接至計數器,用於將計數結果中的各位元使用多個第二位元值延伸至一預設位元數,以產生位元延伸結果,及用於根據權重及延伸資料表,將位元延伸結果中具有第一位元值的各位元,移動至各預設位元數中的對應第W位元,以產生權重結果;位元翻轉(bit-flip)單元,耦接至權重及延伸單元,用於根據位元翻轉資料表將權重結果中的對應各位元值中的各位元進行翻轉,以產生翻轉結果,且位元翻轉資料表具有P個第一位元值;一結果加總(result summing)單元,耦接至位元翻轉單元,用於將翻轉結果中的各值進行加總,以產生加總結果;以及偏位加總(bias add)單元,耦接至結果加總單元,用於將加總結果加上偏位值以產生累加結果,偏位值為P。P及W為大於等於0的正整數。The first aspect of the present disclosure provides an accumulator for in-memory computing, comprising: a counter for counting corresponding bits having a first bit value among a plurality of bits of a plurality of partial results generated by the in-memory computing to generate a counting result; a weighting and extension The invention relates to a bit-extension unit, coupled to the counter, for extending each bit in the counting result to a preset bit number using a plurality of second bit values to generate a bit extension result, and for moving each bit having a first bit value in the bit extension result to a corresponding Wth bit in each preset bit number according to a weight and extension data table to generate a weight result; a bit-flip unit, coupled to the weight and extension unit, for flipping each bit in the corresponding bit value in the weight result according to a bit-flip data table to generate a flip result, and the bit-flip data table has P first bit values; a result summing unit, coupled to the bit-flip unit, for summing each value in the flip result to generate a summed result; and a bias summing unit. The add) unit is coupled to the result summing unit and is used for adding the summing result to the bias value to generate the accumulated result, and the bias value is P. P and W are positive integers greater than or equal to 0.

本揭露之第二方面提供一種用於記憶體內運算的記憶體裝置,包括:多個記憶體平面,多個記憶體平面之各者包括:晶胞陣列,用於儲存多個權重;頁面緩衝器,耦接至晶胞陣列,頁面緩衝器用於讀取位於該晶胞陣列中的多個權重,並根據多個輸入運算產生多個部分結果,;多工器,耦接至頁面緩衝器,用於選擇位於頁面緩衝器中多個部分結果中的對應部分結果;以及如本揭露之第一方面提供之累加器,耦接至多工器。The second aspect of the present disclosure provides a memory device for in-memory operations, comprising: multiple memory planes, each of the multiple memory planes comprising: a cell array for storing multiple weights; a page buffer coupled to the cell array, the page buffer for reading multiple weights located in the cell array and generating multiple partial results based on multiple input operations; a multiplexer coupled to the page buffer for selecting corresponding partial results from the multiple partial results located in the page buffer; and an accumulator provided in the first aspect of the present disclosure, coupled to the multiplexer.

本揭露之第三方面提供一種用於記憶體內運算的記憶體裝置,包括:多個記憶體平面,多個記憶體平面之各者包括:晶胞陣列,用於儲存多個權重;頁面緩衝器,耦接至晶胞陣列,頁面緩衝器用於讀取位於該晶胞陣列中的多個權重,並根據多個輸入運算產生多個部分結果,;多工器,耦接至頁面緩衝器,用於選擇位於頁面緩衝器中多個部分結果中的對應部分結果;;以及計數器,耦接至多工器,計數器用於將多個部分結果的多個位元中具有第一位元值的對應多個位元進行計數,以產生計數結果;以及累加器,耦接至多個記憶體平面,累加器包括:暫存器,用於暫存於各記憶體平面中的多個計數結果;權重及延伸單元,耦接至暫存器,權重及延伸單元用於將各計數結果中的各位元使用多個第二位元值延伸至預設位元數,產生位元延伸結果,及用於根據權重及延伸資料表,將位元延伸結果中具有第一位元值的各位元,移動至預設位元數中的對應第W個位元,以產生權重結果;位元翻轉單元,耦接至權重及延伸單元,用於根據位元翻轉資料表將權重結果中的對應各位元值中的各位元進行翻轉,以產生翻轉結果,且位元翻轉資料表具有P個第一位元值;結果加總單元,耦接至位元翻轉單元,用於將翻轉結果中的各值進行加總,以產生加總結果;以及偏位加總單元,耦接至結果加總單元,用於將加總結果加上偏位值以產生累加結果,偏位值為P。P及W為大於等於0的正整數。A third aspect of the present disclosure provides a memory device for in-memory computing, comprising: a plurality of memory planes, each of the plurality of memory planes comprising: a cell array for storing a plurality of weights; a page buffer coupled to the cell array, the page buffer for reading a plurality of weights in the cell array and generating a plurality of partial results according to a plurality of input operations; a multiplexer coupled to the page buffer for selecting a corresponding partial result of a plurality of partial results in a page buffer; and a counter coupled to the multiplexer, the counter being used to count a plurality of corresponding bits having a first bit value among a plurality of bits of the plurality of partial results to generate a counting result; and an accumulator coupled to a plurality of memory planes, the accumulator comprising: a register for temporarily storing a plurality of counting results in each memory plane; a weight and extension unit coupled The weight and extension unit is connected to the register, and is used to extend each bit in each counting result to a preset bit number using a plurality of second bit values to generate a bit extension result, and is used to move each bit with a first bit value in the bit extension result to a corresponding Wth bit in the preset bit number according to the weight and extension data table to generate a weight result; the bit flip unit is coupled to the weight and extension unit, and is used to move each bit with a first bit value in the bit extension result to a corresponding Wth bit in the preset bit number according to the weight and extension data table The bit flip data table flips each bit in the corresponding bit value in the weight result to generate a flip result, and the bit flip data table has P first bit values; the result summing unit is coupled to the bit flip unit and is used to sum each value in the flip result to generate a summed result; and the offset summing unit is coupled to the result summing unit and is used to add the offset value to the summed result to generate an accumulated result, and the offset value is P. P and W are positive integers greater than or equal to 0.

根據本揭露之第一方面之多實施例,計數器至偏位加總單元間的一或多個匯流排的各者的頻寬對應於資料的權重及輸入的N位元、M維度及進位位元,N及M為大於等於1之整數。According to various embodiments of the first aspect of the present disclosure, the bandwidth of each of one or more buses from the counter to the bitwise summing unit corresponds to the weight of the data and the N-bit, M-dimension and carry bit of the input, where N and M are integers greater than or equal to 1.

根據本揭露之第三方面之多實施例,計數器至偏位加總單元間的一或多個匯流排的各者的頻寬對應於各記憶體平面的數量O、輸入的N位元、M維度及進位位元(carry bit),M、N及O為大於等於1之整數。According to multiple embodiments of the third aspect of the present disclosure, the bandwidth of each of one or more buses between the counter and the offset summing unit corresponds to the number O of each memory plane, the N bits of input, the M dimension and the carry bit, and M, N and O are integers greater than or equal to 1.

根據本揭露之第一方面或第三方面之多實施例,結果加總單元具有一或多個暫存器,一或多個暫存器的數量與對翻轉結果中的各值進行加總以產生加總結果所需的循環的數量成反比。According to various embodiments of the first aspect or the third aspect of the present disclosure, the result summing unit has one or more registers, and the number of the one or more registers is inversely proportional to the number of cycles required to sum the values in the flipped result to generate the summed result.

根據本揭露之第一方面或第三方面之多實施例,累加器更包括另至少之一移位加總單元,以對應被進行錯誤位元容忍資料(error-bit-tolerance)編碼的資料。According to various embodiments of the first aspect or the third aspect of the present disclosure, the accumulator further includes at least one shift-and-sum unit corresponding to data encoded with error-bit-tolerance.

本揭露之第四方面提供一種用於累加器之操作方法,包括:將記憶體內運算產生的多個部分結果的多個位元中具有第一位元值的對應多個位元進行計數,以產生計數結果;將計數結果中的各位元使用多個第二位元值延伸預設位元數,以產生位元延伸結果;根據權重及延伸資料表,將位元延伸結果中具有第一位元值的各位元,移動至預設位元數中的對應第W個位元,以產生權重結果;根據位元翻轉資料表將權重結果中的對應各位元值中的各位元進行翻轉,以產生翻轉結果,且位元翻轉資料表具有P個第一位元值;將翻轉結果中的各值進行加總,以產生加總結果;以及將加總結果加上偏位值以產生累加結果,偏位值為P。P及W為大於等於0的正整數。The fourth aspect of the present disclosure provides an operation method for an accumulator, including: counting corresponding multiple bits with first bit values in multiple bits of multiple partial results generated by calculation in a memory to generate a counting result; extending each bit in the counting result by a preset bit number using multiple second bit values to generate a bit extension result; moving each bit with a first bit value in the bit extension result to the corresponding Wth bit in the preset bit number according to a weight and extension data table to generate a weight result; flipping each bit in the corresponding bit value in the weight result according to a bit flip data table to generate a flip result, and the bit flip data table has P first bit values; summing up each value in the flip result to generate a summed result; and adding a bias value to the summed result to generate an accumulated result, and the bias value is P. P and W are positive integers greater than or equal to 0.

根據本揭露之第四方面之多實施例,對應被進行錯誤位元容忍資料編碼的資料,及根據該資料被運算產生的該些部分結果進行解碼及加總,以產生加總結果。According to multiple embodiments of the fourth aspect of the present disclosure, data corresponding to the error bit tolerant data encoding and the partial results generated by the operation on the data are decoded and summed to generate a summed result.

前述方面之多個變化選擇性地包含硬體、方法或程序、或電腦軟體於電腦可存取媒體。Various variations of the aforementioned aspects optionally include hardware, methods or programs, or computer software on a computer-accessible medium.

為了對本發明之上述及其他方面有更佳的瞭解,下文特舉實施例,並配合所附圖式詳細說明如下:In order to better understand the above and other aspects of the present invention, the following embodiments are specifically described in detail with reference to the accompanying drawings:

本說明書的技術用語係參照本技術領域之習慣用語,如本說明書對部分用語有加以說明或定義,該部分用語之解釋係以本說明書之說明或定義為準。本揭露之各個實施例分別具有一或多個技術特徵。在可能實施的前提下,本技術領域具有通常知識者可選擇性地實施任一實施例中部分或全部的技術特徵,或者選擇性地將這些實施例中部分或全部的技術特徵加以組合。The technical terms in this specification refer to the customary terms in this technical field. If this specification explains or defines some terms, the interpretation of these terms shall be subject to the explanation or definition in this specification. Each embodiment of the present disclosure has one or more technical features. Under the premise of possible implementation, a person with ordinary knowledge in this technical field can selectively implement part or all of the technical features in any embodiment, or selectively combine part or all of the technical features in these embodiments.

第1圖顯示示例記憶體裝置100的示意圖。記憶體裝置100可用於記憶體內運算(in-memory computing, IMC)。記憶體裝置100具有晶胞陣列110、頁面緩衝器130及累加器140。記憶體裝置100可使用頁面緩衝器130及累加器140完成IMC的向量對向量乘積(vector-vector multiplication, VVM)操作。在執行VVM操作時,會將晶胞陣列110中的頁面120的所選頁面121中的資料讀取至頁面緩衝器130,這些資料的資料形式可為向量,且包括輸入101及權重102。在此示例記憶體裝置100中,執行VVM操作的累加運算時,輸入101需要逐步的與權重102進行相乘,當資料為具有多組多個維度的向量時,需要多個循環才能將資料處理完畢(例如資料形式為64組4位元512維(64sets of 4-bit 512-dimension),容量為16KB),也就是需要較多的時間及功耗。FIG. 1 shows a schematic diagram of an example memory device 100. The memory device 100 may be used for in-memory computing (IMC). The memory device 100 has a cell array 110, a page buffer 130, and an accumulator 140. The memory device 100 may use the page buffer 130 and the accumulator 140 to perform a vector-vector multiplication (VVM) operation of the IMC. When performing the VVM operation, data in a selected page 121 of a page 120 in the cell array 110 is read into the page buffer 130. The data form of the data may be a vector and include an input 101 and a weight 102. In this example memory device 100, when performing the accumulation operation of the VVM operation, the input 101 needs to be multiplied by the weight 102 step by step. When the data is a vector with multiple sets of multiple dimensions, multiple loops are required to complete the data processing (for example, the data format is 64 sets of 4-bit 512-dimension (64sets of 4-bit 512-dimension), with a capacity of 16KB), which means that more time and power consumption are required.

第2圖顯示示例記憶體裝置200的累加器240的架構的示意圖。記憶體裝置200與第1圖的記憶體裝置100類似,同樣可用於記憶體內運算(in-memory computing, IMC),並執行VVM操作。記憶體裝置200類似於第1圖的記憶體裝置100,具有晶胞陣列210、頁面緩衝器230及累加器240。與第1圖的記憶體裝置100不同在於,記憶體裝置200的累加器240中設置有多個移位加總241(shift and add),用於分別地處理輸入201及權重202的乘積。由於具有多個移為加總241,累加240在執行VVM操作時,可同時處理這些輸入資料,因而可以減少運算所需的時間及功耗。然而,為了同時處理大量資料(例如資料形式為64組4位元512維,容量為16KB),隨之增加的移位加總241會增加大量成本及增加累加器240的體積。FIG. 2 is a schematic diagram showing the architecture of an accumulator 240 of an example memory device 200. The memory device 200 is similar to the memory device 100 of FIG. 1 and can also be used for in-memory computing (IMC) and perform VVM operations. The memory device 200 is similar to the memory device 100 of FIG. 1 and has a cell array 210, a page buffer 230, and an accumulator 240. The difference from the memory device 100 of FIG. 1 is that the accumulator 240 of the memory device 200 is provided with a plurality of shift and add operations 241 for processing the product of the input 201 and the weight 202 respectively. Since there are multiple shift-and-sum 241, the accumulator 240 can process these input data simultaneously when executing the VVM operation, thereby reducing the time and power consumption required for the operation. However, in order to simultaneously process a large amount of data (for example, the data is in the form of 64 groups of 4-bit 512 dimensions and the capacity is 16KB), the additional shift-and-sum 241 will increase a lot of costs and increase the size of the accumulator 240.

為解決上述記憶體內運算中針對大量資料部分乘積使用大量累加器的成本及體積問題,本揭露提出的記憶體裝置及記憶體裝置的累加器使用脈動輸入(systolic input)及配合計數器(counter-co-work)的操作架構,並使用位元翻轉資料表(bit-flip table)來更廣泛的支援有符號數資料的整數運算。本揭露的多個實施例的記憶體裝置及記憶體裝置的累加器的技術將於下列詳細說明。In order to solve the cost and size problem of using a large number of accumulators for partial multiplication of a large number of data in the above-mentioned in-memory operation, the memory device and the accumulator of the memory device proposed in the present disclosure use a systolic input and a counter-co-work operation architecture, and use a bit-flip table to more widely support integer operations of signed data. The technology of the memory device and the accumulator of the memory device of multiple embodiments of the present disclosure will be described in detail below.

此處所揭露的技術提供用於在半導體裝置中利用配合計數器(counter-co-work)支持執行VVM、乘積累加運算(MAC)、高維度運算(hyperdimensional computing, HDC)或只加總(SUM-only)等操作。針對所述之目的,半導體裝置於此係以說明成一記憶體裝置作為範例。需注意的是,此些技術可應用於執行VVM或MAC運算的累加的任何形式之電路、裝置、或系統。舉例來說,除了記憶體裝置以外,此些技術可亦應用於任何其他儲存裝置或邏輯裝置例如神經網路加速器。Techniques disclosed herein provide for performing VVM, MAC, HDC, or SUM-only operations in a semiconductor device using counter-co-work support. For the purposes described, the semiconductor device is illustrated as a memory device. It should be noted that these techniques may be applied to any circuit, device, or system that performs VVM or MAC operations. For example, in addition to memory devices, these techniques may also be applied to any other storage device or logic device such as a neural network accelerator.

此些技術可應用於數種形式的非揮發性記憶體裝置,例如是NOR快閃記憶體、NAND快閃記憶體、可抹除可程式唯讀記憶(erasable programmable read-only memory,EPROM)、鐵電式隨機存取記憶體(ferroelectric random access memory,FeRAM)、磁性隨機存取記憶體(magnetoresistive random-access memory,PCRAM)及其他等。此些技術可應用於數種記憶體形式,例如是單層記憶胞(single-level cell,SLC)裝置、多層記憶胞(multi-level cell,MLC)裝置如二層記憶胞裝置(2-level cell devices)、三層記憶胞(triple-level cell,TLC)裝置、四層記憶胞(quad-level cell,QLC)裝置、或五層記憶胞(penta-level cell,PLC)裝置。此些技術可額外地或替代地應用於各種形式的裝置及系統,例如是安全數位(secure digital,SD)卡、嵌入型多媒體卡(embedded multimedia cards,eMMC)、或固態硬碟(solid-state drives,SSDs)、嵌入型系統,或是網路計算機裝置,如網路路由器或網路處理器、快取控制器以及位址轉換暫存器、查找表、資料庫引擎、資料壓縮硬體、人工神經網路、入侵防禦系統、訂製電腦以及其它。These techniques can be applied to several types of nonvolatile memory devices, such as NOR flash memory, NAND flash memory, erasable programmable read-only memory (EPROM), ferroelectric random access memory (FeRAM), magnetic random access memory (PCRAM), and others. These techniques can be applied to several memory formats, such as single-level cell (SLC) devices, multi-level cell (MLC) devices such as 2-level cell devices, triple-level cell (TLC) devices, quad-level cell (QLC) devices, or penta-level cell (PLC) devices. These techniques may additionally or alternatively be applied to various types of devices and systems, such as secure digital (SD) cards, embedded multimedia cards (eMMC), or solid-state drives (SSDs), embedded systems, or network computer devices such as network routers or network processors, cache controllers and address translation registers, lookup tables, database engines, data compression hardware, artificial neural networks, intrusion prevention systems, custom computers, and others.

第3圖顯示根據本揭露一實施例之記憶體裝置300的累加器340的架構的示意圖。記憶體裝置300與第1圖的記憶體裝置100及第2圖的記憶體裝置200類似,同樣可用於記憶體內運算(in-memory computing, IMC),並執行VVM或MAC操作。記憶體裝置300,具有晶胞陣列310、頁面緩衝器330、多工器315及累加器340。與第1圖的記憶體裝置100及第2圖的記憶體裝置200不同在於,記憶體裝置300的累加器340具有計數器341、暫存器342、權重及延伸單元343、位元翻轉單元344、結果加總單元345、偏位加總單元346及輸出暫存器347。在執行VVM或MAC操作時,記憶體裝置300的累加器340接收作為部分結果的資料(圖中未示,請參照第4圖所說明之內容),並利用具有計數器341,以致能於脈動輸入(systolic input)及配合計數器(counter-co-work)的操作。累加器340的權重及延伸單元343、位元翻轉單元344、結果加總單元345及偏位加總單元346透過位元翻轉資料表(bit-flip table) (圖中未示,請參照第6圖所說明之內容),致能於支援有符號數資料的整數運算。根據本揭露的多個實施例的半導體裝置的累加器中的各元件的具體功能將於下列第4圖至第7圖中詳細說明。FIG. 3 is a schematic diagram showing the architecture of an accumulator 340 of a memory device 300 according to an embodiment of the present disclosure. The memory device 300 is similar to the memory device 100 of FIG. 1 and the memory device 200 of FIG. 2 and can also be used for in-memory computing (IMC) and perform VVM or MAC operations. The memory device 300 has a cell array 310, a page buffer 330, a multiplexer 315, and an accumulator 340. The difference between the memory device 100 of FIG. 1 and the memory device 200 of FIG. 2 is that the accumulator 340 of the memory device 300 has a counter 341, a register 342, a weight and extension unit 343, a bit flip unit 344, a result summing unit 345, a biased summing unit 346, and an output register 347. When performing a VVM or MAC operation, the accumulator 340 of the memory device 300 receives data as a partial result (not shown in the figure, please refer to the content described in FIG. 4), and uses the counter 341 to enable systolic input and counter-co-work operations. The weight and extension unit 343, the bit flip unit 344, the result summing unit 345 and the offset summing unit 346 of the accumulator 340 are used to support integer operations on signed data through a bit-flip table (not shown in the figure, please refer to the content described in FIG. 6). The specific functions of each element in the accumulator of the semiconductor device according to various embodiments of the present disclosure will be described in detail in the following FIGS. 4 to 7.

第4圖顯示具有根據本揭露一實施例之累加器440的記憶體裝置400的架構的示意圖。於多個實施例中,在進行VVM操作前,資料(如向量資料)可先進行預處理(pre-processing) 。在預處理之前,輸入的資料形式可為L組N位元M維之向量。作為示例,進行預處理之後的資料可將L組N位元M維的權重進行編碼,得到編碼後權重402,其中L、M及N為大於等於1的正整數。於此示例中,將以64組4位元512維(L=64, N=4, M=512)的向量(總容量為16KB)為例以方便說明。權重402可被資料預處理,將原本64組4位元512維的資料形式重新依據權重編碼為各L組中有N種不同對應權重值(如圖中權重W 3、W 2、W 1及W 0),且各對應權重值具有M位元,也就是64組有4種權重的而各權重具有512位元的資料形式,如圖中所示。而為對應於各權重具有512位元的資料形式,輸入401可經由N循環(對應於N種權重)的M位元形式(對應權重的M位元),與權重進行運算,每個循環段應產生多個部分結果,如圖中所示。根據於本揭露之資料預處理,能將資料先進行編碼處理及計算(如相乘),以致能於使用前述之脈動輸入(systolic input)功能,將儲存於晶胞陣列中(如第3圖中的晶胞陣列310)中的權重透過頁面緩衝器讀取,並與輸入進行運算產生多個部分結果,再由多工器(如第3圖中的頁面緩衝器330及多工器315)選擇對應的部分結果,可進一步被使用於本揭露前述之配合計數器(counter-co-work)操作架構(可配合累加器440之計數器441、權重及延伸單元443、位元翻轉單元444、結果加總單元445、偏位加總單元446及輸出暫存器447)。其他元件的具體功能將於下列圖式中詳細說明。 FIG. 4 is a schematic diagram showing the architecture of a memory device 400 having an accumulator 440 according to an embodiment of the present disclosure. In many embodiments, before performing a VVM operation, data (such as vector data) may be pre-processed. Before pre-processing, the input data may be in the form of L groups of N-bit M-dimensional vectors. As an example, the pre-processed data may be encoded with L groups of N-bit M-dimensional weights to obtain encoded weights 402, where L, M, and N are positive integers greater than or equal to 1. In this example, 64 groups of 4-bit 512-dimensional (L=64, N=4, M=512) vectors (with a total capacity of 16KB) are used as an example for ease of explanation. The weight 402 may be pre-processed by data, and the original 64 groups of 4-bit 512-dimensional data forms are re-encoded according to the weights into N different corresponding weight values in each L group (such as weights W 3 , W 2 , W 1 and W 0 in the figure), and each corresponding weight value has M bits, that is, 64 groups of 4 weights and each weight has a 512-bit data form, as shown in the figure. In order to correspond to the data form of each weight having 512 bits, the input 401 can be operated with the weight through N loops (corresponding to N weights) of M-bit form (corresponding to M bits of weight), and each loop segment should produce multiple partial results, as shown in the figure. According to the data preprocessing disclosed in the present invention, the data can be coded and calculated (such as multiplication) first, so that the data can be used in the aforementioned pulse input (systolic The weight stored in the cell array (such as the cell array 310 in FIG. 3 ) is read through the page buffer and operated with the input to generate multiple partial results, and then the corresponding partial results are selected by the multiplexer (such as the page buffer 330 and the multiplexer 315 in FIG. 3 ), which can be further used in the aforementioned counter-co-work operation architecture of the present disclosure (counter 441, weight and extension unit 443, bit flip unit 444, result summing unit 445, offset summing unit 446 and output register 447 that can be used in conjunction with the accumulator 440). The specific functions of other components will be described in detail in the following figures.

第5圖顯示根據本揭露一實施例之權重及延伸500的操作示意圖。如前述,用於多個運算(例如VVM或MAC操作)的權重可儲存於晶胞陣列中(如第3圖中的晶胞陣列310),並透過頁面緩衝器(如第3圖中的頁面緩衝器330)將讀取出的權重根據輸入進行運算,並產生多個部分結果,多工器(如第3圖中的多工器315)選擇對應的部分結果分批輸出至累加器(例如第4圖中的累加器440)進行處理。為方便說明,於此示例中,用於計算的輸入及權重以4位元資料格式的輸入501: 及權重502: 為例,且以輸入501的值為-3(1101)及權重502的值為-1(1111)為例,如圖中所示。 FIG. 5 is a schematic diagram of the operation of weights and extensions 500 according to an embodiment of the present disclosure. As mentioned above, weights used for multiple operations (such as VVM or MAC operations) can be stored in a cell array (such as the cell array 310 in FIG. 3), and the read weights are operated according to the input through a page buffer (such as the page buffer 330 in FIG. 3) to generate multiple partial results, and a multiplexer (such as the multiplexer 315 in FIG. 3) selects the corresponding partial results and outputs them in batches to an accumulator (such as the accumulator 440 in FIG. 4) for processing. For ease of explanation, in this example, the input and weights used for calculation are input 501 in a 4-bit data format: and weight 502: As an example, the value of input 501 is -3 (1101) and the value of weight 502 is -1 (1111), as shown in the figure.

輸入501及權重502進行乘積時,權重502可儲存於晶胞陣列中(如第3圖中的晶胞陣列310),並透過頁面緩衝器讀取權重502並根據輸入501進行運算。多工器(如第3圖中的頁面緩衝器330及多工器315)可選擇對應的部分結果輸出至累加器中的計數器(如第4圖中的累加器440及計數器441),也就是對應於第5圖中的部分結果510(例如為 )。多個部分結果510進行由計數器(例如第4圖的計數器441)進行計數,以得到計數結果520,如圖中所示。其中,計數為將具有第一位元值的位元進行計數。接下來為方便說明,將以第一位元值為1,而第二位元值為0為例,但本揭露不以此作為限制。 When the input 501 and the weight 502 are multiplied, the weight 502 can be stored in a cell array (such as the cell array 310 in FIG. 3 ), and the weight 502 is read through the page buffer and operated according to the input 501. The multiplexer (such as the page buffer 330 and the multiplexer 315 in FIG. 3 ) can select the corresponding partial result to be output to the counter in the accumulator (such as the accumulator 440 and the counter 441 in FIG. 4 ), that is, the partial result 510 (such as the accumulator 440 and the counter 441 in FIG. 4 ) in FIG. 5 ). The plurality of partial results 510 are counted by a counter (e.g., the counter 441 in FIG. 4 ) to obtain a count result 520, as shown in the figure. The counting is to count the bits having the first bit value. For the convenience of explanation, the first bit value is 1 and the second bit value is 0 as an example, but the present disclosure is not limited to this.

接著權重及延伸(weighting and extension)單元(例如第4圖的權重及延伸單元443),將計數結果520中的各位元使用多個第二位元值(0)延伸至預設位元數,產生位元延伸結果530。預設位元數關聯於輸入資料及權重的位元、資料維度及進位位元(carry bit)。於一些示例中,預設位元數可根據於下列等式(1)計算: 2 預設位元數 =(2 ( 輸入位元 (Ni)– 1) * 2 ( 權重位元 (Nw) – 1) ) * ((2 m> 資料維度 (M))* 2 1( 進位位元 (carry bit))等 式 (1)其中輸入位元(Ni)、權重位元(Nw)及資料維度(M)皆為大於等於1之整數。需注意的是其中 (2 m> 資料維度 (M))代表2 m需要大於資料維度,而m同樣為大於等於1的整數。舉例來說,當資料維度(M)=1,2 m=1=2大於資料維度(M)(1),因此m為1;而當資料維度(M)=2時,2 m=1=2,並無大於資料維度(M)(為2),因此需以2 m=2表示,使2 2大於資料維度(M)(為2),其他m值的計算方法以此類推。於此示例中,由於輸入501及權重502的位元皆為4( 及 對應於輸入位元Ni及權重位元Nw),而資料維度為1(M=1),因此計數結果520中的各位元被延伸至8(2 8)位元數。例如於圖中的延伸結果530中所框示的部分, 從原本的1(第一位元值)使用了7個0(第二位元值)延伸至8位元數。而由於本揭露的數值在進算後可進位,因此包含了進位位元531,如圖中所示。 Then, a weighting and extension unit (e.g., weighting and extension unit 443 in FIG. 4 ) extends each bit in the count result 520 to a preset number of bits using a plurality of second bit values (0) to generate a bit extension result 530. The preset number of bits is associated with the bit of the input data and weight, the data dimension, and the carry bit. In some examples, the default number of bits can be calculated according to the following equation (1): 2Default number of bits = (2 ( input bit (Ni) – 1) * 2 ( weight bit (Nw) – 1) ) * (( 2m > data dimension (M)) * 2 1 ( carry bit)) Equation (1) wherein the input bit (Ni), weight bit (Nw) and data dimension (M) are all integers greater than or equal to 1. It should be noted that ( 2m > data dimension (M)) means that 2m needs to be greater than the data dimension, and m is also an integer greater than or equal to 1. For example, when the data dimension (M) = 1, 2m=1 =2 is greater than the data dimension (M)(1), so m is 1; and when the data dimension (M) = 2, 2m=1 =2, which is not greater than the data dimension (M) (which is 2), so it is necessary to express it as 2 m=2 , so that 2 2 is greater than the data dimension (M) (which is 2). The calculation method for other m values is similar. In this example, since the bits of input 501 and weight 502 are both 4 ( and Corresponding to the input bit Ni and the weight bit Nw), and the data dimension is 1 (M=1), so each bit in the count result 520 is extended to 8 (2 8 ) bits. For example, the part framed in the extended result 530 in the figure, The original 1 (the first bit value) is extended to 8 bits using 7 zeros (the second bit value). Since the numerical value disclosed in the present invention can be carried after calculation, a carry bit 531 is included, as shown in the figure.

接著,參照於第5圖中所示的權重及延伸資料表550,其中包括了 及 所對應的權重位移資料,例如於表中W00~W03分別對應至0~3,代表了需要將延伸結果530中的各位元中具有第一位元值(於此示例中為1)的位元所需移動到的位置(預設位元數中的第W個)。舉例來說,於權重及延伸資料表550中, 的值為2 6(W33),也就是W33為6,因此, 中第一位元值(於此示例中為1)原本在第0個位置(右邊數第1位),將根據權重及延伸資料表550中的資料( 的值為2 6(W33)),移動至第W33個位置(W33=6,也就是右邊數來第7位)。以此類推,位元延伸結果540中具有第一位元值(於此示例中為1)的對應位元(例如除了 列之外的各位元),同樣根據權重及延伸資料表550,移動第一位元值(1)的對應位元至預設位元數中的對應第W(W00~W33)個位元,以產生權重結果540,如第5圖中所示。 Next, referring to the weight and extension data table 550 shown in FIG. 5, which includes and The corresponding weight displacement data, for example, W00~W03 in the table correspond to 0~3 respectively, representing the position (Wth in the default bit number) to which the bit with the first bit value (1 in this example) in the extended result 530 needs to be moved. For example, in the weight and extended data table 550, The value of is 2 6(W33) , that is, W33 is 6, so, The first digit value (in this example, 1) is originally at position 0 (1st from the right) and will be extended based on the weight and data in table 550 ( The value of is 2 6(W33) ), and it moves to the W33th position (W33=6, which is the 7th bit from the right). Similarly, the corresponding bits (for example, except ), similarly according to the weight and extension data table 550, the corresponding bit of the first bit value (1) is moved to the corresponding Wth (W00~W33) bit in the preset bit number to generate the weight result 540, as shown in FIG. 5 .

第6圖顯示根據本揭露一實施例之位元翻轉600的操作示意圖。為了簡化於本揭露之累加器中之乘積運算所需使用之元件,於多個實施例中,位元翻轉(bit-flip)單元(例如第4圖的位元翻轉單元444)具有位元翻轉資料表。位元翻轉資料表對應於下列等式: 等式 (2) FIG. 6 is a schematic diagram of the operation of a bit flip 600 according to an embodiment of the present disclosure. In order to simplify the components required for the product operation in the accumulator of the present disclosure, in many embodiments, the bit flip unit (such as the bit flip unit 444 of FIG. 4) has a bit flip data table. The bit flip data table corresponds to the following equation: Equation (2)

經由等式(2),可獲得位元翻轉資料表中需要進行位元翻轉的位元位置(如第6圖的位元翻轉資料表605中所標示)。於此示例中,由位元翻轉資料表605可以得知需要進行位元翻轉的位元為A 3(B 2B 1B 0)及B 3(A 2A 1A 0),其中以第一位元值(於此示例中為1)。位元翻轉資料表中,上述第一位元值的數量為P,也就是具有P個第一位元值。於此示例中,位元翻轉資料表605中第一位元值(於此示例中為1)的數量(P)為6,6可由 (0110)表示,位元翻轉資料表中第一位元值的數量於後續其他操作中,可用作為偏位值P(可參照於第7圖之說明)。 Through equation (2), the bit positions that need to be bit flipped in the bit flip data table can be obtained (as indicated in the bit flip data table 605 of FIG. 6). In this example, it can be known from the bit flip data table 605 that the bits that need to be bit flipped are A 3 (B 2 B 1 B 0 ) and B 3 (A 2 A 1 A 0 ), where the first bit value (in this example, 1) is used. In the bit flip data table, the number of the first bit values mentioned above is P, that is, there are P first bit values. In this example, the number (P) of the first bit values (in this example, 1) in the bit flip data table 605 is 6, which can be represented by (0110). The number of the first bit values in the bit flip data table can be used as the offset value P in other subsequent operations (refer to the description of FIG. 7).

如於第6圖中所示,權重結果640(與此實施例中與第5圖的權重結果540相同)的對應位元A 3(B 2B 1B 0)及B 3(A 2A 1A 0)被根據位元翻轉資料表605的對應欄位進行翻轉,將第一位元值翻轉成第二位元值(例如將1翻轉為0)及將第二位元值翻轉成第一位元值(例如將0翻轉為1),以得到翻轉結果660。 As shown in FIG. 6 , the corresponding bits A 3 (B 2 B 1 B 0 ) and B 3 (A 2 A 1 A 0 ) of the weight result 640 (which is the same as the weight result 540 in FIG. 5 in this embodiment) are flipped according to the corresponding columns of the bit flip data table 605, flipping the first bit value into the second bit value (e.g., flipping 1 into 0) and flipping the second bit value into the first bit value (e.g., flipping 0 into 1) to obtain the flip result 660.

第7圖顯示根據本揭露一實施例之結果加總700的操作示意圖。結果加總700的操作可藉由結果加總(results summing)單元(例如第4圖中的結果加總單元445)來實施,將翻轉結果760(與此實施例中與第6圖的翻轉結果660相同)中的各值先進行分組加總770,再進行加總以產生加總結果780(例如為1111101,如圖中所示)。FIG. 7 is a schematic diagram showing the operation of result summing 700 according to an embodiment of the present disclosure. The operation of result summing 700 can be implemented by a result summing unit (e.g., result summing unit 445 in FIG. 4 ), which first performs group summing 770 on each value in flip result 760 (which is the same as flip result 660 in FIG. 6 in this embodiment) and then sums them to generate a summed result 780 (e.g., 1111101, as shown in the figure).

由於根據本揭露之多個實施例中有進行如前述之位元翻轉操作,因此本揭露之累加器具有偏位加總(bias add)單元(例如第4圖中的偏位加總單元446),用於將加總結果加上偏位值以產生累加結果。Since the bit flipping operation as described above is performed in many embodiments of the present disclosure, the accumulator of the present disclosure has a bias add unit (such as the bias add unit 446 in Figure 4) for adding a bias value to the summed result to generate an accumulated result.

如於第7圖中所示,加總結果780(例如為1111101)加上前述之偏位值P(位元翻轉資料表605中之第一位元值之數樣),而P為00000110(代表6),兩者相加後之累加結果790如圖中所示為00000011,也就是最後累加的結果為3。而如前述,於此示例中,輸入的值為-3(1101)(例如輸入501)及權重的值為-1(1111)(例如權重502),因此累加結果為3等同於輸入值-3與權重值-1的乘積。As shown in FIG. 7 , the summed result 780 (e.g., 1111101) is added to the aforementioned offset value P (the sample of the first bit value in the bit flip data table 605), and P is 00000110 (representing 6). The cumulative result 790 after adding the two is 00000011 as shown in the figure, that is, the final cumulative result is 3. As mentioned above, in this example, the input value is -3 (1101) (e.g., input 501) and the weight value is -1 (1111) (e.g., weight 502), so the cumulative result is 3, which is equal to the product of the input value -3 and the weight value -1.

因此,根據於上述多個實施例,本揭露所提出之記憶體裝置及記憶體裝置的累加器的架構,以脈動輸入(systolic input)及配合計數器(counter-co-work)的操作架構,可達成VVM或MAC的部分結果的累加運算,不需要配置大量的移位加總元件,有效降低IMC運算的時間、功耗及成本。Therefore, according to the above-mentioned multiple embodiments, the memory device and the accumulator architecture of the memory device proposed in the present disclosure can achieve the accumulation operation of partial results of VVM or MAC with systolic input and counter-co-work operation architecture, without the need to configure a large number of shift-sum elements, effectively reducing the time, power consumption and cost of IMC operation.

除了前述根據本揭露的記憶體裝置及記憶體裝置的累加器的架構外,本揭露進一步可根據所處理的VVM資料形式來調整元件間的匯流排頻寬,以增加運算的效率及彈性。下列將配合於第8圖及第9圖進行詳細說明。In addition to the aforementioned memory device and accumulator architecture of the memory device according to the present disclosure, the present disclosure can further adjust the bus bandwidth between components according to the processed VVM data format to increase the efficiency and flexibility of the operation. The following will be explained in detail with reference to FIG. 8 and FIG. 9.

第8圖顯示根據本揭露一實施例之記憶體裝置800的累加器840的示例匯流排頻寬設計的示意圖。於此示例中,如圖中所示,累加器840中之權重及延伸單元843至輸出暫存器847間之一或多個匯流排頻寬(如圖中虛線框所標示),可根據輸入及權重的位元(Ni及Nw)、資料維度及進位位元(carry bits)來進行設計,也就是根據下列等式: 2 匯流排頻寬=(2 ( 輸入位元 (Ni)– 1)* 2 ( 權重位元 (Nw) – 1)) * 資料維度(M)* 2 1(進位位元) 等式 (3) FIG. 8 is a schematic diagram showing an exemplary bus bandwidth design of an accumulator 840 of a memory device 800 according to an embodiment of the present disclosure. In this example, as shown in the figure, one or more bus bandwidths (as indicated by the dashed box in the figure) between the weight and extension unit 843 in the accumulator 840 and the output register 847 can be designed according to the input and weight bits (Ni and Nw), the data dimension and the carry bits, that is, according to the following equation: 2 Bus bandwidth = (2 ( input bit (Ni) – 1) * 2 ( weight bit (Nw) – 1) ) * data dimension (M) * 2 1 (carry bit) Equation (3)

例如,在資料形式為4位元512維(等於2 9)時,匯流排的頻寬根據上列等式(3)為 (2 (4-1)* 2 (4-1)) * 2 9* 2 1= 2 16,被設計為16,如第8圖中所示。 For example, when the data format is 4-bit 512-dimensional (equal to 2 9 ), the bus bandwidth is (2 (4-1) * 2 (4-1) ) * 2 9 * 2 1 = 2 16 according to the above equation (3), and is designed to be 16, as shown in FIG. 8 .

第9圖顯示根據本揭露一實施例之記憶體裝置900的累加器940的另一示例匯流排頻寬的示意圖。類似於第8圖的示例,與此示例中,在資料形式為8位元512維(等於2 9)時,匯流排的頻寬根據上列等式(3)為 (2 (8-1)* 2 (8-1)) * 2 9* 2 1= 2 24,被設計為24,如圖中所示。因此,本揭露的多個實施例可根據所處理的VVM資料形式來調整元件間的匯流排頻寬的設計,以增加運算的效率及彈性。 FIG. 9 is a schematic diagram showing another example bus bandwidth of an accumulator 940 of a memory device 900 according to an embodiment of the present disclosure. Similar to the example of FIG. 8, in this example, when the data format is 8-bit 512-dimensional (equal to 2 9 ), the bus bandwidth is (2 (8-1) * 2 (8-1) ) * 2 9 * 2 1 = 2 24 according to the above equation (3), and is designed to be 24, as shown in the figure. Therefore, the various embodiments of the present disclosure can adjust the bus bandwidth design between components according to the VVM data format being processed to increase the efficiency and flexibility of the operation.

第10圖顯示根據本揭露一實施例之記憶體裝置1000的累加器1040的結果加總單元1045的示例暫存器1042的示意圖。於多個實施例中,本揭露進一步可根據需求來設計結果加總單元1045的示例暫存器1042的數量。以資料形式為64組4位元512維向量,頁面緩衝器容量為16KB為例,若暫存器的數量設計為64個(策略1),可暫存64組的部分值(partial value),一次可處理16KB,因此需要較少的循環;若暫存器的數量設計為16個(策略2),可暫存16組的部分值,一次可處理4KB,因此需要較多的循環;若暫存器的數量設計為1個(策略3),可暫存1組的部分值,一次可處理256B,因此需要更多的循環。然而較多的暫存器意味於需要更多的成本但較少的循環(運算時間),而較少的暫存器意味有較低的成本但需要較多的循環(運算時間)。根據於反覆的實驗,於上述條件下所得到的運算速度於策略1約為1306us、策略2約為1306us及策略3約為1351us。FIG. 10 is a schematic diagram showing an example register 1042 of a result summing unit 1045 of an accumulator 1040 of a memory device 1000 according to an embodiment of the present disclosure. In various embodiments, the present disclosure further designs the number of example registers 1042 of the result summing unit 1045 according to requirements. For example, if the data format is 64 sets of 4-bit 512-dimensional vectors and the page buffer capacity is 16KB, if the number of registers is designed to be 64 (strategy 1), 64 sets of partial values can be stored, and 16KB can be processed at a time, so fewer loops are needed; if the number of registers is designed to be 16 (strategy 2), 16 sets of partial values can be stored, and 4KB can be processed at a time, so more loops are needed; if the number of registers is designed to be 1 (strategy 3), 1 set of partial values can be stored, and 256B can be processed at a time, so more loops are needed. However, more registers mean more cost but fewer cycles (computation time), while fewer registers mean lower cost but more cycles (computation time). Based on repeated experiments, the computing speed obtained under the above conditions is about 1306us for strategy 1, about 1306us for strategy 2, and about 1351us for strategy 3.

策略1、策略2及策略3所使用的參數及計算方式分別如下: 策略 1 : Assume the latency parameters = Req_VVM = 512 t Read= 70us, one-time t Input_import= 30.72us, Global t Logic-AND then to CDL= 5us, t Internal-transfer= 5us, t Accumulation-base= 30.72us t Accumulation= (t Accumulation-base/(Exe_VMM_PB))*N (N = 64) Exe_VMM_PB = Page buffer size/Required memory cells Request_Read = Req_VVM/ Exe_VMM_PB Computing time = Input_bit*(t Input_import) + (Request_Read * (((Exe_VMM_PB/N) * (Input_bit*(t Logic-function then to CDL+ t Accumulation))) + t Internal-transfer)) = (4 * 30.72) + (8*(((64/64) * (4 * (5 + 30.72))) + 5)) ~= 1306us 策略 2 : Assume the latency parameters = Req_VVM = 512 t Read= 70us, one-time t Input_import= 30.72us, Local t Logic-AND then to CDL= 1.25us, t Internal-transfer= 5us, t Accumulation-base= 30.72us t Accumulation= (t Accumulation-base/(Exe_VMM_PB))*N (N = 16) Exe_VMM_PB = Page buffer size/Required memory cells Request_Read = Req_VVM/ Exe_VMM_PB Computing time = Input_bit*(t Input_import) + (Request_Read * (((Exe_VMM_PB/N) * (Input_bit*(t Logic-function then to CDL+ t Accumulation))) + t Internal-transfer)) = (4 * 30.72) + (8*(((64/16) * (4 * (1.25 + 7.68))) + 5)) ~= 1306us 策略 3 : Assume the latency parameters = Req_VVM = 512 t Read= 70us, one-time t Input_import= 30.72us, Local t Logic-AND then to CDL= 0.1us, t Internal-transfer= 5us, t Accumulation-base= 30.72us t Accumulation= (t Accumulation-base/(Exe_VMM_PB))*N (N = 1) Exe_VMM_PB = Page buffer size/Required memory cells Request_Read = Req_VVM/ Exe_VMM_PB Computing time = Input_bit*(t Input_import) + (Request_Read * (((Exe_VMM_PB/N) * (Input_bit*(t Logic-function then to CDL+ t Accumulation))) + t Internal-transfer)) = (4 * 30.72) + (8*(((64/1) * (4 * (0.1 + 0.48))) + 5)) ~= 1351us The parameters and calculation methods used in Strategy 1, Strategy 2 and Strategy 3 are as follows: Strategy 1 : Assume the latency parameters = Req_VVM = 512 t Read = 70us, one-time t Input_import = 30.72us, Global t Logic-AND then to CDL = 5us, t Internal-transfer = 5us, t Accumulation-base = 30.72us t Accumulation = (t Accumulation-base /(Exe_VMM_PB))*N (N = 64) Exe_VMM_PB = Page buffer size/Required memory cells Request_Read = Req_VVM/ Exe_VMM_PB Computing time = Input_bit*(t Input_import ) + (Request_Read * (((Exe_VMM_PB/N) * (Input_bit*(t Logic-function then to CDL + t Accumulation ))) + t Internal-transfer )) = (4 * 30.72) + (8*(((64/64) * (4 * (5 + 30.72))) + 5)) ~= 1306us Strategy 2 : Assume the latency parameters = Req_VVM = 512 t Read = 70us, one-time t Input_import = 30.72us, Local t Logic-AND then to CDL = 1. 25us, t Internal-transfer = 5us, t Accumulation-base = 30.72us t Accumulation = (t Accumulation-base /(Exe_VMM_PB))*N (N = 16) Exe_VMM_PB = Page buffer size/Required memory cells Request_Read = Req_VVM/ Exe_VMM_PB Computing time = Input_bit*(t Input_import ) + (Request_Read * (((Exe_VMM_PB/N) * (Input_bit*(t Logic-function then to CDL + t Accumulation ))) + t Internal-transfer )) = (4 * 30.72) + (8*(((64/16) * (4 * (1.25 + 7.68))) + 5)) ~= 1306us Strategy 3 : Assume the latency parameters = Req_VVM = 51 2 t Read = 70us, one-time t Input_import = 30.72us, Local t Logic-AND then to CDL = 0.1us, t Internal-transfer = 5us, t Accumulation-base = 30.72us t Accumulation = (t Accumulation-base /(Exe_VMM_PB))*N (N = 1) Exe_VMM_PB = Page buffer size/Required memory cells Request_Read = Req_VVM/ Exe_VMM_PB Computing time = Input_bit*(t Input_import ) + (Request_Read * (((Exe_VMM_PB/N) * (Input_bit*(t Logic-function then to CDL + t Accumulation ))) + t Internal-transfer )) = (4 * 30.72) + (8*(((64/1) * (4 * (0.1 + 0.48))) + 5)) ~= 1351us

綜合上述,可以理解的是本揭露所提供之暫存器的數量與所需的循環(對翻轉結果中的各值進行加總以產生加總結果所需循環)的數量成反比。In summary, it can be understood that the number of registers provided by the present disclosure is inversely proportional to the number of cycles required (the number of cycles required to sum the values in the flip result to generate the summed result).

除了根據於本揭露多個實施例中結果加總單元中的暫存器的數量設計可根據需求調整,於本揭露多個實施例中累加器的輸出暫存器(例如第10圖中的輸出暫存器1047)也可根據於需求調整數量。例如,較少輸出暫存器具有較低成本,但需要記憶體裝置的控制器(如狀態機控制器,未於圖中示出)在運算還沒結束時,隨時將VVM輸出結果取出;較多輸出暫存器具有較高成本,但記憶體控制器可在運算完成後再將VVM輸出結果一併取出。In addition to the number of registers in the result summing unit in the various embodiments disclosed herein being designed to be adjustable according to demand, the number of output registers of the accumulator in the various embodiments disclosed herein (e.g., output register 1047 in FIG. 10 ) can also be adjusted according to demand. For example, fewer output registers have a lower cost, but require the controller of the memory device (e.g., the state machine controller, not shown in the figure) to fetch the VVM output result at any time before the operation is completed; more output registers have a higher cost, but the memory controller can fetch the VVM output result together after the operation is completed.

第11圖顯示根據本揭露另一實施例之記憶體裝置1100的累加器1140的架構的示意圖。前述的資料預處理(圖中未示)可將資料進行錯誤位元容忍(error-bit-tolerance)資料編碼後進行運算,以得到對應的部分結果。錯誤位元容忍資料編碼乃是使用輸入資料複製(duplication)及權重資料平坦化(flattening)技術。如圖中所示,累加器1140進一步可包括結果加總單元與移位加總單元(如移位加總單元1160),以對應處理被進行錯誤位元容忍資料編碼所運算出的部分結果。比較於本實施例與如第4圖所說明之實施例,可以得知本揭露之所述之累加器架構可大致相同,可經調整(如增加移位加總單元)後對應於不同的資料預處理(編碼)方式。圖中累加器1140中之其他元件之對應操作方式及功能類似於上述說明,於此不再贅述(如第1圖至第10圖之說明)。FIG. 11 is a schematic diagram showing the architecture of an accumulator 1140 of a memory device 1100 according to another embodiment of the present disclosure. The aforementioned data preprocessing (not shown) can perform operations after error-bit-tolerance data encoding to obtain corresponding partial results. Error-bit-tolerance data encoding uses input data duplication and weight data flattening technology. As shown in the figure, the accumulator 1140 may further include a result summing unit and a shift summing unit (such as shift summing unit 1160) to correspondingly process the partial results calculated by the error-bit-tolerance data encoding. Comparing this embodiment with the embodiment illustrated in FIG. 4 , it can be seen that the accumulator architecture described in the present disclosure can be substantially the same and can be adjusted (such as adding a shift-sum unit) to correspond to different data pre-processing (coding) methods. The corresponding operation methods and functions of other components in the accumulator 1140 in the figure are similar to those described above and will not be repeated here (such as the descriptions of FIG. 1 to FIG. 10 ).

第12圖顯示根據本揭露又另一實施例之記憶體裝置1200的累加器1240的架構的示意圖。除了前述配合計數器(counter-co-work)的操作架構,本揭露之累加器亦可應用於不同的操作架構,例如配合乒乓緩衝器(ping-pong buffer-co-work)的操作架構。如圖中所示,比較於如第4圖所說明之實施例,取代於計數器441,累加器1240進一步包括多個頁面緩衝器1231及頁面緩衝器1232,及多個權重及延伸單元1242及權重及延伸單元1243),以對應Page ADC(頁面類比數位轉換器)設計的架構。比較於本實施例與如第4圖所說明之實施例,可以得知本揭露之所述之累加器架構可大致相同,可調整(如增加多個頁面緩衝器及多個權重及延伸單元取代於計數器)後實施不同的累加運算架構。圖中累加器1240中之其他元件之對應操作方式及功能類似於上述說明,於此不再贅述(如第1圖至第10圖之說明)。FIG. 12 is a schematic diagram showing the architecture of an accumulator 1240 of a memory device 1200 according to yet another embodiment of the present disclosure. In addition to the aforementioned counter-co-working operation architecture, the accumulator of the present disclosure can also be applied to different operation architectures, such as a ping-pong buffer-co-working operation architecture. As shown in the figure, compared to the embodiment illustrated in FIG. 4 , instead of the counter 441, the accumulator 1240 further includes a plurality of page buffers 1231 and 1232, and a plurality of weight and extension units 1242 and 1243) to correspond to the architecture of Page ADC (Page Analog-to-Digital Converter) design. By comparing this embodiment with the embodiment illustrated in FIG. 4 , it can be seen that the accumulator architecture described in the present disclosure can be substantially the same and can be adjusted (such as adding multiple page buffers and multiple weight and extension units to replace the counter) to implement different accumulation operation architectures. The corresponding operation methods and functions of other components in the accumulator 1240 in the figure are similar to the above description and will not be repeated here (such as the description of FIG. 1 to FIG. 10 ).

第13圖顯示根據本揭露另一實施例之記憶體裝置1300的架構的示意圖。如圖所示,記憶體裝置1300,包括記憶體平面1311、記憶體平面1312、記憶體平面1313及記憶體平面1314,各記憶體平面(例如記憶體平面1311)包括晶胞陣列1310、頁面緩衝器1330、多工器1315及累加器1340。於此實施例中,由於各記憶體平面皆具有根據本揭露之多個實施例的累加器之架構,因此可在各記憶體平面直接執行VVM操作。圖中累加器1340中之其他元件之對應操作方式及功能類似於上述說明(如第1圖至第12圖之說明),於此不再贅述。FIG. 13 is a schematic diagram showing the architecture of a memory device 1300 according to another embodiment of the present disclosure. As shown in the figure, the memory device 1300 includes a memory plane 1311, a memory plane 1312, a memory plane 1313, and a memory plane 1314. Each memory plane (e.g., the memory plane 1311) includes a cell array 1310, a page buffer 1330, a multiplexer 1315, and an accumulator 1340. In this embodiment, since each memory plane has the architecture of the accumulator according to multiple embodiments of the present disclosure, VVM operations can be directly performed on each memory plane. The corresponding operation methods and functions of other components in the accumulator 1340 in the figure are similar to the above description (such as the description of Figures 1 to 12), and will not be repeated here.

第14圖顯示根據本揭露又另一實施例之記憶體裝置的架構的示意圖。如圖所示,記憶體裝置1400,包括記憶體平面1411、記憶體平面1412、記憶體平面1413及記憶體平面1414,各記憶體平面包括晶胞陣列1410、頁面緩衝器1430、多工器1415及計數器1441。而記憶體平面1411、記憶體平面1412、記憶體平面1413及記憶體平面1414耦接至累加器1440,且各記憶體平面可對應於不同的權重。在此配置中,具有不同權重的各記憶體平面,在執行VVM時,可先由各記憶體平面的計數器(如計數器1441)產生計數結果(如第5圖之計數結果520),而各平面之計數結果可先存放於累加器1440中的暫存器1442,再經由其他元件進行累加運算,以得到這些記憶體平面的整體累加結果(如第7圖之累加結果790)。圖中累加器1440中之其他元件之對應操作方式及功能類似於上述說明(如第1圖至第10圖之說明),於此不再贅述。FIG. 14 is a schematic diagram showing the architecture of a memory device according to yet another embodiment of the present disclosure. As shown in the figure, the memory device 1400 includes a memory plane 1411, a memory plane 1412, a memory plane 1413, and a memory plane 1414, each of which includes a cell array 1410, a page buffer 1430, a multiplexer 1415, and a counter 1441. The memory plane 1411, the memory plane 1412, the memory plane 1413, and the memory plane 1414 are coupled to an accumulator 1440, and each of the memory planes may correspond to a different weight. In this configuration, when executing VVM, each memory plane with different weights may first generate a counting result (such as the counting result 520 in FIG. 5 ) by the counter of each memory plane (such as the counter 1441), and the counting result of each plane may first be stored in the register 1442 in the accumulator 1440, and then accumulated by other components to obtain the overall accumulation result of these memory planes (such as the accumulation result 790 in FIG. 7 ). The corresponding operation methods and functions of other components in the accumulator 1440 in the figure are similar to the above description (such as the description of FIG. 1 to FIG. 10 ), and will not be repeated here.

第15圖顯示根據本揭露一實施例之累加器之操作方法1500的流程圖。於步驟S1501中,可藉由計數器(例如第4圖之計數器441),將運算產生的部分結果的多個位元中具有第一位元值(例如為1)的對應多個位元進行計數,以產生計數結果(例如第5圖之計數結果520)。接著,於步驟S1502中,藉由權重及延伸單元(例如第4圖之權重及延伸單元443)將計數結果中的各位元使用多個第二位元值(例如為0)延伸至預設位元數,產生位元延伸結果(例如第5圖之位元延伸結果530)。於步驟S1503中,根據權重及延伸資料表(例如第5圖之權重及延伸資料表550),將位元延伸結果中具有第一位元值(例如為1)的各位元,移動至預設位元數中的對應第W個位元,以產生權重結果(例如第5圖之權重結果540)。FIG. 15 is a flow chart of an operation method 1500 of an accumulator according to an embodiment of the present disclosure. In step S1501, a counter (e.g., counter 441 in FIG. 4) may be used to count the corresponding multiple bits of the multiple bits of the partial result generated by the operation that have the first bit value (e.g., 1) to generate a counting result (e.g., counting result 520 in FIG. 5). Then, in step S1502, each bit in the counting result is extended to a preset number of bits using multiple second bit values (e.g., 0) by a weight and extension unit (e.g., weight and extension unit 443 in FIG. 4) to generate a bit extension result (e.g., bit extension result 530 in FIG. 5). In step S1503, according to the weight and extension data table (e.g., weight and extension data table 550 in FIG. 5 ), each bit having the first bit value (e.g., 1) in the bit extension result is moved to the corresponding Wth bit in the default bit number to generate a weight result (e.g., weight result 540 in FIG. 5 ).

於步驟1504中,可藉由位元翻轉單元(例如第4圖之位元翻轉單元444),根據位元翻轉資料表(例如第6圖之位元翻轉資料表605)將權重結果中的對應各位元值中的各位元進行翻轉,以產生翻轉結果(例如第6圖之翻轉結果660),且位元翻轉資料表具有P個第一位元值(例如為1)。接著,於步驟1505中,可藉由結果加總單元(例如第4圖之結果加總單元445),將翻轉結果中的各值進行加總,以產生加總結果(例如第7圖之加總結果780)。最後於步驟S1506,可藉由偏位及加總單元(例如第4圖之偏位及加總單元446),將加總結果加上偏位值P以產生累加結果(例如第7圖之加總結果790)。In step 1504, the corresponding bits in the weight result may be flipped by a bit flip unit (e.g., the bit flip unit 444 of FIG. 4) according to a bit flip data table (e.g., the bit flip data table 605 of FIG. 6) to generate a flip result (e.g., the flip result 660 of FIG. 6), and the bit flip data table has P first bit values (e.g., 1). Then, in step 1505, the values in the flip result may be summed up by a result summing unit (e.g., the result summing unit 445 of FIG. 4) to generate a summed result (e.g., the summed result 780 of FIG. 7). Finally, in step S1506, the offset value P may be added to the summed result by a offset and summing unit (eg, the offset and summing unit 446 in FIG. 4 ) to generate a cumulative result (eg, the summed result 790 in FIG. 7 ).

本揭露的上述多個實施例可應用於需要運行VVM操作的IMC架構設計中,並且可運用於AI技術,例如但不受限於,完全連接層(fully-connection layer)、卷積層(convolution layer)、多層感知器(multiple layer Perceptron)、支援向量機器(support vector machine)等AI技術之中。The above-mentioned multiple embodiments of the present disclosure can be applied to the IMC architecture design that needs to run VVM operations, and can be applied to AI technologies, such as but not limited to, fully-connection layer, convolution layer, multiple layer perceptron, support vector machine and other AI technologies.

本本揭露的上述多個實施例不只可應用於應用取向的記憶體內運算(application-driven in-memory computing),也可應用於記憶體內搜尋(in-memory search)應用及高維度運算(hyperdimensional computing, HDC)等。The above-mentioned embodiments disclosed in the present invention can be applied not only to application-driven in-memory computing, but also to in-memory search applications and hyperdimensional computing (HDC).

雖然本文可說明許多細節,但此些細節不應解釋為對本發明的所主張或可主張的範疇的限制,而是解釋為針對特定實施例的特徵的說明。在分開之數個實施例中說明於本文中的某些特徵可亦在單一實施例中組合實施。相反地,說明於單一實施例中的各種特徵可亦分開地或以任何適合的子組合的方式在多個實施例中實施。再者,儘管數個特徵於上文可說明為以某些組合來作用且甚至最初按此來主張,但來自所主張的組合的一或多個特徵在一些情況下可從所述的組合排除(excised),且所主張的組合可針對次組合或次組合的變化。類似地,雖然數個操作在圖式中以特定次序來描繪,但不應將理解為此些操作須以所繪示的特定次序或以順序次序執行,或須執行所有所說明的操作以達成合乎期望的結果。Although many details may be described herein, these details should not be construed as limitations on the scope of the invention that is or may be claimed, but rather as descriptions of features directed to specific embodiments. Certain features described herein in separate embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in a single embodiment may also be implemented in multiple embodiments separately or in any suitable subcombination. Furthermore, although several features may be described above as acting in certain combinations and even initially claimed as such, one or more features from the claimed combinations may in some cases be excluded from the combinations, and the claimed combinations may be directed to subcombinations or variations of subcombinations. Similarly, while several operations are depicted in the drawings in a particular order, it should not be understood that such operations must be performed in the particular order depicted or in sequential order, or that all illustrated operations must be performed to achieve desirable results.

綜上所述,雖然本發明已以實施例揭露如上,然其並非用以限定本發明。本發明所屬技術領域中具有通常知識者,在不脫離本發明之精神和範圍內,當可作各種之更動與潤飾。因此,本發明之保護範圍當視後附之申請專利範圍所界定者為準。In summary, although the present invention has been disclosed as above by way of embodiments, it is not intended to limit the present invention. Those with ordinary knowledge in the technical field to which the present invention belongs can make various changes and modifications without departing from the spirit and scope of the present invention. Therefore, the scope of protection of the present invention shall be subject to the scope defined in the attached patent application.

100,200,300,800,900,1000,1100,1200,1300,1400:記憶體裝置 101,201,401,501:輸入 102,202,402,502:權重 110,210,310,810,910,1010,1110,1210,1310,1410:晶胞陣列 120,220:頁面 121:所選頁面 130,230,330,830,930,1030,1130,1230,1231,1232,1330,1430:頁面緩衝器 140,240,340,400,840,940,1040,1140,1240,1340,1440:累加器 241:移位加總 341,441,841,941,1041,1141,1341,1441:計數器 342,842,942,1042,1142,1161,1248,1342,1442,1449:暫存器 343,443,843,943,1043,1143,1242,1243,1245,1343,1443:權重及延伸單元 344,444,844,944,1044,1144,1244,1344,1444:位元翻轉單元 345,445,845,945,1045,1145,1245,1345,1445:結果加總單元 346,446,846,946,1046,1146,1246,1346,1446:偏位加總單元 347,447,847,947,1047,1147,1247,1347,1447:輸出暫存器 315,415,815,915,1015,1115,1215,1315,1415:多工器 500:權重及延伸 550:權重及延伸資料表 510:部分結果 520:計數結果 530:延伸結果 531:進位位元 540,640:權重結果 600:位元翻轉 605,805,905,1005,1105,1205,1305,1405:位元翻轉資料表 660,760:翻轉結果 700:結果加總 770:分組加總 780:加總結果 790:累加結果 1160:移位加總單元 1311,1312,1313,1314,1411,1412,1413,1414:記憶體平面 1500:操作方法 S1501,S1502,S1503,S1504,S1505,S1506:步驟 P:偏位值100,200,300,800,900,1000,1100,1200,1300,1400:Memory device 101,201,401,501:Input 102,202,402,502:Weight 110,210,310,810,910,1010,1110,1210,1310,1410:Cell array 120,220:Page 121:Selected page 130,230,330,830,930,1030,1130,1230,1231,1232,1330,1430:Page buffer 140,240,340,400,840,940,1040,1140,1240,1340,1440:Accumulator 241:Shift-to-sum 341,441,841,941,1041,1141,1341,1441:Counter 342,842,942,1042,1142,1161,1248,1342,1442,1449:Register 343,443,843,943,1043,1143,1242,1243,1245,1343,1443:Weight and extension unit 344,444,844,944,1044,1144,1244,1344,1444: Bit flip unit 345,445,845,945,1045,1145,1245,1345,1445: Result summing unit 346,446,846,946,1046,1146,1246,1346,1446: Bit summing unit 347,447,847,947,1047,1147,1247,1347,1447: Output register 315,415,815,915,1015,1115,1215,1315,1415: Multiplexer 500: Weight and extension 550: Weight and extension data table 510: Partial results 520: Count results 530: Extension results 531: Carry bit 540,640: Weight results 600: Bit flip 605,805,905,1005,1105,1205,1305,1405: Bit flip data table 660,760: Flip results 700: Result summation 770: Group summation 780: Sum results 790: Accumulated results 1160: Shift sum unit 1311,1312,1313,1314,1411,1412,1413,1414: Memory plane 1500: Operation method S1501, S1502, S1503, S1504, S1505, S1506: Steps P: Deviation value

第1圖顯示示例記憶體裝置的示意圖。 第2圖顯示示例記憶體裝置的累加器的架構的示意圖。 第3圖顯示根據本揭露一實施例之記憶體裝置的累加器的架構的示意圖。 第4圖顯示根據具有本揭露一實施例之累加器的記憶體裝置的架構的示意圖。 第5圖顯示根據本揭露一實施例之權重及延伸的操作示意圖。 第6圖顯示根據本揭露一實施例之位元翻轉的操作示意圖。 第7圖顯示根據本揭露一實施例之結果加總的操作示意圖。 第8圖顯示根據本揭露一實施例之記憶體裝置的累加器的示例匯流排頻寬設計的示意圖。 第9圖顯示根據本揭露一實施例之記憶體裝置的累加器的另一示例匯流排頻寬的示意圖。 第10圖顯示根據本揭露一實施例之記憶體裝置的累加器的結果加總單元的示例暫存器的示意圖。 第11圖顯示根據本揭露另一實施例之記憶體裝置的累加器的架構的示意圖。 第12圖顯示根據本揭露又另一實施例之記憶體裝置的累加器的架構的示意圖。 第13圖顯示根據本揭露另一實施例之記憶體裝置的架構的示意圖。 第14圖顯示根據本揭露又另一實施例之記憶體裝置的架構的示意圖。 第15圖顯示根據本揭露一實施例之累加器之操作方法的流程圖。 各圖式中相同的參考編號與名稱表示相同的元件。這也應理解圖式中所示的各種範例性實施例僅是說明性的表示,並不一定按比例繪製。 FIG. 1 shows a schematic diagram of an example memory device. FIG. 2 shows a schematic diagram of the architecture of an accumulator of an example memory device. FIG. 3 shows a schematic diagram of the architecture of an accumulator of a memory device according to an embodiment of the present disclosure. FIG. 4 shows a schematic diagram of the architecture of a memory device having an accumulator according to an embodiment of the present disclosure. FIG. 5 shows a schematic diagram of the operation of weight and extension according to an embodiment of the present disclosure. FIG. 6 shows a schematic diagram of the operation of bit flipping according to an embodiment of the present disclosure. FIG. 7 shows a schematic diagram of the operation of result summing according to an embodiment of the present disclosure. FIG. 8 shows a schematic diagram of an example bus width design of an accumulator of a memory device according to an embodiment of the present disclosure. FIG. 9 is a schematic diagram showing another example bus bandwidth of an accumulator of a memory device according to an embodiment of the present disclosure. FIG. 10 is a schematic diagram showing an example register of a result summing unit of an accumulator of a memory device according to an embodiment of the present disclosure. FIG. 11 is a schematic diagram showing a structure of an accumulator of a memory device according to another embodiment of the present disclosure. FIG. 12 is a schematic diagram showing a structure of an accumulator of a memory device according to yet another embodiment of the present disclosure. FIG. 13 is a schematic diagram showing a structure of a memory device according to yet another embodiment of the present disclosure. FIG. 14 is a schematic diagram showing a structure of a memory device according to yet another embodiment of the present disclosure. FIG. 15 is a flow chart showing an operation method of an accumulator according to an embodiment of the present disclosure. The same reference numbers and names in the various figures represent the same elements. It should also be understood that the various exemplary embodiments shown in the figures are merely illustrative representations and are not necessarily drawn to scale.

300:記憶體裝置 300: Memory device

310:晶胞陣列 310: Cell array

315:多工器 315:Multiplexer

330:頁面緩衝器 330: Page buffer

340:累加器 340:Accumulator

341:計數器 341:Counter

342:暫存器 342: Register

343:權重及延伸單元 343: Weight and extension unit

344:位元翻轉單元 344: Bit flip unit

345:結果加總單元 345: Result sum unit

346:偏位加總單元 346: offset summing unit

347:輸出暫存器 347: Output register

Claims (11)

一種用於記憶體內運算(in-memory computing)的累加器,包括: 一計數器(counter),用於將記憶體內運算產生的複數個部分結果的複數個位元中具有一第一位元值的對應該些位元進行計數,以產生一計數結果; 一權重及延伸(weighting and extension)單元,耦接至該計數器,用於將該計數結果中的各位元使用複數個第二位元值延伸至預設位元數,以產生一位元延伸結果,及用於根據一權重及延伸資料表,將該位元延伸結果中具有該第一位元值的各該些位元,移動至預設位元數中的對應第W個位元,以產生一權重結果; 一位元翻轉(bit-flip)單元,耦接至該權重及延伸單元,用於根據一位元翻轉資料表將該權重結果中的對應各位元值中的各位元進行翻轉,以產生一翻轉結果,且該位元翻轉資料表具有P個該第一位元值; 一結果加總單元(result summing)單元,耦接至該位元翻轉單元,用於將該翻轉結果中的各值進行加總,以產生一加總結果;以及 一偏位加總(bias add)單元,耦接至該結果加總單元,用於將該加總結果加上一偏位值以產生一累加結果,該偏位值為P, 其中, P及W為大於等於0的正整數。 An accumulator for in-memory computing comprises: A counter, for counting the corresponding bits having a first bit value in a plurality of bits of a plurality of partial results generated by the in-memory computing to generate a counting result; A weighting and extension unit, coupled to the counter, for extending each bit in the counting result to a preset bit number using a plurality of second bit values to generate a bit extension result, and for moving each bit having the first bit value in the bit extension result to the corresponding Wth bit in the preset bit number according to a weighting and extension data table to generate a weight result; A bit-flip unit, coupled to the weight and extension unit, is used to flip each bit in the corresponding bit value in the weight result according to a bit-flip data table to generate a flip result, and the bit-flip data table has P first bit values; A result summing unit, coupled to the bit-flip unit, is used to sum each value in the flip result to generate a summed result; and A bias add unit, coupled to the result summing unit, is used to add a bias value to the summed result to generate an accumulated result, and the bias value is P, Wherein, P and W are positive integers greater than or equal to 0. 如請求項1所述之累加器,其中,該計數器至該偏位加總單元間的一或多個匯流排的各者的一頻寬對應於資料的一權重及一輸入的N位元、M維度及一進位位元,N及M為大於等於1之整數。An accumulator as described in claim 1, wherein a bandwidth of each of the one or more buses between the counter and the offset summing unit corresponds to a weight of data and an input of N bits, M dimensions and a carry bit, N and M are integers greater than or equal to 1. 如請求項1所述之累加器,其中,該結果加總單元具有一或多個暫存器,該一或多個暫存器的數量與對該翻轉結果中的各該值進行加總以產生該加總結果所需的循環的數量成反比。An accumulator as described in claim 1, wherein the result summing unit has one or more registers, the number of which is inversely proportional to the number of cycles required to sum each of the values in the flipped result to generate the summed result. 如請求項1所述之累加器,其中,更包括另至少之一移位加總單元,以對應被進行錯誤位元容忍資料(error-bit-tolerance)編碼的資料。The accumulator as described in claim 1, further comprising at least one shift-and-sum unit corresponding to data encoded with error-bit-tolerance. 一種用於記憶體內運算(in-memory computing)記憶體裝置,包括: 複數個記憶體平面,該些記憶體平面之各者包括: 一晶胞陣列,用於儲存複數個權重; 一頁面緩衝器,耦接至該晶胞陣列,該頁面緩衝器用於讀取位於該晶胞陣列中的該些權重,並根據複數個輸入運算產生複數個部分結果; 一多工器,耦接至該頁面緩衝器,用於選擇輸出位於該頁面緩衝器中的該些部分結果;以及 如請求項1至4中任一項所述之累加器,耦接至該多工器。 A memory device for in-memory computing, comprising: A plurality of memory planes, each of the memory planes comprising: A cell array for storing a plurality of weights; A page buffer coupled to the cell array, the page buffer for reading the weights in the cell array and generating a plurality of partial results according to a plurality of input operations; A multiplexer coupled to the page buffer for selecting and outputting the partial results in the page buffer; and An accumulator as described in any one of claim items 1 to 4, coupled to the multiplexer. 一種用於記憶體內運算的記憶體裝置,包括: 複數個記憶體平面,該些記憶體平面之各者包括: 一晶胞陣列,用於儲存複數個權重; 一頁面緩衝器,耦接至該晶胞陣列,該頁面緩衝器用於讀取位於該晶胞陣列中的該些權重,並根據複數個輸入運算產生複數個部分結果; 一多工器,耦接至該頁面緩衝器,用於選擇輸出位於該頁面緩衝器中的該些部分結果;;以及 一計數器,耦接至該多工器,該計數器用於將被選擇的該些部分結果的複數個位元中具有一第一位元值的對應該些位元進行計數,以產生一計數結果;以及 一累加器,耦接至該些記憶體平面,該累加器包括: 一暫存器,用於暫存於各該些記憶體平面中的該些計數結果; 一權重及延伸單元,耦接至該暫存器,該權重及延伸單元用於將各該些計數結果中的各位元使用複數個第二位元值延伸一預設位元數,以產生一位元延伸結果,及用於根據一權重及延伸資料表,將該位元延伸結果中具有該第一位元值的各該些位元,移動至該預設位元數中的對應第W個位元,以產生一權重結果; 一位元翻轉單元,耦接至該權重及延伸單元,用於根據一位元翻轉資料表將該權重結果中的對應各位元值中的各位元進行翻轉,以產生一翻轉結果,且該位元翻轉資料表具有P個該第一位元值; 一結果加總單元,耦接至該位元翻轉單元,用於將該翻轉結果中的各值進行加總,以產生一加總結果;以及 一偏位加總單元,耦接至該結果加總單元,用於將該加總結果加上一偏位值以產生一累加結果,該偏位值為P, 其中, P及W為大於等於0的正整數。 A memory device for in-memory operations, comprising: A plurality of memory planes, each of which comprises: A cell array for storing a plurality of weights; A page buffer coupled to the cell array, the page buffer for reading the weights in the cell array and generating a plurality of partial results according to a plurality of input operations; A multiplexer coupled to the page buffer for selecting and outputting the partial results in the page buffer; ; and A counter coupled to the multiplexer, the counter being used to count the corresponding bits having a first bit value among the plurality of bits of the selected partial results to generate a counting result; and An accumulator coupled to the memory planes, the accumulator comprising: A register for temporarily storing the counting results in each of the memory planes; A weight and extension unit, coupled to the register, for extending each bit in each of the counting results by a preset bit number using a plurality of second bit values to generate a bit extension result, and for moving each bit having the first bit value in the bit extension result to the corresponding Wth bit in the preset bit number according to a weight and extension data table to generate a weight result; A bit flip unit, coupled to the weight and extension unit, for flipping each bit in the corresponding bit value in the weight result according to a bit flip data table to generate a flip result, and the bit flip data table has P first bit values; A result summing unit, coupled to the bit flipping unit, is used to sum the values in the flipping result to generate a summed result; and A bias summing unit, coupled to the result summing unit, is used to add a bias value to the summed result to generate an accumulated result, the bias value is P, wherein P and W are positive integers greater than or equal to 0. 如請求項6所述之記憶體裝置,其中,該累加器中複數個單元間的一或多個匯流排的各者的一頻寬對應於該些記憶體平面的數量O、輸入的N位元、M維度及一進位位元(carry bit),M、N及O為大於等於1之整數。A memory device as described in claim 6, wherein a bandwidth of each of one or more buses between a plurality of units in the accumulator corresponds to the number O of the memory planes, N bits of input, M dimension and a carry bit, and M, N and O are integers greater than or equal to 1. 如請求項6所述之記憶體裝置,其中,該結果加總單元具有一或多個暫存器,該一或多個暫存器的數量與對該翻轉結果中的各該值進行加總以產生該加總結果所需的循環的數量成反比。A memory device as described in claim 6, wherein the result summing unit has one or more registers, the number of which is inversely proportional to the number of cycles required to sum each of the values in the flip result to generate the summed result. 如請求項6所述之記憶體裝置, 其中,該累加器更包括另至少之一移位加總單元,以對應被進行錯誤位元容忍資料編碼的資料。A memory device as described in claim 6, wherein the accumulator further includes at least one shift-and-sum unit corresponding to data encoded with error-bit-tolerant data. 一種用於累加器之操作方法,包括: 將記憶體內運算產生的複數個部分結果的複數個位元中具有一第一位元值的對應該些位元進行計數,以產生一計數結果; 將該計數結果中的各位元使用複數個第二位元值延伸至一預設位元數,以產生一位元延伸結果; 根據一權重及延伸資料表,將該位元延伸結果中具有該第一位元值的各該些位元,移動至該預設位元數中的對應第W個位元,以產生一權重結果; 根據一位元翻轉資料表將該權重結果中的對應各位元值中的各位元進行翻轉,以產生一翻轉結果,且該位元翻轉資料表具有P個該第一位元值; 將該翻轉結果中的各值進行加總,以產生一加總結果;以及 將該加總結果加上一偏位值以產生一累加結果,該偏位值為P, 其中, P及W為大於等於0的正整數。 A method for operating an accumulator, comprising: Counting the corresponding bits having a first bit value in a plurality of bits of a plurality of partial results generated by calculation in a memory to generate a counting result; Extending each bit in the counting result to a preset bit number using a plurality of second bit values to generate a one-bit extension result; According to a weight and extension data table, moving each bit having the first bit value in the bit extension result to the corresponding Wth bit in the preset bit number to generate a weight result; Flipping each bit in the corresponding bit value in the weight result according to a one-bit flip data table to generate a flip result, and the bit flip data table has P first bit values; Adding up each value in the flip result to generate a summed result; and Add a bias value to the summed result to generate a cumulative result, the bias value is P, wherein, P and W are positive integers greater than or equal to 0. 如請求項10所述之操作方法,其中,對應被進行錯誤位元容忍資料編碼的資料,及根據該資料被運算產生的該些部分結果進行解碼及加總,以產生該加總結果。An operating method as described in claim 10, wherein data corresponding to the error bit tolerant data encoding and the partial results generated by the operation based on the data are decoded and summed to generate the summed result.
TW113105811A 2023-11-14 2024-02-19 Accumulator and memory device for in-memory computing and operation method thereof TWI852888B (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
US202363548546P 2023-11-14 2023-11-14
US63/548,546 2023-11-14

Publications (2)

Publication Number Publication Date
TWI852888B true TWI852888B (en) 2024-08-11
TW202520062A TW202520062A (en) 2025-05-16

Family

ID=93284186

Family Applications (1)

Application Number Title Priority Date Filing Date
TW113105811A TWI852888B (en) 2023-11-14 2024-02-19 Accumulator and memory device for in-memory computing and operation method thereof

Country Status (1)

Country Link
TW (1) TWI852888B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TW201826115A (en) * 2016-12-31 2018-07-16 大陸商上海兆芯集成電路有限公司 Neural network unit with array width segmentable rotator
TW201833823A (en) * 2017-03-03 2018-09-16 南韓商三星電子股份有限公司 Method of operating a neural network device
TW202143066A (en) * 2020-02-03 2021-11-16 美商安納富來希股份有限公司 Neural network unit and method for inferring an output and differential output from synapse array

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TW201826115A (en) * 2016-12-31 2018-07-16 大陸商上海兆芯集成電路有限公司 Neural network unit with array width segmentable rotator
TW201833823A (en) * 2017-03-03 2018-09-16 南韓商三星電子股份有限公司 Method of operating a neural network device
TW202143066A (en) * 2020-02-03 2021-11-16 美商安納富來希股份有限公司 Neural network unit and method for inferring an output and differential output from synapse array

Also Published As

Publication number Publication date
TW202520062A (en) 2025-05-16

Similar Documents

Publication Publication Date Title
US11625584B2 (en) Reconfigurable memory compression techniques for deep neural networks
JP7635909B2 (en) Energy-efficient computational near-memory binary neural network circuits
KR102780371B1 (en) Method for performing PIM (PROCESSING-IN-MEMORY) operations on serially allocated data, and related memory devices and systems
Zhu et al. A configurable multi-precision CNN computing framework based on single bit RRAM
US12056599B2 (en) Methods of performing processing-in-memory operations, and related devices and systems
Sim et al. Scalable stochastic-computing accelerator for convolutional neural networks
CN107832082A (en) A kind of apparatus and method for performing artificial neural network forward operation
Luo et al. AILC: Accelerate on-chip incremental learning with compute-in-memory technology
Roohi et al. Processing-in-memory acceleration of convolutional neural networks for energy-effciency, and power-intermittency resilience
CN114707648B (en) A software-hardware collaborative acceleration method for graph convolutional networks based on in-memory computing
CN108182959B (en) Method for realizing logic calculation based on crossing array structure of resistive device
US20220334800A1 (en) Exact stochastic computing multiplication in memory
Lin et al. AdaS: A fast and energy-efficient CNN accelerator exploiting bit-sparsity
US20230161556A1 (en) Memory device and operation method thereof
Ollivier et al. Pirm: Processing in racetrack memories
TW202321952A (en) Memory device and operation method thereof
TW202520062A (en) Accumulator and memory device for in-memory computing and operation method thereof
CN210006030U (en) data processor
JP2022552885A (en) Near memory data reduction
CN111258541A (en) Multiplier, data processing method, chip and electronic equipment
CN118092855A (en) Integrated storage and calculation multiplier supporting floating-point number mantissa multiplication and multiplication operation method
EP4107630B1 (en) Bit string accumulation
CN210109789U (en) data processor
Hsieh et al. MARSv2: Multicore and programmable reconstruction architecture SRAM CIM-based accelerator with lightweight network
CN110688087A (en) Data processor, method, chip and electronic device