IP Library › Granted Patent US 12,682,232
Granted Patent B1
US 12,682,232 · App. 17/935,419 · Granted Jul 14, 2026

Batch statistics acceleration

Inventors: Paul Gilbert Meyer (Jericho, VT); Sundeep Amirineni (Cedar Park, TX); Ron Diamant (San Jose, CA)
Assignee: Amazon Technologies, Inc.
G06N3/08G06F18/10
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 12,682,232
App. No.
17/935,419
Filed
Sep 26, 2022
Granted
Jul 14, 2026
Kind
B1
Art Unit
2141
USPC
706/15
Abstract

A technique to compute statistics of data elements include serially inputting the data elements into a compute channel. The compute channel can generate a first running mean and a first running variance associated with data elements of the vector having odd sequence indices, and a second running mean and a second running variance associated with data elements of the vector having even sequence indices. Subsequent to serially inputting data elements into the compute channel, the first running mean and the second running mean are aggregated to generate a mean associated with the data elements of the vector, and the first running variance and the second running variance are aggregated to generate a variance associated with the data elements of the vector.

Claims (54)

1 . A computer-implemented method comprising:

receiving an input tensor representing training data to train a neural network;

performing a normalization operation on the input tensor, the normalization operation including:

streaming data elements of a vector of the input tensor from a memory into a vector compute channel having a pipeline formed by coupling a set of compute stages in series;

computing a first running mean and a first running variance associated with data elements of the vector having odd sequence indices, and a second running mean and a second running variance associated with data elements of the vector having even sequence indices from a single pass of streaming the data elements into the vector compute channel;

aggregating the first running mean and the second running mean to compute a mean associated with the data elements of the vector, and aggregating the first running variance and the second running variance to compute a variance associated with the data elements of the vector; and

modifying the input tensor to generate a normalized input tensor based on the computed mean and the computed variance;

writing the normalized input tensor back to the memory; and

training the neural network using the normalized input tensor.

2 . The computer-implemented method of claim 1 , wherein the vector compute channel includes eight compute stages coupled in series in a pipeline.

3 . The computer-implemented method of claim 2 , wherein for each of the data elements streamed into the vector compute channel:

performing, at a first compute stage of the vector compute channel, multiplication of the data element with a reciprocal of a sequence index of the data element;

performing, at a second compute stage of the vector compute channel, subtraction of the reciprocal of the sequence index of the data element from a floating-point value of one;

performing, at a third compute stage of the vector compute channel, multiplication of an output of the second compute stage with a previous mean value computed for a previous data element of the vector;

performing, at a fourth compute stage of the vector compute channel, addition of an output of the third compute stage to an output of the second compute stage to compute a mean value for the data element;

performing, at a fifth compute stage of the vector compute channel, subtraction of the mean value from the data element;

performing, at a sixth compute stage of the vector compute channel, subtraction of the previous mean value from the data element;

performing, at a seventh compute stage of the vector compute channel, multiplication of an output of the fifth compute stage with an output of the sixth compute stage; and

performing, at an eighth compute stage of the vector compute channel, addition of a previous variance value computed for the previous data element to an output of the seventh compute stage to compute a variance value for the data element.

4 . The computer-implemented method of claim 1 , wherein the normalization operation includes streaming reciprocals of sequence indices from a parameters table into the vector compute channel in parallel with the data elements of the vector.

5 . A computer-implemented method comprising:

serially inputting data elements of a vector into a compute channel;

generating, in the compute channel, a first running mean and a first running variance associated with data elements of the vector having odd sequence indices, and a second running mean and a second running variance associated with data elements of the vector having even sequence indices; and

subsequent to serially inputting data elements into the compute channel:

aggregating the first running mean and the second running mean to generate a mean associated with the data elements of the vector; and

aggregating the first running variance and the second running variance to generate a variance associated with the data elements of the vector.

6 . The computer-implemented method of claim 5 , further comprising serially inputting reciprocals of sequence indices into the compute channel in parallel with the data elements of the vector.

7 . The computer-implemented method of claim 6 , wherein the reciprocals of sequence indices are inputted from a parameter table that is preloaded with the reciprocals.

8 . The computer-implemented method of claim 5 , wherein the compute channel includes a compute stage that toggles between updating the first running mean and updating the second running mean at each clock cycle.

9 . The computer-implemented method of claim 8 , wherein the compute stage includes:

a first feedback register to store the first running mean; and

a second feedback register to store the second running mean.

10 . The computer-implemented method of claim 5 , wherein the compute channel includes a compute stage that toggles between updating the first running variance and updating the second running variance at each clock cycle.

11 . The computer-implemented method of claim 10 , wherein the compute stage includes:

a first feedback register to store the first running variance; and

a second feedback register to store the second running variance.

12 . The computer-implemented method of claim 5 , further comprising outputting a first count of a number of the data elements of the vector having odd sequence indices, and outputting a second count of a number of the data elements of the vector having even sequence indices.

13 . An integrated circuit device comprising:

a plurality of compute stages coupled in series to form a compute channel,

wherein the compute channel is operable to:

serially receive data elements of a vector; and

generate a first running variance for data elements of the vector having odd sequence indices, and a second running variance for data elements of the vector having even sequence indices from a single pass of the data elements through the compute channel.

14 . The integrated circuit device of claim 13 , wherein one of the compute stages of the compute channel includes a first feedback register to store the first running variance, and a second feedback register to store the second running variance.

15 . The integrated circuit device of claim 13 , wherein the compute channel is operable to generate a first running mean for data elements of the vector having odd sequence indices, and a second running mean for the data elements of the vector having even sequence indices.

16 . The integrated circuit device of claim 15 , wherein one of the compute stages of the compute channel includes a first feedback register to store the first running mean; and a second feedback register to store the second running mean.

17 . The integrated circuit device of claim 13 , wherein the compute channel is operable to serially receive reciprocals of sequence indices in parallel with the data elements.

18 . The integrated circuit device of claim 17 , further comprising a parameter table that is preloaded with the reciprocals of sequence indices.

19 . The integrated circuit device of claim 13 , wherein the compute channel includes eight compute stages.

20 . A non-transitory computer readable medium having stored therein instructions that, when executed by one or more processors, cause the one or more processors to execute a compiler, the compiler performing operations comprising:

receiving a description of a neural network model;

determining that the neural network model includes a tensor normalization operation;

generating a batch statistics machine instruction to compute a first mean and a first variance associated with data elements of the tensor having odd sequence indices, and a second mean and a second variance associated with the data elements of the tensor having even sequence indices;

generating an aggregate machine instruction to compute a mean of the data elements by aggregating the first mean and the second mean, and a variance of the data elements by aggregating the first variance and the second variance; and

generating a tensor scale machine instruction to normalize the tensor based on the computed mean and the computed variance.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Sep 26, 2022
From: MEYER, PAUL GILBERT; AMIRINENI, SUNDEEP; DIAMANT, RON
To: AMAZON TECHNOLOGIES, INC.
Reel/Frame 061217/0625 →
References Cited (100)
US 4914614A · Yamakawa · 1990 [cited by applicant]
US 4959811A · Szczepanek · 1990 [cited by applicant]
US 5072418A · Boutaud et al. · 1991 [cited by applicant]
US 5117498A · Miller et al. · 1992 [cited by applicant]
US 5459681A · Harrison et al. · 1995 [cited by applicant]
US 5524251A · Urasaki · 1996 [cited by applicant]
US 6052773A · DeHon et al. · 2000 [cited by applicant]
US 6079623A · Ahn et al. · 2000 [cited by applicant]
US 6105105A · Trimberger · 2000 [cited by applicant]
US 6654730B1 · Kato et al. · 2003 [cited by applicant]
US 6757284B1 · Galles · 2004 [cited by applicant]
US 7755631B1 · Mrazek et al. · 2010 [cited by applicant]
US 8121235B1 · Sun et al. · 2012 [cited by applicant]
US 9081634B1 · Simkins et al. · 2015 [cited by applicant]
US 9495154B2 · Khan · 2016 [cited by applicant]
US 9710265B1 · Temam et al. · 2017 [cited by applicant]
US 10120580B2 · Olcay · 2018 [cited by applicant]
US 10157333B1 · Wang et al. · 2018 [cited by applicant]
US 10210860B1 · Ward et al. · 2019 [cited by applicant]
US 10592250B1 · Diamant et al. · 2020 [cited by applicant]
US 10831507B2 · Shah et al. · 2020 [cited by applicant]
US 10942742B1 · Diamant et al. · 2021 [cited by applicant]
US 11003429B1 · Zejda et al. · 2021 [cited by applicant]
US 11036827B1 · Zejda et al. · 2021 [cited by applicant]
US 11182337B1 · Maiyuran et al. · 2021 [cited by applicant]
US 11561791B2 · Das Sarma · 2023 [cited by examiner]
US 12072836B2 · Shah et al. · 2024 [cited by applicant]
US 12340300B1 · Abts et al. · 2025 [cited by applicant]
US 20040230784A1 · Cohen · 2004 [cited by applicant]
US 20050144215A1 · Simkins et al. · 2005 [cited by applicant]
US 20050273481A1 · Dent · 2005 [cited by applicant]
US 20060095739A1 · Selvaggi et al. · 2006 [cited by applicant]
US 20060212499A1 · New et al. · 2006 [cited by applicant]
US 20060230092A1 · Ching et al. · 2006 [cited by applicant]
US 20060253689A1 · Knowles · 2006 [cited by applicant]
US 20060288070A1 · Vadi et al. · 2006 [cited by applicant]
US 20070073922A1 · Go et al. · 2007 [cited by applicant]
US 20070240142A1 · Brokenshire et al. · 2007 [cited by applicant]
US 20090119460A1 · Lin et al. · 2009 [cited by applicant]
US 20090293048A1 · Chen et al. · 2009 [cited by applicant]
US 20120017066A1 · Vorbach et al. · 2012 [cited by applicant]
US 20130258376A1 · Tsuchiya · 2013 [cited by applicant]
US 20140317333A1 · Dorst et al. · 2014 [cited by applicant]
US 20150277924A1 · Zappulla et al. · 2015 [cited by applicant]
US 20180113006A1 · Tyrer · 2018 [cited by applicant]
US 20180253877A1 · Kozub et al. · 2018 [cited by applicant]
US 20180336164A1 · Phelps et al. · 2018 [cited by applicant]
US 20190034785A1 · Murray et al. · 2019 [cited by applicant]
US 20190042248A1 · Bradford et al. · 2019 [cited by applicant]
US 20190205737A1 · Bleiweiss et al. · 2019 [cited by applicant]
US 20190266217A1 · Arakawa et al. · 2019 [cited by applicant]
US 20190377580A1 · Vorbach et al. · 2019 [cited by applicant]
US 20200057748A1 · Danilak · 2020 [cited by applicant]
US 20200211189A1 · Yip et al. · 2020 [cited by applicant]
US 20200272882A1 · Lo · 2020 [cited by examiner]
US 20200311531A1 · Liu et al. · 2020 [cited by applicant]
US 20200342632A1 · Frumkin et al. · 2020 [cited by applicant]
US 20200356837A1 · Hargil et al. · 2020 [cited by applicant]
US 20200409664A1 · Li et al. · 2020 [cited by applicant]
US 20210073171A1 · Master et al. · 2021 [cited by applicant]
US 20210109796A1 · Fozard · 2021 [cited by examiner]
US 20210383199A1 · Weissenborn et al. · 2021 [cited by applicant]
US 20220229879A1 · Thouppuarachchi et al. · 2022 [cited by applicant]
US 20220283984A1 · Kim et al. · 2022 [cited by applicant]
US 20220284283A1 · Yin · 2022 [cited by examiner]
US 20220343137A1 · Surendran et al. · 2022 [cited by applicant]
US 20220405556A1 · Lichtenau · 2022 [cited by examiner]
US 20220414182A1 · Adelman et al. · 2022 [cited by applicant]
US 20230019151A1 · Ahmadi et al. · 2023 [cited by applicant]
US 20240193117A1 · Kapre et al. · 2024 [cited by applicant]
US 20240264975A1 · Li et al. · 2024 [cited by applicant]
US 20240303218A1 · Zhao et al. · 2024 [cited by applicant]
GB 2311882A · 1997 [cited by applicant]
Guo, R. et al., “How to Implement an Efficient LayerNorm CUDA Kernel—OneFlow Performance Optimization”, Dec. 2021, Medium, pp. 1-29 (Year: 2021). [cited by examiner]
Welford, B. P., “Note on a Method for Calculating Corrected Sums of Squares and Products”, Aug. 1962, CMU Statistics, Technometrics, pp. 1-2 (Year: 1962). [cited by examiner]
Kucukkabak, U. et al., “Design and Implementation of Reciprocal Unit Using Table Look-up and Newton-Raphson Iteration”, 2004, Proceedings of the EUROMICRO Systems on Digital System Design DSD'04, pp. 1-5 (Year: 2004). [cited by examiner]
Rakesh, “Average every 2 values in a list using a loop”, Jul. 2018, Stack Overflow, pp. 1-2 (Year: 2018). [cited by examiner]
Cook, J., “Accurately Computing Running Variance”, John D. Cook Consulting [blog], Nov. 1, 2014, pp. 1-3, URL: https://www.johndcook.com/blog/standard_deviation/ [retrieved on Feb. 8, 2023]. [cited by applicant]
Ioffe, S. et al., “Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift”, 32nd International Conference on Machine Learning (ICML 15), Mar. 2, 2015, pp. 1-11, URL: https://arxiv.o… [cited by applicant]
U.S. Non-Final Office Action dated Sep. 27, 2022 in U.S. Appl. No. 17/447,677. [cited by applicant]
U.S. Appl. No. 17/447,675, inventor Meyer, filed Sep. 14, 2021. [cited by applicant]
U.S. Appl. No. 17/447,677, inventor Meyer, filed Sep. 14, 2021. [cited by applicant]
U.S. Appl. No. 17/934,145, inventors Tan et al., filed Sep. 21, 2022. [cited by applicant]
U.S. Appl. No. 17/934,147, inventors Tan et al., filed Sep. 21, 2022. [cited by applicant]
U.S. Appl. No. 17/935,415, inventors Meyer et al., filed Sep. 26, 2022. [cited by applicant]
U.S. Appl. No. 17/937,329, inventors Meyer et al., filed Sep. 30, 2022. [cited by applicant]
U.S. Appl. No. 17/937,333, inventors Meyer et al., filed Sep. 30, 2022. [cited by applicant]
U.S. Appl. No. 17/937,335, inventors Meyer et al., filed Sep. 30, 2022. [cited by applicant]
Wikipedia [webpage], “Algorithms for calculating variance”, Mar. 24, 2001, pp. 1-14, URL: https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance [retrieved on Feb. 8, 2023]. [cited by applicant]
U.S. Non-Final Office Action dated Oct. 4, 2023, in U.S. Appl. No. 17/934,147. [cited by applicant]
U.S. Restriction Requirement dated Sep. 28, 2023, in U.S. Appl. No. 17/937,333. [cited by applicant]
Stack Overflow, “Search max value and index inside Nested list”, 2013, 3 pages, URL: https://stackoverflow.com/questions/18616793/search-max-value-and-index-inside-nested-list [retrieved on Feb. 27, 2023]. [cited by applicant]
Stack Overflow, “How do I get indices of N maximum values in a NumPy array?”, 2011, 16 pages, URL: https://stackoverflow.com/questions/6910641/how-do-i-get-indices-of-n-maximum-values-in-a-numpy-array [retrieved on Feb.… [cited by applicant]
U.S. Final Office Action dated Mar. 9, 2023 in U.S. Appl. No. 17/447,677. [cited by applicant]
U.S. Non-Final Office Action dated Jul. 17, 2023, in U.S. Appl. No. 17/447,677. [cited by applicant]
Jacob, J. A., et al., “Memory Interfacing and Instruction Specification for Reconfigurable Processors,” FPGA '99: Proc. of the 1999 ACM/SIGDA Seventh International Symposium on Field Programmable Gate Arrays, Feb. 1999,… [cited by applicant]
University of Illinois Urbana-Champaign, “Pipeline Motivation: Single-cycle datapath,” Sep. 2011, pp. 1-31, URL: https://courses.grainger.illinois.edu/cs232/fa2011/lectures/L11.pdf. [cited by applicant]
U.S. Appl. No. 19/017,173, inventors Meyer P.G. et al., filed Jan. 10, 2025. [cited by applicant]
Ba, J. L et al., “Layer Normalization,” arXiv: 1607.06450v1 [stat.ML], Jul. 21, 2016, pp. 1-14. [cited by applicant]
Wu, Y et al., “Group Normalization,” arXiv: 1803.08494v3 [cs.CV], Jun. 11, 2018, pp. 1-10. [cited by applicant]