KR20210064044A - Apparatus and method for performing artificial neural network inference in mobile terminal - Google Patents
Apparatus and method for performing artificial neural network inference in mobile terminal Download PDFInfo
- Publication number
- KR20210064044A KR20210064044A KR1020200132458A KR20200132458A KR20210064044A KR 20210064044 A KR20210064044 A KR 20210064044A KR 1020200132458 A KR1020200132458 A KR 1020200132458A KR 20200132458 A KR20200132458 A KR 20200132458A KR 20210064044 A KR20210064044 A KR 20210064044A
- Authority
- KR
- South Korea
- Prior art keywords
- neural network
- frequency
- artificial neural
- calculated
- processing unit
- Prior art date
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N5/00—Computing arrangements using knowledge-based models
- G06N5/04—Inference or reasoning models
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
Abstract
Description
본 발명은 모바일 단말기에서 인공 신경망 추론을 수행하기 위한 장치 및 방법에 관한 것이다.The present invention relates to an apparatus and method for performing artificial neural network inference in a mobile terminal.
일반적으로 딥러닝 신경망은 큰 구조를 가질수록 인공 신경망의 성능이 좋지만 추론(Inference)시 연산량이 많고 이에 따른 에너지 소모량이 많다.In general, the bigger the deep learning neural network, the better the performance of the artificial neural network, but the amount of computation and energy consumption are high during inference.
이러한 인공 신경망의 특성 때문에 상대적으로 하드웨어의 성능이 낮고 배터리 지속시간이 중요한 모바일 단말기에서 인공 신경망 추론이 필요할 시 서버로 데이터를 전송하여 인공 신경망 추론을 진행 후 결과를 모바일 단말기로 받아오는 방식으로 보완하고 있다.Due to these characteristics of artificial neural networks, when artificial neural network inference is required in mobile terminals with relatively low hardware performance and important battery life, data is transmitted to the server, artificial neural network inference is performed, and the results are received by the mobile terminal. have.
하지만 위와 같은 방식으로 인공 신경망 추론을 수행할 경우, 얼굴 인식 등과 같은 사용자의 개인정보를 이용한 인공 신경망 추론이 필요한 경우에는 보안상의 문제가 발생할 수 있고 네트워크 상황에 따른 데이터 전송 시간의 증가 등의 문제가 발생하므로 서버와 데이터를 주고 받는 형식이 아닌 모바일 단말기에서 직접 인공 신경망 추론을 하는 방식이 필요하다.However, when artificial neural network inference is performed in the above manner, when artificial neural network inference using user's personal information such as face recognition is required, security problems may occur, and problems such as increase in data transmission time according to network conditions Therefore, it is necessary to make artificial neural network inference directly from the mobile terminal rather than the form of exchanging data with the server.
본 발명의 일 실시예에 따른 해결하고자 하는 과제는, 모바일 단말기에서 인공 신경망 추론을 수행할 시에 연산량에 따라 프로세싱 유닛의 클럭 주파수를 조절하는 것을 포함한다.An object to be solved according to an embodiment of the present invention includes adjusting a clock frequency of a processing unit according to an amount of computation when performing artificial neural network inference in a mobile terminal.
본 명세서에 명시되지 않은 또 다른 목적들은 하기의 상세한 설명 및 그 효과로부터 용이하게 추론할 수 있는 범위 내에서 추가적으로 고려될 수 있다.Other objects not specified in this specification may be additionally considered within a range that can be easily inferred from the following detailed description and effects thereof.
상기 과제를 해결하기 위해, 본 발명의 일 실시예에 따른 모바일 단말기에서 인공 신경망 추론을 수행하기 위한 장치는, 모바일 단말기에 마련되며, 적어도 하나의 사용자 입력에 따라 인공 신경망 추론을 수행하기 위해 상기 인공 신경망의 구조 정보를 추출하는 구조 정보 추출부 및 프로세싱 유닛에 대한 부하 정보와 캐시 크기 정보를 입력 받고, 추출한 상기 인공 신경망의 구조 정보와 상기 부하 정보 및 캐시 크기 정보를 기반으로 기 지정된 목표 동작들 중 하나에 대하여 상기 프로세싱 유닛의 클럭 주파수를 결정하는 주파수 조절부를 포함한다.In order to solve the above problems, an apparatus for performing artificial neural network inference in a mobile terminal according to an embodiment of the present invention is provided in the mobile terminal, and the artificial neural network inference is performed according to at least one user input. Receives load information and cache size information for the structure information extractor and processing unit for extracting the structure information of the neural network, and among the target operations specified based on the extracted structure information of the artificial neural network, the load information, and the cache size information and a frequency adjuster for determining a clock frequency of the processing unit for one.
여기서, 상기 인공 신경망의 구조 정보는, 상기 인공 신경망 추론을 수행하는 연산에 필요한 행렬 크기를 포함하는 정보이다.Here, the structure information of the artificial neural network is information including the size of a matrix required for an operation for performing the artificial neural network inference.
여기서, 상기 구조 정보 추출부는, 상기 모바일 단말기의 어플리케이션 계층에서 구현된다.Here, the structure information extraction unit is implemented in the application layer of the mobile terminal.
여기서, 상기 주파수 조절부는, 상기 모바일 단말기의 커널 계층에서 구현된다.Here, the frequency adjusting unit is implemented in a kernel layer of the mobile terminal.
여기서, 상기 주파수 조절부는, 상기 인공 신경망의 구조 정보와 상기 프로세싱 유닛에 대한 상기 부하 정보를 이용하여 현재 연산중인 신경망 계층을 판단하는 신경망 계층 판단부를 포함한다.Here, the frequency adjusting unit includes a neural network layer determining unit that determines a currently operating neural network layer by using the structure information of the artificial neural network and the load information on the processing unit.
여기서, 상기 주파수 조절부는, 상기 현재 연산중인 신경망 계층의 구조와 상기 캐시 크기 정보를 고려하여 상기 현재 연산중인 신경망 계층에서 연산한 명령 개수 대비 메모리에 접근한 횟수인 메모리 접근 비용을 계산하는 메모리 접근 비용 계산부를 포함한다.Here, the frequency control unit, in consideration of the structure of the neural network layer currently being operated and the cache size information, calculates the memory access cost, which is the number of times the memory is accessed compared to the number of instructions computed in the neural network layer currently being computed. Includes calculator.
여기서, 상기 주파수 조절부는, 상기 메모리 접근 비용을 이용하여 상기 현재 연산중인 신경망 계층의 연산 시간을 주파수 별로 산출하고, 상기 주파수 별로 필요한 상기 프로세싱 유닛의 전력량을 산출하여, 상기 지정된 목표 동작들 중 하나에 대하여 상기 연산 시간과 상기 전력량에 따라 상기 프로세싱 유닛의 클럭 주파수를 결정하는 클럭 주파수 결정부를 포함한다.Here, the frequency control unit calculates the operation time of the neural network layer currently being calculated for each frequency using the memory access cost, calculates the amount of power of the processing unit required for each frequency, and performs one of the specified target operations. and a clock frequency determiner configured to determine a clock frequency of the processing unit according to the operation time and the amount of power.
여기서, 상기 클럭 주파수 결정부는, 상기 지정된 목표 동작들 중 하나에 대하여 상기 주파수 별로 산출된 연산 시간들 중 가장 짧은 연산 시간을 갖는 목표 주파수를 선택하여 상기 목표 주파수를 상기 클럭 주파수로 결정한다.Here, the clock frequency determiner may select a target frequency having a shortest calculation time among calculation times calculated for each frequency with respect to one of the designated target operations and determine the target frequency as the clock frequency.
본 발명의 또 다른 실시예에 따른 모바일 단말기에서 인공 신경망 추론을 수행하기 위한 장치는, 모바일 단말기의 어플리케이션 계층에서 구현되며, 적어도 하나의 사용자 입력에 따라 인공 신경망 추론을 수행 시 상기 인공 신경망에서 현재 연산중인 신경망 계층의 구조와 프로세싱 유닛의 캐시 크기 정보를 고려하여 상기 현재 연산중인 신경망 계층에서 연산한 명령 개수 대비 메모리에 접근한 횟수인 메모리 접근 비용을 계산하는 메모리 접근 비용 계산부 및 상기 메모리 접근 비용을 이용하여 상기 현재 연산중인 신경망 계층의 연산 시간을 주파수 별로 산출하고, 상기 주파수 별로 필요한 상기 프로세싱 유닛의 전력량을 산출하여, 상기 지정된 목표 동작들 중 하나에 대하여 상기 연산 시간과 상기 전력량에 따라 상기 프로세싱 유닛의 클럭 주파수를 결정하는 클럭 주파수 결정부를 포함한다.An apparatus for performing artificial neural network inference in a mobile terminal according to another embodiment of the present invention is implemented in an application layer of the mobile terminal, and when performing artificial neural network inference according to at least one user input, a current operation in the artificial neural network A memory access cost calculator that calculates the memory access cost, which is the number of times the memory is accessed compared to the number of instructions computed in the current neural network layer, in consideration of the structure of the neural network layer in progress and cache size information of the processing unit, and the memory access cost By using the calculation time of the neural network layer currently being calculated by frequency, the amount of power of the processing unit required for each frequency is calculated, and the processing unit according to the calculation time and the amount of power for one of the specified target operations. and a clock frequency determiner that determines the clock frequency of
여기서, 상기 클럭 주파수 결정부는, 상기 지정된 목표 동작들 중 하나에 대하여 상기 주파수 별로 산출된 연산 시간들 중 가장 짧은 연산 시간을 갖는 목표 주파수를 선택하여 상기 목표 주파수를 상기 클럭 주파수로 결정한다.Here, the clock frequency determiner may select a target frequency having a shortest calculation time among calculation times calculated for each frequency with respect to one of the designated target operations and determine the target frequency as the clock frequency.
본 발명의 또 다른 실시예에 따른 프로세싱 유닛과 메모리를 포함하는 인공 신경망 추론을 수행하기 위한 장치의 인공 신경망 추론을 수행하기 위한 방법에 있어서, 상기 인공 신경망 추론을 수행하고자 하는 인공 신경망의 구조 정보를 추출하는 단계, 상기 인공 신경망의 구조 정보와 상기 프로세싱 유닛에 대한 상기 부하 정보를 이용하여 현재 연산중인 신경망 계층을 판단하는 단계, 상기 현재 연산중인 신경망 계층의 구조와 상기 캐시 크기 정보를 고려하여 상기 현재 연산중인 신경망 계층에서 연산한 명령 개수 대비 상기 메모리에 접근한 횟수인 메모리 접근 비용을 계산하는 단계 및 상기 메모리 접근 비용을 이용하여 상기 현재 연산중인 신경망 계층의 연산 시간을 주파수 별로 산출하고, 상기 주파수 별로 필요한 상기 프로세싱 유닛의 전력량을 산출하여, 상기 지정된 목표 동작들 중 하나에 대하여 상기 연산 시간과 상기 전력량에 따라 상기 프로세싱 유닛의 클럭 주파수를 결정하는 단계를 포함하여 수행된다.In a method for performing artificial neural network inference of an apparatus for performing artificial neural network inference including a processing unit and a memory according to another embodiment of the present invention, the structure information of the artificial neural network to be performed artificial neural network inference is extracting, determining the neural network layer currently being computed using the structure information of the artificial neural network and the load information on the processing unit, considering the structure of the neural network layer currently being computed and the cache size information Calculating the memory access cost, which is the number of times the memory is accessed compared to the number of instructions calculated in the neural network layer being computed, and calculating the computation time of the neural network layer currently being computed for each frequency using the memory access cost, and for each frequency calculating an amount of power of the processing unit required, and determining a clock frequency of the processing unit according to the calculation time and the amount of power for one of the specified target operations.
여기서, 상기 프로세싱 유닛의 클럭 주파수를 결정하는 단계는, 상기 지정된 목표 동작들 중 하나에 대하여 상기 주파수 별로 산출된 연산 시간들 중 가장 짧은 연산 시간을 갖는 목표 주파수를 선택하여 상기 목표 주파수를 상기 클럭 주파수로 결정한다.Here, the determining of the clock frequency of the processing unit may include selecting a target frequency having a shortest calculation time among calculation times calculated for each frequency with respect to one of the specified target operations and setting the target frequency as the clock frequency. decide with
이상에서 설명한 바와 같이 본 발명의 실시예들에 의하면, 모바일 단말기에서 인공 신경망 추론을 수행할 시에 연산량에 따라 프로세싱 유닛의 클럭 주파수를 조절하여 에너지 소모량을 낮출 수 있다.As described above, according to the embodiments of the present invention, when performing artificial neural network inference in the mobile terminal, the amount of energy consumption can be reduced by adjusting the clock frequency of the processing unit according to the amount of computation.
이에 따라, 모바일 단말기에서 직접 인공 신경망 추론을 수행할 수 있다.Accordingly, artificial neural network inference can be performed directly in the mobile terminal.
여기에서 명시적으로 언급되지 않은 효과라 하더라도, 본 발명의 기술적 특징에 의해 기대되는 이하의 명세서에서 기재된 효과 및 그 잠정적인 효과는 본 발명의 명세서에 기재된 것과 같이 취급된다.Even if it is an effect not explicitly mentioned herein, the effect described in the following specification expected by the technical features of the present invention and the provisional effect thereof are treated as described in the specification of the present invention.
도 1 및 도 2는 본 발명의 일 실시예에 따른 모바일 단말기에서 인공 신경망 추론을 수행하기 위한 장치를 나타낸 블록도이다.
도 3 및 도 4는 본 발명의 또 다른 실시예에 따른 모바일 단말기에서 인공 신경망 추론을 수행하기 위한 장치를 나타낸 블록도이다.
도 5는 본 발명의 일 실시예에 따른 모바일 단말기에서 인공 신경망 추론을 수행하기 위한 방법을 나타낸 흐름도이다.
도 6은 본 발명의 또 다른 실시예에 따른 모바일 단말기에서 인공 신경망 추론을 수행하기 위한 방법을 나타낸 흐름도이다.1 and 2 are block diagrams illustrating an apparatus for performing artificial neural network inference in a mobile terminal according to an embodiment of the present invention.
3 and 4 are block diagrams illustrating an apparatus for performing artificial neural network inference in a mobile terminal according to another embodiment of the present invention.
5 is a flowchart illustrating a method for performing artificial neural network inference in a mobile terminal according to an embodiment of the present invention.
6 is a flowchart illustrating a method for performing artificial neural network inference in a mobile terminal according to another embodiment of the present invention.
이하, 본 발명에 관련된 모바일 단말기에서 인공 신경망 추론을 수행하기 위한 장치 및 방법에 대하여 도면을 참조하여 보다 상세하게 설명한다. 그러나, 본 발명은 여러 가지 상이한 형태로 구현될 수 있으며, 설명하는 실시예에 한정되는 것이 아니다. 그리고, 본 발명을 명확하게 설명하기 위하여 설명과 관계없는 부분은 생략되며, 도면의 동일한 참조부호는 동일한 부재임을 나타낸다.Hereinafter, an apparatus and method for performing artificial neural network inference in a mobile terminal according to the present invention will be described in more detail with reference to the drawings. However, the present invention may be implemented in various different forms, and is not limited to the described embodiments. In addition, in order to clearly describe the present invention, parts irrelevant to the description are omitted, and the same reference numerals in the drawings indicate the same members.
이하의 설명에서 사용되는 구성요소에 대한 접미사 "모듈" 및 "부"는 명세서 작성의 용이함만이 고려되어 부여되거나 혼용되는 것으로서, 그 자체로 서로 구별되는 의미 또는 역할을 갖는 것은 아니다.The suffixes "module" and "unit" for constituent elements used in the following description are given or used interchangeably in consideration of only the ease of preparation of the specification, and do not have meanings or roles that are distinguished from each other by themselves.
본 발명의 일 실시예는 모바일 단말기에서 인공 신경망 추론을 수행하기 위한 장치 및 방법에 관한 것이다.An embodiment of the present invention relates to an apparatus and method for performing artificial neural network inference in a mobile terminal.
도 1 및 도 2는 본 발명의 일 실시예에 따른 모바일 단말기에서 인공 신경망 추론을 수행하기 위한 장치를 나타낸 블록도이다.1 and 2 are block diagrams illustrating an apparatus for performing artificial neural network inference in a mobile terminal according to an embodiment of the present invention.
도 1을 참조하면, 본 발명의 일 실시예에 따른 모바일 단말기에서 인공 신경망 추론을 수행하기 위한 장치(10)는 구조 정보 추출부(110) 및 주파수 조절부(120)를 포함한다.Referring to FIG. 1 , an
본 발명의 일 실시예에 따른 모바일 단말기에서 인공 신경망 추론을 수행하기 위한 장치(10)는 모바일 단말기에서 사용자의 입력에 따라 인공 신경망 추론을 수행하는 경우 인공 신경망 구조에 따른 프로세싱 유닛의 클럭 주파수의 조절을 통해 에너지 효율적으로 인공 신경망 추론을 수행하기 위한 장치이다.The
여기서, 프로세싱 유닛은 CPU(Central Processing Unit), GPU(Graphic Processing Unit) 및 범용 그래픽 프로세싱 유닛(General Purpose Graphic Processing Unit, GPGPU)등을 포함하는 프로세서를 지칭한다.Here, the processing unit refers to a processor including a central processing unit (CPU), a graphic processing unit (GPU), and a general purpose graphic processing unit (GPGPU).
구조 정보 추출부(110)는 모바일 단말기에 마련되며, 적어도 하나의 사용자 입력에 따라 인공 신경망 추론을 수행하기 위해 인공 신경망의 구조 정보를 추출한다.The structure
여기서, 적어도 하나의 사용자 입력은 사용자가 모바일 단말기를 이용하여 특정 처리를 수행하기 위한 지시를 의미하며, 예를 들어 얼굴 인식, 사진 인식 및 지문 인식 등을 포함할 수 있다. 얼굴 인식 등과 같은 사용자의 개인정보를 이용한 인공 신경망 추론이 필요한 경우 보안상의 문제가 발생할 수 있고 네트워크 상황에 따른 데이터 전송 시간의 증가 등의 문제로 서버와 데이터를 주고 받는 형식이 아닌 모바일 단말기에서 직접 신경망 추론을 하는 방식이 필요하게 된다.Here, the at least one user input means an instruction for a user to perform a specific process using the mobile terminal, and may include, for example, face recognition, photo recognition, and fingerprint recognition. When artificial neural network inference using user's personal information such as face recognition is required, security problems may occur, and due to problems such as an increase in data transmission time according to network conditions, the neural network directly from the mobile terminal is not exchanged with the server. You need a way to make inferences.
본 발명의 일 실시예에 따른 모바일 단말기에서 인공 신경망 추론을 수행하기 위한 장치(10)는 서버와 데이터를 주고 받는 형식이 아닌 모바일 단말기에서 직접 신경망 추론을 하는 방식을 이용하기 위해 인공 신경망 구조에 따라 연산량을 계산하여, 프로세싱 유닛의 클럭 주파수의 조절을 통해 에너지 효율적으로 인공 신경망 추론을 수행할 수 있다.The
구체적으로, 인공 신경망의 구조 정보는, 인공 신경망 추론을 수행하는 연산에 필요한 행렬 크기를 포함하는 정보이다.Specifically, the structure information of the artificial neural network is information including the size of a matrix required for an operation for performing artificial neural network inference.
신경망 중에서 가장 대표적인 신경망인 합성곱 신경망에서 이미지의 중요한 특징을 추출해내는 역할을 하는 계층은 합성곱 계층(Convolutional Layer)이며, 합성곱(Convolution) 연산은 행렬 (3차원 또는 4차원) 곱셈 누산(Multiply-addition) 을 반복적으로 수행한다.In the convolutional neural network, which is the most representative neural network among neural networks, the layer that extracts important features of the image is the convolutional layer, and the convolution operation is a matrix (3D or 4D) multiplication and accumulation (Multiply). -addition) is repeated.
합성곱(Convolution) 연산 시 합성곱 필터(Convolutional Filter)를 반복적으로 곱셈 누산(Multiply-addition)에 사용하는데 이 필터의 크기가 CPU 또는 GPU 의 캐시 크기보다 클 경우 CPU 또는 GPU 가 메모리에 접근하는 횟수가 증가하게 되어 클럭 주파수를 높이더라도 메모리에 접근하는 시간을 기다려야 되기 때문에 클럭 주파수를 높이는 만큼 연산 시간이 줄어들지 않게 되고 클럭 주파수를 높임에 따라 발생하는 에너지 소모량은 증가하게 된다.In the case of convolution operation, the convolutional filter is repeatedly used for multiply-addition. If the size of this filter is larger than the cache size of the CPU or GPU, the number of times the CPU or GPU accesses the memory. is increased, so even if the clock frequency is increased, it is necessary to wait for the time to access the memory. Therefore, the calculation time does not decrease as much as the clock frequency is increased, and the energy consumption generated as the clock frequency is increased increases.
이에 따라, 본 발명의 일 실시예에 따른 모바일 단말기에서 인공 신경망 추론을 수행하기 위한 장치(10)는 합성곱(Convolution) 연산에 필요한 행렬 크기를 포함하는 정보를 추출하여 메모리에 접근하는 횟수를 미리 산출하여 클럭 주파수를 조절하게 된다.Accordingly, the
본 발명의 일 실시예에 따르면, 구조 정보 추출부(110)는 모바일 단말기의 어플리케이션 계층에서 구현되며, 주파수 조절부(120)는 모바일 단말기의 커널 계층에서 구현된다.According to an embodiment of the present invention, the
주파수 조절부(120)는 신경망 계층 판단부(121), 메모리 접근 비용 계산부(122) 및 클럭 주파수 결정부(123)를 포함한다.The
주파수 조절부(120)는 프로세싱 유닛에 대한 부하 정보와 캐시 크기 정보를 입력 받고, 추출한 인공 신경망의 구조 정보와 부하 정보 및 캐시 크기 정보를 기반으로 기 지정된 목표 동작들 중 하나에 대하여 프로세싱 유닛의 클럭 주파수를 결정한다.The
CPU를 예로 들어 설명하면, 안드로이드에서는 모바일 기기의 에너지 소모량을 줄이기 위해 DVFS(Dynamic Voltage & Frequency Scaling) 이라는 현재 CPU 에 요청된 일의 양에 따라 CPU의 클럭 주파수를 조절하는 기법을 사용하며, CPU의 클럭 주파수를 높일 경우 시간당 처리할 수 있는 연산량이 증가하지만 전력이 기하 급수적으로 높아져 에너지 소모량 역시 증가하고 반대로 클럭 주파수를 낮출 경우 연산량은 감소하지만 전력이 감소해 에너지 소모량 역시 감소하게 된다.Taking the CPU as an example, Android uses a technique called DVFS (Dynamic Voltage & Frequency Scaling) to adjust the clock frequency of the CPU according to the amount of work currently requested by the CPU to reduce the energy consumption of the mobile device. If the clock frequency is increased, the amount of calculations that can be processed per hour increases, but the power increases exponentially, so the energy consumption also increases. Conversely, if the clock frequency is lowered, the amount of calculations decreases but the power decreases and the energy consumption also decreases.
여기서 각 CPU 에서 클럭 주파수를 조절하는 역할을 하는 주체를 Governor 라고 하는데, 이 Governor가 현재 CPU에 요청된 일이 많을 경우 CPU 클럭 주파수를 높여서 일을 빠르게 처리하고 요청된 일이 거의 없을 경우 낮은 주파수로 조절해 에너지 소모량을 낮추게 된다. 기존의 안드로이드 Governor는 사용자의 반응성에 맞추어 설계되어 있기 때문에 이러한 신경망 연산의 특성을 잘 반영하고 있지 못하므로 에너지 소모량 측면에서 비효율적이다.Here, the subject that regulates the clock frequency in each CPU is called the Governor. When the current CPU receives a lot of requests, the governor increases the CPU clock frequency to process tasks faster, and when there are few requests, the governor switches to a lower frequency. control to reduce energy consumption. The existing Android Governor is inefficient in terms of energy consumption because it does not reflect the characteristics of neural network operation well because it is designed according to the user's responsiveness.
본 발명의 일 실시예에 따른 모바일 단말기에서 인공 신경망 추론을 수행하기 위한 장치(10)의 주파수 조절부(120)는 프로세싱 유닛에 대한 부하 정보와 캐시 크기 정보를 입력 받고, 추출한 인공 신경망의 구조 정보와 부하 정보 및 캐시 크기 정보를 기반으로 기 지정된 목표 동작들 중 하나에 대하여 프로세싱 유닛의 클럭 주파수를 결정하도록 설계되므로, 인공 신경망 연산의 특성을 반영할 수 있다.The
신경망 계층 판단부(121)는 인공 신경망의 구조 정보와 프로세싱 유닛에 대한 부하 정보를 이용하여 현재 연산중인 신경망 계층을 판단한다.The neural network
메모리 접근 비용 계산부(122)는 현재 연산중인 신경망 계층의 구조와 캐시 크기 정보를 고려하여 현재 연산중인 신경망 계층에서 연산한 명령 개수 대비 메모리에 접근한 횟수인 메모리 접근 비용을 계산한다.The memory access
클럭 주파수 결정부(123)는 메모리 접근 비용을 이용하여 현재 연산중인 신경망 계층의 연산 시간을 주파수 별로 산출하고, 주파수 별로 필요한 프로세싱 유닛의 전력량을 산출하여, 지정된 목표 동작들 중 하나에 대하여 연산 시간과 전력량에 따라 프로세싱 유닛의 클럭 주파수를 결정한다.The
클럭 주파수 결정부(123)는 지정된 목표 동작들 중 하나에 대하여 주파수 별로 산출된 연산 시간들 중 가장 짧은 연산 시간을 갖는 목표 주파수를 선택하여 목표 주파수를 클럭 주파수로 결정한다.The
도 2를 참조하면, 어플리케이션 계층은 응용 계층을 지칭하며, 구조 정보 추출부(110)는 신경망 구조 정보 추출 모듈(111)을 포함한다.Referring to FIG. 2 , an application layer refers to an application layer, and the structure
신경망 구조 정보 추출 모듈(111)은 응용 계층으로부터 신경망 추론 시작 전에 신경망 전체 구조에 대한 정보를 커널 계층에서 주파수 조절부가 필요로 하는 정보 형태로 추출하여 전달한다. 여기서, 주파수 조절부는 Governor를 포함한다.The neural network structure
신경망 계층 판단부(121)는 실시간 신경망 계층 판단 모듈(124)을 포함하며, 인공 신경망의 구조 정보와 프로세싱 유닛에 대한 부하 정보를 이용하여 현재 연산중인 신경망 계층을 판단한다.The neural network
본 발명의 일 실시예에 따르면, 응용 계층에서 신경망 구조 정보를 추출하고, 커널 계층으로 전달함에 따라, 응용 계층과 커널 계층 간에 정보를 실시간으로 주고 받음으로써 발생하는 지연 시간을 최소화할 수 있다.According to an embodiment of the present invention, as the neural network structure information is extracted from the application layer and transmitted to the kernel layer, the delay time caused by exchanging information between the application layer and the kernel layer in real time can be minimized.
실시간 신경망 계층 판단 모듈(124)는 현재 프로세싱 유닛에 대기 중인 연산의 종류(데이터 읽기/쓰기, 곱/합 연산 등)와 연산의 양과 아직 연산이 진행되지 않은 신경망 구조 정보(연산에 필요한 행렬 크기 등)를 비교하여 현재 연산중인 신경망 계층을 판단한다.The real-time neural network
메모리 접근 비용 계산부(122)는 메모리 접근 비용 계산 모듈(125)을 포함하며, 현재 연산중인 신경망 계층의 구조와 캐시 크기 정보를 고려하여 현재 연산중인 신경망 계층에서 연산한 명령 개수 대비 메모리에 접근한 횟수인 메모리 접근 비용을 계산한다.The memory access
여기서, 메모리 접근 비용은 Last-level cache misses/instructions으로 계산된다. 즉, 연산한 명령 개수 대비 메인 메모리에 접근한 횟수를 의미한다.Here, the memory access cost is calculated as Last-level cache misses/instructions. That is, it refers to the number of times the main memory is accessed compared to the number of instructions calculated.
구체적으로, 메모리 접근 비용은 신경망 계층 구조와 캐시 크기에 따라 달라지므로 현재 연산중인 신경망 계층 구조 정보와 프로세싱 유닛의 캐시 크기를 이용하여 예측한다. 만일, 캐시 크기가 작다면 동일한 신경망 계층 구조이더라도 메모리 접근 비용이 증가하게 되며, 신경망 계층 구조가 많은 양의 파라미터가 필요하거나 연산해야 할 행렬 크기가 큰 구조라면 동일한 캐시 크기에서도 다른 계층에 비해 메모리 접근 비용이 증가한다.Specifically, since the memory access cost varies depending on the neural network hierarchy and cache size, it is estimated using the neural network hierarchy information currently being computed and the cache size of the processing unit. If the cache size is small, the memory access cost increases even with the same neural network hierarchy, and if the neural network hierarchy requires a large amount of parameters or has a large matrix size to be computed, memory access compared to other layers even with the same cache size The cost increases.
메모리 접근 비용 계산 모듈(125)은 현재 연산중인 신경망 계층에 대한 정보를 이용해 메모리 접근 비용을 계산하여 클럭 주파수 결정부(123)의 연산 시간 예측 모듈(126)과 전력 예측 모듈(127)에 전달한다.The memory access
클럭 주파수 결정부(123)는 연산 시간 예측 모듈(126), 전력 예측 모듈(127) 및 주파수 조절 모듈(128)을 포함하며, 메모리 접근 비용을 이용하여 현재 연산중인 신경망 계층의 연산 시간을 주파수 별로 산출하고, 주파수 별로 필요한 프로세싱 유닛의 전력량을 산출하여, 지정된 목표 동작들 중 하나에 대하여 연산 시간과 전력량에 따라 프로세싱 유닛의 클럭 주파수를 결정한다.The
구체적으로, 연산 시간 예측 모듈(126)은 메모리 접근 비용을 이용해 현재 신경망의 연산에 필요한 연산 시간을 각 주파수별로 예측 후 주파수 조절 모듈(128)에 테이블 형태로 전달한다.Specifically, the calculation
여기서, 메모리 접근에 필요한 cycle 수는 모바일 기기에 따라 정해져 있기 때문에 전달 받은 메모리 접근 비용을 이용하여 연산 시간을 예측할 수 있다.Here, since the number of cycles required for memory access is determined according to the mobile device, the calculation time can be estimated using the received memory access cost.
예를 들어, 한 신경망 계층의 메모리 접근 비용이 0.01, 메모리 접근에 필요한 cycle 수가 10, 연산에 필요한 cycle 수가 1일 때, 신경망 연산에 필요한 명령의 개수가 10,000개라면 10,000 * 0.01 = 100 개의 명령이 메모리 접근에 필요한 명령의 개수이고 9,900 개의 명령이 연산의 개수라고 예측할 수 있다. 이에 따라 100 * 10 = 1000 cycle 이 메모리 접근에 필요한 cycle 회수이고 연산에 필요한 cycle 은 9900 * 1 = 9900 cycle 이라고 예측 가능하다. 프로세싱 유닛의 주파수는 시간당 cycle 의 회수이기 때문에 예측된 cycle 수와 주파수의 역수를 곱하게 된다면 연산 시간 예측이 가능하다.For example, if the memory access cost of one neural network layer is 0.01, the number of cycles required for memory access is 10, and the number of cycles required for operation is 1, if the number of instructions required for neural network operation is 10,000, 10,000 * 0.01 = 100 instructions. It is the number of instructions required to access memory, and it can be predicted that 9,900 instructions are the number of operations. Accordingly, it is predictable that 100 * 10 = 1000 cycles is the number of cycles required for memory access, and the cycle required for operation is 9900 * 1 = 9900 cycles. Since the frequency of the processing unit is the number of cycles per hour, it is possible to estimate the operation time by multiplying the predicted number of cycles by the reciprocal of the frequency.
전력 예측 모듈(127)은 각 주파수별로 필요한 프로세싱 유닛의 전력량을 주파수 조절 모듈(128)에 전달한다.The
클럭 주파수 결정부(123)는 지정된 목표 동작들 중 하나에 대하여 주파수 별로 산출된 연산 시간들 중 가장 짧은 연산 시간을 갖는 목표 주파수를 선택하여 목표 주파수를 클럭 주파수로 결정한다.The
지정된 목표 동작은 클럭 주파수를 효율적으로 조절하기 위해 설정된 동작이다. 구체적으로, 커널 계층과 응용 계층 모두에서, 주파수 조절 모듈(128)은 아래와 같은 지정된 목표 동작 중 하나를 달성하는 방향으로 클럭 주파수를 조절하여 프로세싱 유닛에 할당한다.The specified target operation is an operation set to efficiently adjust the clock frequency. Specifically, in both the kernel layer and the application layer, the
목표 동작은 다음과 같은 제1 목표 동작 내지 제4 목표 동작을 포함할 수 있다.The target motion may include the following first to fourth target motions.
제1 목표 동작은 최고 속도 연산으로, 연산 시간 예측 모듈로부터 받은 주파수별 연산 시간에서 달성할 수 있는 가장 빠른 속도의 클럭 주파수를 지정한다. 이때, 가장 짧은 연산 시간을 갖는 주파수를 할당하게 된다.The first target operation is the highest speed calculation, and the clock frequency of the fastest speed achievable in the calculation time for each frequency received from the calculation time prediction module is designated. In this case, the frequency having the shortest operation time is allocated.
제2 목표 동작은 최저 에너지 연산으로, 전력 예측 모듈로부터 받은 주파수별 전력과 연산 시간 예측 모듈로부터 받은 주파수별 연산 시간에서 달성할 수 있는 가장 적은 에너지로 지정한다. 이때, 전력과 연산 시간을 곱하면 에너지가 되는데 이 값이 가장 적은 주파수를 할당하게 된다.The second target operation is the lowest energy calculation and is designated as the lowest energy achievable in the frequency-specific power received from the power prediction module and the frequency-specific calculation time received from the calculation time prediction module. At this time, when power is multiplied by operation time, energy is obtained, and the frequency with the smallest value is allocated.
제3 목표 동작은 목표 속도에 맞춘 최저 에너지 연산으로, 현재 남은 계층 수, 종류 및 구조와 목표 속도를 고려한 현재 계층에서 허용 가능한 속도의 주파수 중 가장 낮은 에너지의 주파수를 지정한다.The third target operation is the lowest energy operation according to the target speed, and designates the lowest energy frequency among the frequencies of the allowable speed in the current layer considering the number, type and structure of the remaining layers and the target speed.
제4 목표 동작은 목표 에너지에 맞춘 최고 속도 연산으로, 현재 남은 계층 수, 종류 및 구조와 목표 에너지를 고려한 현재 계층에서 허용 가능한 에너지의 주파수 중 가장 낮은 속도의 주파수를 지정한다.The fourth target operation is the highest speed operation according to the target energy, and the lowest speed frequency among frequencies of energy allowable in the current layer in consideration of the number, type and structure of the remaining layers and the target energy is designated.
도 3 및 도 4는 본 발명의 또 다른 실시예에 따른 모바일 단말기에서 인공 신경망 추론을 수행하기 위한 장치를 나타낸 블록도이다.3 and 4 are block diagrams illustrating an apparatus for performing artificial neural network inference in a mobile terminal according to another embodiment of the present invention.
도 3을 참조하면, 본 발명의 또 다른 실시예에 따른 모바일 단말기에서 인공 신경망 추론을 수행하기 위한 장치(20)는 메모리 접근 비용 계산부(210) 및 클럭 주파수 결정부(220)를 포함한다.Referring to FIG. 3 , an apparatus 20 for performing artificial neural network inference in a mobile terminal according to another embodiment of the present invention includes a memory
본 발명의 또 다른 실시예에 따른 모바일 단말기에서 인공 신경망 추론을 수행하기 위한 장치(20)는 모바일 단말기에서 사용자의 입력에 따라 인공 신경망 추론을 수행하는 경우 인공 신경망 구조에 따른 프로세싱 유닛의 클럭 주파수의 조절을 통해 에너지 효율적으로 인공 신경망 추론을 수행하기 위한 장치이다.The apparatus 20 for performing artificial neural network inference in a mobile terminal according to another embodiment of the present invention is a clock frequency of a processing unit according to an artificial neural network structure when performing artificial neural network inference according to a user's input in the mobile terminal. It is a device for performing artificial neural network inference in an energy-efficient manner through regulation.
여기서, 프로세싱 유닛은 CPU(Central Processing Unit), GPU(Graphic Processing Unit) 및 범용 그래픽 프로세싱 유닛(General Purpose Graphic Processing Unit, GPGPU)등을 포함하는 프로세서를 지칭한다.Here, the processing unit refers to a processor including a central processing unit (CPU), a graphic processing unit (GPU), and a general purpose graphic processing unit (GPGPU).
본 발명의 또 다른 실시예에 따르면, 메모리 접근 비용 계산부(210) 및 클럭 주파수 결정부(220)는 모바일 단말기의 어플리케이션 계층에서 구현된다.According to another embodiment of the present invention, the memory
앞서 설명한 본 발명의 일 실시예에 따른 커널 계층에서 커널 주파수를 조절하는 점과 달리 본 발명의 또 다른 실시예에 따른 모바일 단말기에서 인공 신경망 추론을 수행하기 위한 장치(20)는 클럭 주파수 결정부(220)가 어플리케이션 계층에 있기 때문에 현재 연산중인 신경망 계층을 바로 알 수 있다.Unlike the point of adjusting the kernel frequency in the kernel layer according to the embodiment of the present invention described above, the apparatus 20 for performing artificial neural network inference in the mobile terminal according to another embodiment of the present invention includes a clock frequency determiner ( 220) is in the application layer, so you can immediately know the neural network layer that is currently being computed.
메모리 접근 비용 계산부(210)는 모바일 단말기의 어플리케이션 계층에서 구현되며, 적어도 하나의 사용자 입력에 따라 인공 신경망 추론을 수행 시 인공 신경망에서 현재 연산중인 신경망 계층의 구조와 프로세싱 유닛의 캐시 크기 정보를 고려하여 현재 연산중인 신경망 계층에서 연산한 명령 개수 대비 메모리에 접근한 횟수인 메모리 접근 비용을 계산한다.The memory
클럭 주파수 결정부(220)는 메모리 접근 비용을 이용하여 현재 연산중인 신경망 계층의 연산 시간을 주파수 별로 산출하고, 주파수 별로 필요한 프로세싱 유닛의 전력량을 산출하여, 지정된 목표 동작들 중 하나에 대하여 연산 시간과 전력량에 따라 프로세싱 유닛의 클럭 주파수를 결정한다.The
클럭 주파수 결정부(220)는 지정된 목표 동작들 중 하나에 대하여 주파수 별로 산출된 연산 시간들 중 가장 짧은 연산 시간을 갖는 목표 주파수를 선택하여 목표 주파수를 클럭 주파수로 결정한다.The
도 4를 참조하면, 어플리케이션 계층은 응용 계층을 지칭하며, 메모리 접근 비용 계산부(210)는 메모리 접근 비용 계산 모듈(211)을 포함하여, 적어도 하나의 사용자 입력에 따라 인공 신경망 추론을 수행 시 인공 신경망에서 현재 연산중인 신경망 계층의 구조와 프로세싱 유닛의 캐시 크기 정보를 고려하여 현재 연산중인 신경망 계층에서 연산한 명령 개수 대비 메모리에 접근한 횟수인 메모리 접근 비용을 계산한다.Referring to FIG. 4 , an application layer refers to an application layer, and the memory access
메모리 접근 비용 계산 모듈(211)은 현재 연산중인 신경망 계층에 대한 정보를 이용해 메모리 접근 비용을 계산하여 연산 시간 예측 모듈(221)과 전력 예측 모듈(222)에 전달한다.The memory access
여기서, 메모리 접근 비용은 Last-level cache misses/instructions으로 계산된다. 즉, 연산한 명령 개수 대비 메인 메모리에 접근한 횟수를 의미한다.Here, the memory access cost is calculated as Last-level cache misses/instructions. That is, it refers to the number of times the main memory is accessed compared to the number of instructions calculated.
구체적으로, 메모리 접근 비용은 신경망 계층 구조와 캐시 크기에 따라 달라지므로 현재 연산중인 신경망 계층 구조 정보와 프로세싱 유닛의 캐시 크기를 이용하여 예측한다. 만일, 캐시 크기가 작다면 동일한 신경망 계층 구조이더라도 메모리 접근 비용이 증가하게 되며, 신경망 계층 구조가 많은 양의 파라미터가 필요하거나 연산해야 할 행렬 크기가 큰 구조라면 동일한 캐시 크기에서도 다른 계층에 비해 메모리 접근 비용이 증가한다.Specifically, since the memory access cost varies depending on the neural network hierarchy and cache size, it is estimated using the neural network hierarchy information currently being computed and the cache size of the processing unit. If the cache size is small, the memory access cost increases even with the same neural network hierarchy, and if the neural network hierarchy requires a large amount of parameters or has a large matrix size to be computed, memory access compared to other layers even with the same cache size The cost increases.
클럭 주파수 결정부(220)는 연산 시간 예측 모듈(221), 전력 예측 모듈(222) 및 주파수 조절 모듈(223)을 포함하며, 메모리 접근 비용을 이용하여 현재 연산중인 신경망 계층의 연산 시간을 주파수 별로 산출하고, 주파수 별로 필요한 프로세싱 유닛의 전력량을 산출하여, 지정된 목표 동작들 중 하나에 대하여 연산 시간과 전력량에 따라 프로세싱 유닛의 클럭 주파수를 결정한다.The
연산 시간 예측 모듈(221)은 메모리 접근 비용을 이용해 현재 신경망의 연산에 필요한 연산 시간을 각 주파수별로 예측 후 주파수 조절 모듈(223)에 테이블 형태로 전달한다. 연산 시간 예측 방법은 도 2에서 설명한 방법을 이용하여 예측한다.The calculation
전력 예측 모듈(222)은 각 주파수별로 필요한 프로세싱 유닛의 전력량을 주파수 조절 모듈(223)에 전달한다.The
구체적으로, 프로세싱 유닛의 주파수별로 필요한 전력량은 미리 측정한 값을 토대로 테이블 형태로 저장한 뒤에 주파수별로 요청이 왔을 때 테이블에 저장된 값을 전달한다.Specifically, the amount of power required for each frequency of the processing unit is stored in the form of a table based on a previously measured value, and then the value stored in the table is transmitted when a request for each frequency is received.
주파수 조절 모듈(223)은 커널 계층으로부터 현재 프로세싱 유닛의 부하 정보를 받아 주파수 조절을 다음 페이지에서 제안하는 목표 동작을 달성하기 위해 동작한다.The
목표 동작은 다음과 같은 제1 목표 동작 내지 제4 목표 동작을 포함할 수 있다.The target motion may include the following first to fourth target motions.
제1 목표 동작은 최고 속도 연산으로, 연산 시간 예측 모듈로부터 받은 주파수별 연산 시간에서 달성할 수 있는 가장 빠른 속도의 클럭 주파수를 지정한다. 이때, 가장 짧은 연산 시간을 갖는 주파수를 할당하게 된다.The first target operation is the highest speed calculation, and the clock frequency of the fastest speed achievable in the calculation time for each frequency received from the calculation time prediction module is designated. In this case, the frequency having the shortest operation time is allocated.
제2 목표 동작은 최저 에너지 연산으로, 전력 예측 모듈로부터 받은 주파수별 전력과 연산 시간 예측 모듈로부터 받은 주파수별 연산 시간에서 달성할 수 있는 가장 적은 에너지로 지정한다. 이때, 전력과 연산 시간을 곱하면 에너지가 되는데 이 값이 가장 적은 주파수를 할당하게 된다.The second target operation is the lowest energy calculation and is designated as the lowest energy achievable in the frequency-specific power received from the power prediction module and the frequency-specific calculation time received from the calculation time prediction module. At this time, when power is multiplied by operation time, energy is obtained, and the frequency with the smallest value is allocated.
제3 목표 동작은 목표 속도에 맞춘 최저 에너지 연산으로, 현재 남은 계층 수, 종류 및 구조와 목표 속도를 고려한 현재 계층에서 허용 가능한 속도의 주파수 중 가장 낮은 에너지의 주파수를 지정한다.The third target operation is the lowest energy operation according to the target speed, and designates the lowest energy frequency among the frequencies of the allowable speed in the current layer considering the number, type and structure of the remaining layers and the target speed.
제4 목표 동작은 목표 에너지에 맞춘 최고 속도 연산으로, 현재 남은 계층 수, 종류 및 구조와 목표 에너지를 고려한 현재 계층에서 허용 가능한 에너지의 주파수 중 가장 낮은 속도의 주파수를 지정한다.The fourth target operation is the highest speed operation according to the target energy, and the lowest speed frequency among frequencies of energy allowable in the current layer in consideration of the number, type and structure of the remaining layers and the target energy is designated.
도 5는 본 발명의 일 실시예에 따른 모바일 단말기에서 인공 신경망 추론을 수행하기 위한 방법을 나타낸 흐름도이다.5 is a flowchart illustrating a method for performing artificial neural network inference in a mobile terminal according to an embodiment of the present invention.
도 5는 본 발명의 일 실시예에서 구조 정보 추출부(110)가 모바일 단말기의 어플리케이션 계층에서 구현되며, 주파수 조절부(120)가 모바일 단말기의 커널 계층에서 구현되는 경우에 인공 신경망 추론을 수행하기 위한 방법을 나타낸 것이다.5 is a diagram for performing artificial neural network inference when the
도 5를 참조하면, 본 발명의 일 실시예에 따른 모바일 단말기에서 인공 신경망 추론을 수행하기 위한 방법은 프로세싱 유닛과 메모리를 포함하는 인공 신경망 추론을 수행하기 위한 장치가 단계 S110에서 인공 신경망 추론을 수행하고자 하는 인공 신경망의 구조 정보를 추출한다.5 , in the method for performing artificial neural network inference in a mobile terminal according to an embodiment of the present invention, an apparatus for performing artificial neural network inference including a processing unit and a memory performs artificial neural network inference in step S110 Extract the structural information of the desired artificial neural network.
단계 S120에서 인공 신경망의 구조 정보와 프로세싱 유닛에 대한 부하 정보를 이용하여 현재 연산중인 신경망 계층을 판단한다.In step S120, the neural network layer currently being calculated is determined using the structure information of the artificial neural network and the load information on the processing unit.
단계 S130에서 현재 연산중인 신경망 계층의 구조와 캐시 크기 정보를 고려하여 현재 연산중인 신경망 계층에서 연산한 명령 개수 대비 메모리에 접근한 횟수인 메모리 접근 비용을 계산한다.In step S130, in consideration of the structure and cache size information of the neural network layer currently being calculated, the memory access cost, which is the number of times the memory is accessed compared to the number of instructions calculated in the neural network layer currently being computed, is calculated.
단계 S140에서 메모리 접근 비용을 이용하여 현재 연산중인 신경망 계층의 연산 시간을 주파수 별로 산출하고, 주파수 별로 필요한 프로세싱 유닛의 전력량을 산출하여, 지정된 목표 동작들 중 하나에 대하여 연산 시간과 전력량에 따라 프로세싱 유닛의 클럭 주파수를 결정한다.In step S140, by using the memory access cost, the calculation time of the neural network layer currently being calculated is calculated for each frequency, and the amount of power of the processing unit required for each frequency is calculated, and the processing unit according to the calculation time and power amount for one of the specified target operations. determines the clock frequency of
프로세싱 유닛의 클럭 주파수를 결정하는 단계(S140)는, 지정된 목표 동작들 중 하나에 대하여 주파수 별로 산출된 연산 시간들 중 가장 짧은 연산 시간을 갖는 목표 주파수를 선택하여 목표 주파수를 클럭 주파수로 결정한다.In the step of determining the clock frequency of the processing unit ( S140 ), a target frequency having the shortest calculation time among calculation times calculated for each frequency for one of the specified target operations is selected and the target frequency is determined as the clock frequency.
도 6은 본 발명의 또 다른 실시예에 따른 모바일 단말기에서 인공 신경망 추론을 수행하기 위한 방법을 나타낸 흐름도이다.6 is a flowchart illustrating a method for performing artificial neural network inference in a mobile terminal according to another embodiment of the present invention.
도 6은 본 발명의 또 다른 실시예에서, 메모리 접근 비용 계산부(210) 및 클럭 주파수 결정부(220)는 모바일 단말기의 어플리케이션 계층에서 구현되는 경우에 인공 신경망 추론을 수행하기 위한 방법을 나타낸 것이다.6 illustrates a method for performing artificial neural network inference when the memory
앞서 설명한 본 발명의 일 실시예에 따른 커널 계층에서 커널 주파수를 조절하는 점과 달리 본 발명의 또 다른 실시예에 따른 모바일 단말기에서 인공 신경망 추론을 수행하기 위한 장치(20)는 클럭 주파수 결정부(220)가 어플리케이션 계층에 있기 때문에 현재 연산중인 신경망 계층을 바로 알 수 있다.Unlike the point of adjusting the kernel frequency in the kernel layer according to the embodiment of the present invention described above, the apparatus 20 for performing artificial neural network inference in the mobile terminal according to another embodiment of the present invention includes a clock frequency determiner ( 220) is in the application layer, so you can immediately know the neural network layer that is currently being computed.
도 6을 참조하면, 본 발명의 또 다른 실시예에 따른 모바일 단말기에서 인공 신경망 추론을 수행하기 위한 방법은 프로세싱 유닛과 메모리를 포함하는 인공 신경망 추론을 수행하기 위한 장치가 단계 S210에서 현재 연산중인 신경망 계층의 구조와 캐시 크기 정보를 고려하여 현재 연산중인 신경망 계층에서 연산한 명령 개수 대비 메모리에 접근한 횟수인 메모리 접근 비용을 계산한다.Referring to FIG. 6 , in a method for performing artificial neural network inference in a mobile terminal according to another embodiment of the present invention, an apparatus for performing artificial neural network inference including a processing unit and a memory includes a neural network currently being operated in step S210 Considering the hierarchical structure and cache size information, calculate the memory access cost, which is the number of times memory is accessed compared to the number of instructions computed in the neural network layer currently being calculated.
단계 S220에서 메모리 접근 비용을 이용하여 현재 연산중인 신경망 계층의 연산 시간을 주파수 별로 산출하고, 주파수 별로 필요한 프로세싱 유닛의 전력량을 산출하여, 지정된 목표 동작들 중 하나에 대하여 연산 시간과 전력량에 따라 프로세싱 유닛의 클럭 주파수를 결정한다.In step S220, by using the memory access cost, the calculation time of the neural network layer currently being calculated is calculated for each frequency, and the amount of power of the processing unit required for each frequency is calculated, and the processing unit according to the calculation time and power amount for one of the specified target operations. determines the clock frequency of
프로세싱 유닛의 클럭 주파수를 결정하는 단계(S220)는, 지정된 목표 동작들 중 하나에 대하여 주파수 별로 산출된 연산 시간들 중 가장 짧은 연산 시간을 갖는 목표 주파수를 선택하여 목표 주파수를 클럭 주파수로 결정한다.In the step of determining the clock frequency of the processing unit ( S220 ), a target frequency having the shortest calculation time among calculation times calculated for each frequency for one of the specified target operations is selected and the target frequency is determined as the clock frequency.
본 발명의 또 다른 실시예에 따르면, 모바일 단말기에서 인공 신경망 추론을 수행하기 위한 방법을 실행하기 위한 프로그램을 기록한 컴퓨터 판독 가능한 기록매체를 제공할 수 있다.According to another embodiment of the present invention, it is possible to provide a computer-readable recording medium recording a program for executing a method for performing artificial neural network inference in a mobile terminal.
이상의 설명은 본 발명의 일 실시예에 불과할 뿐, 본 발명이 속하는 기술 분야에서 통상의 지식을 가진 자는 본 발명의 본질적 특성에서 벗어나지 않는 범위에서 변형된 형태로 구현할 수 있을 것이다. 따라서 본 발명의 범위는 전술한 실시예에 한정되지 않고 특허 청구 범위에 기재된 내용과 동등한 범위 내에 있는 다양한 실시 형태가 포함되도록 해석되어야 할 것이다.The above description is only an embodiment of the present invention, and those of ordinary skill in the art to which the present invention pertains may be implemented in a modified form without departing from the essential characteristics of the present invention. Therefore, the scope of the present invention is not limited to the above-described embodiments, and should be construed to include various embodiments within the scope equivalent to those described in the claims.
10: 모바일 단말기에서 인공 신경망 추론을 수행하기 위한 장치
110: 구조 정보 추출부
120: 주파수 조절부
121: 신경망 계층 판단부
122: 메모리 접근 비용 계산부
123: 클럭 주파수 결정부10: Apparatus for performing artificial neural network inference in a mobile terminal
110: structure information extraction unit
120: frequency control unit
121: neural network layer determination unit
122: memory access cost calculator
123: clock frequency determiner
Claims (12)
프로세싱 유닛에 대한 부하 정보와 캐시 크기 정보를 입력 받고, 추출한 상기 인공 신경망의 구조 정보와 상기 부하 정보 및 캐시 크기 정보를 기반으로 기 지정된 목표 동작들 중 하나에 대하여 상기 프로세싱 유닛의 클럭 주파수를 결정하는 주파수 조절부;를 포함하는 모바일 단말기에서 인공 신경망 추론을 수행하기 위한 장치.a structure information extraction unit provided in the mobile terminal and configured to extract structure information of the artificial neural network in order to perform artificial neural network inference according to at least one user input; and
receiving load information and cache size information for the processing unit, and determining the clock frequency of the processing unit for one of predetermined target operations based on the extracted structure information of the artificial neural network and the load information and cache size information A device for performing artificial neural network inference in a mobile terminal comprising a; frequency control unit.
상기 인공 신경망의 구조 정보는, 상기 인공 신경망 추론을 수행하는 연산에 필요한 행렬 크기를 포함하는 정보인 모바일 단말기에서 인공 신경망 추론을 수행하기 위한 장치.The method of claim 1,
An apparatus for performing artificial neural network inference in a mobile terminal, wherein the structure information of the artificial neural network is information including a matrix size required for an operation for performing the artificial neural network inference.
상기 구조 정보 추출부는, 상기 모바일 단말기의 어플리케이션 계층에서 구현되는 모바일 단말기에서 인공 신경망 추론을 수행하기 위한 장치.The method of claim 1,
The structure information extracting unit is an apparatus for performing artificial neural network inference in a mobile terminal implemented in an application layer of the mobile terminal.
상기 주파수 조절부는, 상기 모바일 단말기의 커널 계층에서 구현되는 모바일 단말기에서 인공 신경망 추론을 수행하기 위한 장치.The method of claim 1,
The frequency adjusting unit is an apparatus for performing artificial neural network inference in a mobile terminal implemented in a kernel layer of the mobile terminal.
상기 주파수 조절부는, 상기 인공 신경망의 구조 정보와 상기 프로세싱 유닛에 대한 상기 부하 정보를 이용하여 현재 연산중인 신경망 계층을 판단하는 신경망 계층 판단부;를 포함하는 모바일 단말기에서 인공 신경망 추론을 수행하기 위한 장치.The method of claim 1,
The frequency adjusting unit may include a neural network layer determination unit configured to determine a neural network layer currently being calculated by using the structure information of the artificial neural network and the load information on the processing unit; .
상기 주파수 조절부는, 상기 현재 연산중인 신경망 계층의 구조와 상기 캐시 크기 정보를 고려하여 상기 현재 연산중인 신경망 계층에서 연산한 명령 개수 대비 메모리에 접근한 횟수인 메모리 접근 비용을 계산하는 메모리 접근 비용 계산부;를 포함하는 모바일 단말기에서 인공 신경망 추론을 수행하기 위한 장치.The method of claim 5,
The frequency control unit, a memory access cost calculation unit for calculating a memory access cost that is the number of times the memory is accessed compared to the number of instructions calculated in the currently operating neural network layer in consideration of the cache size information and the structure of the neural network layer currently being operated A device for performing artificial neural network inference in a mobile terminal comprising a.
상기 주파수 조절부는, 상기 메모리 접근 비용을 이용하여 상기 현재 연산중인 신경망 계층의 연산 시간을 주파수 별로 산출하고, 상기 주파수 별로 필요한 상기 프로세싱 유닛의 전력량을 산출하여, 상기 지정된 목표 동작들 중 하나에 대하여 상기 연산 시간과 상기 전력량에 따라 상기 프로세싱 유닛의 클럭 주파수를 결정하는 클럭 주파수 결정부;를 포함하는 모바일 단말기에서 인공 신경망 추론을 수행하기 위한 장치.The method of claim 6,
The frequency adjusting unit calculates the operation time of the neural network layer currently being calculated for each frequency using the memory access cost, calculates the amount of power of the processing unit required for each frequency, and performs the calculation for one of the specified target operations. Apparatus for performing artificial neural network inference in a mobile terminal comprising a; clock frequency determiner to determine the clock frequency of the processing unit according to the calculation time and the amount of power.
상기 클럭 주파수 결정부는, 상기 지정된 목표 동작들 중 하나에 대하여 상기 주파수 별로 산출된 연산 시간들 중 가장 짧은 연산 시간을 갖는 목표 주파수를 선택하여 상기 목표 주파수를 상기 클럭 주파수로 결정하는 모바일 단말기에서 인공 신경망 추론을 수행하기 위한 장치.The method of claim 7,
The clock frequency determining unit is configured to select a target frequency having a shortest calculation time among calculation times calculated for each frequency with respect to one of the specified target operations and determine the target frequency as the clock frequency in the artificial neural network. A device for performing inference.
상기 메모리 접근 비용을 이용하여 상기 현재 연산중인 신경망 계층의 연산 시간을 주파수 별로 산출하고, 상기 주파수 별로 필요한 상기 프로세싱 유닛의 전력량을 산출하여, 지정된 목표 동작들 중 하나에 대하여 상기 연산 시간과 상기 전력량에 따라 상기 프로세싱 유닛의 클럭 주파수를 결정하는 클럭 주파수 결정부;를 포함하는 모바일 단말기에서 인공 신경망 추론을 수행하기 위한 장치.It is implemented in the application layer of the mobile terminal, and when performing artificial neural network inference according to at least one user input, the structure of the neural network layer currently being computed in the artificial neural network and cache size information of the processing unit are taken into account in the neural network layer currently being computed. a memory access cost calculator that calculates a memory access cost that is the number of accesses to the memory relative to the number of calculated instructions; and
Using the memory access cost, the calculation time of the neural network layer currently being calculated is calculated for each frequency, the amount of power of the processing unit required for each frequency is calculated, and the calculation time and the amount of power for one of the specified target operations are calculated. Apparatus for performing artificial neural network inference in a mobile terminal comprising a; clock frequency determiner to determine the clock frequency of the processing unit according to the.
상기 클럭 주파수 결정부는, 상기 지정된 목표 동작들 중 하나에 대하여 상기 주파수 별로 산출된 연산 시간들 중 가장 짧은 연산 시간을 갖는 목표 주파수를 선택하여 상기 목표 주파수를 상기 클럭 주파수로 결정하는 모바일 단말기에서 인공 신경망 추론을 수행하기 위한 장치.The method of claim 9,
The clock frequency determining unit is configured to select a target frequency having a shortest calculation time among calculation times calculated for each frequency with respect to one of the specified target operations and determine the target frequency as the clock frequency in the artificial neural network. A device for performing inference.
상기 인공 신경망 추론을 수행하고자 하는 인공 신경망의 구조 정보를 추출하는 단계;
상기 인공 신경망의 구조 정보와 상기 프로세싱 유닛에 대한 부하 정보를 이용하여 현재 연산중인 신경망 계층을 판단하는 단계;
상기 현재 연산중인 신경망 계층의 구조와 캐시 크기 정보를 고려하여 상기 현재 연산중인 신경망 계층에서 연산한 명령 개수 대비 상기 메모리에 접근한 횟수인 메모리 접근 비용을 계산하는 단계; 및
상기 메모리 접근 비용을 이용하여 상기 현재 연산중인 신경망 계층의 연산 시간을 주파수 별로 산출하고, 상기 주파수 별로 필요한 상기 프로세싱 유닛의 전력량을 산출하여, 지정된 목표 동작들 중 하나에 대하여 상기 연산 시간과 상기 전력량에 따라 상기 프로세싱 유닛의 클럭 주파수를 결정하는 단계;를 포함하여 수행되는 인공 신경망 추론을 수행하기 위한 방법.A method for performing artificial neural network inference of an apparatus for performing artificial neural network inference comprising a processing unit and a memory, the method comprising:
extracting structure information of an artificial neural network to which the artificial neural network inference is to be performed;
determining a neural network layer currently being calculated by using the structure information of the artificial neural network and load information on the processing unit;
calculating a memory access cost, which is the number of times the memory is accessed compared to the number of instructions calculated in the neural network layer currently being calculated, in consideration of the structure and cache size information of the neural network layer currently being calculated; and
Using the memory access cost, the calculation time of the neural network layer currently being calculated is calculated for each frequency, the amount of power of the processing unit required for each frequency is calculated, and the calculation time and the amount of power for one of the specified target operations are calculated. Determining the clock frequency of the processing unit according to; Method for performing artificial neural network inference performed including.
상기 프로세싱 유닛의 클럭 주파수를 결정하는 단계는, 상기 지정된 목표 동작들 중 하나에 대하여 상기 주파수 별로 산출된 연산 시간들 중 가장 짧은 연산 시간을 갖는 목표 주파수를 선택하여 상기 목표 주파수를 상기 클럭 주파수로 결정하는 인공 신경망 추론을 수행하기 위한 방법.The method of claim 11,
The determining of the clock frequency of the processing unit may include selecting a target frequency having a shortest calculation time among calculation times calculated for each frequency with respect to one of the specified target operations and determining the target frequency as the clock frequency A method for performing artificial neural network inference.
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
KR20190152092 | 2019-11-25 | ||
KR1020190152092 | 2019-11-25 |
Publications (2)
Publication Number | Publication Date |
---|---|
KR20210064044A true KR20210064044A (en) | 2021-06-02 |
KR102422545B1 KR102422545B1 (en) | 2022-07-20 |
Family
ID=76372921
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
KR1020200132458A KR102422545B1 (en) | 2019-11-25 | 2020-10-14 | Apparatus and method for performing artificial neural network inference in mobile terminal |
Country Status (1)
Country | Link |
---|---|
KR (1) | KR102422545B1 (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2023287108A1 (en) * | 2021-07-12 | 2023-01-19 | 주식회사 에너자이 | Method and system for indirectly estimating calculative execution speed of deep learning model |
CN117289897A (en) * | 2023-11-24 | 2023-12-26 | 南京美辰微电子有限公司 | Self-adaptive double-frequency multiply-add array suitable for neural network accelerator |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR101666549B1 (en) * | 2015-09-15 | 2016-10-17 | 인천대학교 산학협력단 | Method for dynamic frequency scailing of cpu in the computing device |
KR101755154B1 (en) * | 2016-04-27 | 2017-07-19 | 한양대학교 산학협력단 | Method and apparatus for power load balancing for heterogeneous processors |
US20170368682A1 (en) * | 2016-06-27 | 2017-12-28 | Fujitsu Limited | Neural network apparatus and control method of neural network apparatus |
US20190354159A1 (en) * | 2017-10-29 | 2019-11-21 | Shanghai Cambricon Information Technology Co., Ltd | Convolutional operation device and method |
-
2020
- 2020-10-14 KR KR1020200132458A patent/KR102422545B1/en active IP Right Grant
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR101666549B1 (en) * | 2015-09-15 | 2016-10-17 | 인천대학교 산학협력단 | Method for dynamic frequency scailing of cpu in the computing device |
KR101755154B1 (en) * | 2016-04-27 | 2017-07-19 | 한양대학교 산학협력단 | Method and apparatus for power load balancing for heterogeneous processors |
US20170368682A1 (en) * | 2016-06-27 | 2017-12-28 | Fujitsu Limited | Neural network apparatus and control method of neural network apparatus |
US20190354159A1 (en) * | 2017-10-29 | 2019-11-21 | Shanghai Cambricon Information Technology Co., Ltd | Convolutional operation device and method |
Non-Patent Citations (1)
Title |
---|
Li, Da, et al. Evaluating the energy efficiency of deep convolutional neural networks on CPUs and GPUs. 2016 IEEE BDCloud-SocialCom-SustainCom. IEEE. 2016.* * |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2023287108A1 (en) * | 2021-07-12 | 2023-01-19 | 주식회사 에너자이 | Method and system for indirectly estimating calculative execution speed of deep learning model |
CN117289897A (en) * | 2023-11-24 | 2023-12-26 | 南京美辰微电子有限公司 | Self-adaptive double-frequency multiply-add array suitable for neural network accelerator |
CN117289897B (en) * | 2023-11-24 | 2024-04-02 | 南京美辰微电子有限公司 | Self-adaptive double-frequency multiply-add array suitable for neural network accelerator |
Also Published As
Publication number | Publication date |
---|---|
KR102422545B1 (en) | 2022-07-20 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110070181A (en) | A kind of optimization method of the deep learning for edge calculations equipment | |
KR102422545B1 (en) | Apparatus and method for performing artificial neural network inference in mobile terminal | |
CN109074331B (en) | Power reduced memory subsystem with system cache and local resource management | |
CN110832434B (en) | Method and system for frequency regulation of a processor | |
Nabavinejad et al. | Coordinated batching and dvfs for dnn inference on gpu accelerators | |
WO2014092840A1 (en) | Closed loop cpu performance control | |
US20160342191A1 (en) | Cpu frequency scaling apparatus and method | |
CN109189323B (en) | Capacity expansion method and equipment | |
TWI704461B (en) | Memory device and information processing system | |
CN113645637B (en) | Method and device for unloading tasks of ultra-dense network, computer equipment and storage medium | |
US20170212581A1 (en) | Systems and methods for providing power efficiency via memory latency control | |
CN112862112A (en) | Federal learning method, storage medium, terminal, server, and federal learning system | |
Chuang et al. | An adaptive on-line CPU-GPU governor for games on mobile devices | |
Pan et al. | Scalable power management using multilevel reinforcement learning for multiprocessors | |
Singh et al. | A study on energy consumption of dvfs and simple vm consolidation policies in cloud computing data centers using cloudsim toolkit | |
Choi et al. | Graphics-aware power governing for mobile devices | |
CN116069152A (en) | Operation frequency control method, system and related equipment for AI (advanced technology attachment) computing cluster | |
Choi et al. | Optimizing energy efficiency of browsers in energy-aware scheduling-enabled mobile devices | |
US20180181188A1 (en) | Performance boosting method and system of semiconductor device | |
Zhou et al. | Deadline-aware deep-recurrent-q-network governor for smart energy saving | |
JP6297748B2 (en) | Processor state control based on detection of producer / consumer workload serialization | |
KR20190036307A (en) | Mobile devices using dynamic voltage and frequency scaling | |
Niknia et al. | An SMDP-based approach to thermal-aware task scheduling in NoC-based MPSoC platforms | |
CN108574600B (en) | Service quality guarantee method for power consumption and resource competition cooperative control of cloud computing server | |
CN110795323A (en) | Load statistical method, device, storage medium and electronic equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
E902 | Notification of reason for refusal | ||
E701 | Decision to grant or registration of patent right |