KR102641240B1 - Apparatus and Method for Artificial Intelligence Inference - Google Patents

Apparatus and Method for Artificial Intelligence Inference Download PDF

Info

Publication number
KR102641240B1
KR102641240B1 KR1020200120585A KR20200120585A KR102641240B1 KR 102641240 B1 KR102641240 B1 KR 102641240B1 KR 1020200120585 A KR1020200120585 A KR 1020200120585A KR 20200120585 A KR20200120585 A KR 20200120585A KR 102641240 B1 KR102641240 B1 KR 102641240B1
Authority
KR
South Korea
Prior art keywords
code
dsl
artificial intelligence
hardware
target code
Prior art date
Application number
KR1020200120585A
Other languages
Korean (ko)
Other versions
KR20210042012A (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 한국전자통신연구원
Priority to US17/767,364 priority Critical patent/US20220374740A1/en
Priority to PCT/KR2020/013250 priority patent/WO2021071160A1/en
Publication of KR20210042012A publication Critical patent/KR20210042012A/en
Application granted granted Critical
Publication of KR102641240B1 publication Critical patent/KR102641240B1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/06Physical realisation, i.e. hardware implementation of neural networks, neurons or parts of neurons
    • G06N3/063Physical realisation, i.e. hardware implementation of neural networks, neurons or parts of neurons using electronic means
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N5/00Computing arrangements using knowledge-based models
    • G06N5/04Inference or reasoning models

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Evolutionary Computation (AREA)
  • Mathematical Physics (AREA)
  • Biophysics (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Software Systems (AREA)
  • Biomedical Technology (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Molecular Biology (AREA)
  • General Health & Medical Sciences (AREA)
  • Neurology (AREA)
  • Devices For Executing Special Programs (AREA)

Abstract

실시예는 인공 지능 추론 장치 및 방법을 개시한다. 실시예는 인공 지능 추론 방법으로, 학습된 신경망 및 파라미터를 학습 프레임워크에 독립적인 상위 레벨 언어의 실행 코드로 변환하는 단계와, 실행 코드를 가속 연산 필요 여부에 따라 범용 언어(General Purpose Language, GPL) 코드와 도메인 특정 언어(Domain Specific Language, DSL) 코드로 분리하는 단계 및 분리된 GPL 코드 및 DSL 코드를 하드웨어에 최적화된 타겟 코드로 생성하는 단계를 포함할 수 있다. Embodiments disclose artificial intelligence reasoning devices and methods. The embodiment is an artificial intelligence inference method, which includes converting the learned neural network and parameters into executable code of a high-level language independent of the learning framework, and converting the executable code into a general purpose language (General Purpose Language, GPL) depending on whether accelerated operations are needed. ) It may include separating the code into a domain specific language (Domain Specific Language, DSL) code and generating the separated GPL code and DSL code into a target code optimized for hardware.

Figure R1020200120585
Figure R1020200120585

Description

인공 지능 추론 장치 및 방법{Apparatus and Method for Artificial Intelligence Inference}Artificial Intelligence Inference Apparatus and Method {Apparatus and Method for Artificial Intelligence Inference}

실시 예는 신경망(Neural Network)을 임베디드 시스템 환경에서 실행시키는 인공 지능 추론 기술에 관한 것이다. The embodiment relates to artificial intelligence inference technology that runs a neural network in an embedded system environment.

국내 외에 인공 신경망 기반 딥러닝 기술이 활발히 연구되어 왔고, 자율주행자동차, 무인 이동체, 영상 처리 장치, 공장 자동화 등의 다양한 임베디드 환경으로 적용 범위를 확대하고 있다. Artificial neural network-based deep learning technology has been actively researched outside of Korea, and its scope of application is expanding to various embedded environments such as self-driving cars, unmanned vehicles, image processing devices, and factory automation.

딥러닝을 적용한 응용은 학습과 추론 과정으로 이루지는데, 학습된 딥러닝을 임베디드 환경에서 실제로 동작시키는 추론 시스템은 인공지능 응용에 특화된 하드웨어 장치를 제작하고, 제작된 하드웨어에 맞추어 추론 엔진 및 응용 시스템을 만드는 과정으로 이루어진다. 하드웨어를 제작하는 과정에서는 딥러닝 처리를 위한 가속기를 설치하여 연산 성능을 높이게 되는데, 추론 엔진은 딥러닝 가속기를 포함하여 해당 하드웨어에 최적화되도록 설계된다. Applications using deep learning consist of learning and inference processes. The inference system that actually operates the learned deep learning in an embedded environment manufactures hardware devices specialized for artificial intelligence applications, and develops an inference engine and application system according to the manufactured hardware. It consists of a making process. In the process of manufacturing hardware, accelerators for deep learning processing are installed to increase computational performance, and the inference engine is designed to be optimized for the hardware, including deep learning accelerators.

그런데 이럴 경우, 소프트웨어 및 코드의 재사용성과 유지 보수 측면에서 많은 비용을 야기할 수 있기 때문에, 하드웨어에 독립적으로 동작하는 추론 시스템을 설계할 필요가 있다. 특히 인공지능 응용의 경우, 인공지능의 병렬 연산량을 고려하여 하드웨어 환경을 선택하게 되는데, CPU, GPU, FPGA, 전용 가속기 등 다양한 가속 하드웨어가 고려되고, 또한 한 종류가 아닌 다양한 종류의 가속기들이 동시에 사용되기도 한다. 이와 같이 추론 시스템은 다양한 하드웨어 가속 하드웨어 환경에 종속되는 구조로 설계되어 있기 때문에 매번 선택된 하드웨어 환경에 최적화된 모델을 구축하기 위해 많은 시간과 노력이 필요하게 된다. However, in this case, it is necessary to design an inference system that operates independently of hardware because it can result in high costs in terms of reusability and maintenance of software and code. In particular, in the case of artificial intelligence applications, the hardware environment is selected considering the amount of parallel computing of artificial intelligence. Various acceleration hardware such as CPU, GPU, FPGA, and dedicated accelerators are considered, and various types of accelerators are used simultaneously, not just one type. It can also happen. In this way, because the inference system is designed to be dependent on various hardware acceleration hardware environments, a lot of time and effort is required to build a model optimized for the selected hardware environment each time.

한국공개특허 10-2018-0028967호Korean Patent Publication No. 10-2018-0028967

실시예는 다양한 하드웨어 환경을 가지는 임베디드 시스템에서 인공지능 응용응 구현을 용이하게 하는데 그 목적이 있다. The purpose of the embodiment is to facilitate the implementation of artificial intelligence applications in embedded systems with various hardware environments.

본 발명은 딥러닝을 가속시키는 추론 엔진을 개발함에 있어서 하드웨어 변경에 따른 추론 엔진의 변경을 최소화하는데 그 목적이 있다. The purpose of the present invention is to minimize changes to the inference engine due to hardware changes in developing an inference engine that accelerates deep learning.

실시예는 인공 지능 추론 방법으로, 미리 학습된 신경망을 기반으로 하는 응용을 학습 프레임워크에 독립적인 상위 레벨 언어의 실행 코드로 변환하는 단계와, 실행 코드를 가속 연산 필요 여부에 따라 범용 언어(General Purpose Language, GPL) 코드와 도메인 특정 언어(Domain Specific Language, DSL) 코드로 분리하는 단계 및 분리된 GPL 코드 및 DSL 코드를 하드웨어에 최적화된 타겟 코드로 생성하는 단계를 포함한다. The embodiment is an artificial intelligence inference method, which includes converting an application based on a pre-trained neural network into executable code of a high-level language independent of the learning framework, and converting the executable code into a general-purpose language (General) depending on whether accelerated operations are needed. It includes steps of separating the Purpose Language (GPL) code and Domain Specific Language (DSL) code and generating the separated GPL code and DSL code into target code optimized for hardware.

이때, 분리하는 단계는, 실행 코드를 분석한 결과 연산 중심 명령어인지의 여부에 따라 GPL 코드 및 DSL 코드로 생성할 수 있다.At this time, the separation step can be generated as GPL code or DSL code depending on whether or not it is a calculation-oriented instruction as a result of analyzing the executable code.

이때, 분리하는 단계는, 연산 중심 명령어인지를 판단함에 있어, 실행 코드를 렉시칼 분석 및 구문 분석한 결과를 기반으로 검사하는 것일 수 있다.At this time, the separating step may be checking based on the results of lexical analysis and parsing of the executable code to determine whether it is an operation-oriented instruction.

이때, 타겟 코드를 생성하는 단계는, GPL 코드를 하드웨어의 CPU에서 실행되는 타겟 코드로 생성하는 것일 수 있다. At this time, the step of generating the target code may be generating the GPL code as a target code that runs on the CPU of the hardware.

이때, 타겟 코드를 생성하는 단계는, DSL 코드를 분석한 결과 또는 하드웨어의 가속기 구성 상태를 기반으로 하드웨어의 CPU 또는 가속기에서 실행되는 타겟 코드로 생성하는 것일 수 있다. At this time, the step of generating the target code may be to generate a target code that runs on the CPU or accelerator of the hardware based on the result of analyzing the DSL code or the accelerator configuration state of the hardware.

이때, 타겟 코드를 생성하는 단계는, DSL 코드를 분석한 결과 가속 환경에 유리할 경우, DSL 분리 규칙을 적용하여 타겟 코드를 생성하는 것일 수 있다.At this time, the step of generating the target code may be to generate the target code by applying the DSL separation rule if it is advantageous for an acceleration environment as a result of analyzing the DSL code.

이때, 타겟 코드를 생성하는 단계는, 하드웨어에 가속기가 존재할 경우, DSL 분리 규칙을 적용하여 타겟 코드를 생성하는 것일 수 있다.At this time, the step of generating the target code may be generating the target code by applying the DSL separation rule if an accelerator exists in the hardware.

이때, 타겟 코드를 생성하는 단계는, 하드웨어에 복수의 가속기들의 종류가 상이할 경우, 가속기 종류별로 DSL 분리 규칙을 적용하는 것일 수 있다.At this time, the step of generating the target code may be to apply DSL separation rules for each type of accelerator when the types of a plurality of accelerators in the hardware are different.

이때, 타겟 코드를 생성하는 단계는, 하드웨어에 동종 가속기들이 복수개 존재할 경우, 동종 가속기 환경 내에서 복수의 가속기들에 대한 DSL 분리 규칙을 적용하는 것일 수 있다.At this time, the step of generating the target code may be to apply the DSL separation rule to the plurality of accelerators within the same accelerator environment when a plurality of the same accelerators exist in the hardware.

실시예는 인공 지능 추론 장치로, 적어도 하나의 프로그램이 기록된 메모리 및 프로그램을 실행하는 프로세서를 포함하며, 프로그램은, 미리 학습된 신경망을 기반으로 하는 응용을 학습 프레임워크에 독립적인 상위 레벨 언어의 실행 코드로 변환하는 단계, 실행 코드를 가속 연산 필요 여부에 따라 범용 언어(General Purpose Language, GPL) 코드와 도메인 특정 언어(Domain Specific Language, DSL) 코드로 분리하는 단계 및 분리된 GPL 코드 및 DSL 코드를 하드웨어에 최적화된 타겟 코드로 생성하는 단계를 수행할 수 있다.An embodiment is an artificial intelligence reasoning device, comprising a memory in which at least one program is recorded and a processor for executing the program, where the program is a high-level language independent of a learning framework for applications based on a pre-trained neural network. Converting the executable code into executable code, separating the executable code into General Purpose Language (GPL) code and Domain Specific Language (DSL) code depending on whether accelerated operations are required, and separated GPL code and DSL code Steps can be taken to generate target code optimized for hardware.

이때, 분리하는 단계는, 실행 코드를 분석한 결과 연산 중심 명령어인지의 여부에 따라 GPL 코드 및 DSL 코드로 생성할 수 있다.At this time, the separation step can be generated as GPL code or DSL code depending on whether or not it is a calculation-oriented instruction as a result of analyzing the executable code.

이때, 분리하는 단계는, 연산 중심 명령어인지를 판단함에 있어, 실행 코드를 렉시칼 분석 및 구문 분석한 결과를 기반으로 검사하는 것일 수 있다.At this time, the separating step may be checking based on the results of lexical analysis and parsing of the executable code to determine whether it is an operation-oriented instruction.

이때, 타겟 코드를 생성하는 단계는, GPL 코드를 하드웨어의 CPU에서 실행되는 타겟 코드로 생성하는 것일 수 있다. At this time, the step of generating the target code may be generating the GPL code as a target code that runs on the CPU of the hardware.

이때, 타겟 코드를 생성하는 단계는, DSL 코드를 분석한 결과 또는 하드웨어의 가속기 구성 상태를 기반으로 하드웨어의 CPU 또는 가속기에서 실행되는 타겟 코드로 생성하는 것일 수 있다.At this time, the step of generating the target code may be to generate a target code that runs on the CPU or accelerator of the hardware based on the result of analyzing the DSL code or the accelerator configuration state of the hardware.

이때, 타겟 코드를 생성하는 단계는, DSL 코드를 분석한 결과 가속 환경에 유리할 경우, DSL 분리 규칙을 적용하여 타겟 코드를 생성하는 것일 수 있다.At this time, the step of generating the target code may be to generate the target code by applying the DSL separation rule if it is advantageous for an acceleration environment as a result of analyzing the DSL code.

이때, 타겟 코드를 생성하는 단계는, 하드웨어에 가속기가 존재할 경우, DSL 분리 규칙을 적용하여 타겟 코드를 생성하는 것일 수 있다.At this time, the step of generating the target code may be generating the target code by applying the DSL separation rule if an accelerator exists in the hardware.

이때, 타겟 코드를 생성하는 단계는, 하드웨어에 복수의 가속기들의 종류가 상이할 경우, 가속기 종류별로 DSL 분리 규칙을 적용하는 것일 수 있다.At this time, the step of generating the target code may be to apply DSL separation rules for each type of accelerator when the types of a plurality of accelerators in the hardware are different.

이때, 타겟 코드를 생성하는 단계는, 하드웨어에 동종 가속기들이 복수개 존재할 경우, 동종 가속기 환경 내에서 복수의 가속기들에 대한 DSL 분리 규칙을 적용하는 것일 수 있다. At this time, the step of generating the target code may be to apply the DSL separation rule to the plurality of accelerators within the same accelerator environment when a plurality of the same accelerators exist in the hardware.

실시예에 따른 인공 지능 추론 방법은, 미리 학습된 신경망을 기반으로 하는 응용을 학습 프레임워크에 독립적인 상위 레벨 언어의 실행 코드로 변환하는 단계, 실행 코드를 가속 연산 필요 여부에 따라 범용 언어(General Purpose Language, GPL) 코드와 도메인 특정 언어(Domain Specific Language, DSL) 코드로 분리하는 단계 및 분리된 GPL 코드 및 DSL 코드를 하드웨어에 최적화된 타겟 코드로 생성하는 단계를 포함하되, 분리하는 단계는, 실행 코드를 분석한 결과 연산 중심 명령어인지의 여부에 따라 GPL 코드 및 DSL 코드로 생성하고, 타겟 코드를 생성하는 단계는, GPL 코드를 하드웨어의 CPU에서 실행되는 타겟 코드로 생성하고, DSL 코드를 분석한 결과 또는 하드웨어의 가속기 구성 상태를 기반으로 하드웨어의 CPU 또는 가속기에서 실행되는 타겟 코드로 생성할 수 있다. The artificial intelligence inference method according to the embodiment includes the steps of converting an application based on a pre-trained neural network into executable code of a high-level language independent of the learning framework, and converting the executable code into a general-purpose language (General) depending on whether accelerated operations are needed. It includes the step of separating the Purpose Language (GPL) code and the Domain Specific Language (DSL) code and the step of generating the separated GPL code and DSL code into target code optimized for hardware, but the separation step includes, As a result of analyzing the execution code, it is generated as GPL code and DSL code depending on whether it is a calculation-oriented instruction. The step of generating target code is to generate GPL code as target code that runs on the CPU of the hardware and analyze the DSL code. Based on the results or the configuration state of the hardware's accelerator, it can be generated as target code that runs on the hardware's CPU or accelerator.

이때, 타겟 코드를 생성하는 단계는, DSL 코드를 분석한 결과 가속 환경에 유리할 경우, DSL 분리 규칙을 적용하여 타겟 코드를 생성하고, 하드웨어에 가속기가 존재할 경우, DSL 분리 규칙을 적용하여 타겟 코드를 생성하는 것일 수 있다.At this time, in the step of generating the target code, if it is advantageous for an acceleration environment as a result of analyzing the DSL code, the target code is generated by applying the DSL separation rule. If an accelerator exists in the hardware, the target code is generated by applying the DSL separation rule. It may be creating.

본 발명은 다양한 인공지능 응용 및 하드웨어 가속 환경에 종속되지 않는 인공 지능 추론 장치를 제안으로써, 임베디드 인공지능 개발에서 개발 시간과 노력을 줄여주고 유지보수 비용도 함께 줄여주는 이점이 있다.The present invention proposes an artificial intelligence inference device that is not dependent on various artificial intelligence applications and hardware acceleration environments, and has the advantage of reducing development time and effort and maintenance costs in embedded artificial intelligence development.

도 1은 실시예에 따른 인공 지능 추론 장치를 포함하는 임베디드 시스템의 개략적인 블록 구성도이다.
도 2는 실시예에 따른 인공 지능 추론 방법을 설명하기 위한 순서도이다.
도 3은 도 2에 도시된 실행 코드를 GPL 코드와 DSL 코드로 분리하는 단계(S220)를 설명하기 위한 순서도이다.
도 4는 도 2에 도시된 DSL 코드를 타겟 코드로 생성하는 단계(S232)를 설명하기 위한 순서도이다.
도 5는 실시예에 따른 컴퓨터 시스템 구성을 나타낸 도면이다.
1 is a schematic block diagram of an embedded system including an artificial intelligence inference device according to an embodiment.
Figure 2 is a flowchart for explaining an artificial intelligence inference method according to an embodiment.
FIG. 3 is a flowchart for explaining the step (S220) of separating the executable code shown in FIG. 2 into GPL code and DSL code.
FIG. 4 is a flowchart for explaining the step (S232) of generating the DSL code shown in FIG. 2 as a target code.
Figure 5 is a diagram showing the configuration of a computer system according to an embodiment.

본 발명의 이점 및 특징, 그리고 그것들을 달성하는 방법은 첨부되는 도면과 함께 상세하게 후술되어 있는 실시예들을 참조하면 명확해질 것이다. 그러나 본 발명은 이하에서 개시되는 실시예들에 한정되는 것이 아니라 서로 다른 다양한 형태로 구현될 것이며, 단지 본 실시예들은 본 발명의 개시가 완전하도록 하며, 본 발명이 속하는 기술분야에서 통상의 지식을 가진 자에게 발명의 범주를 완전하게 알려주기 위해 제공되는 것이며, 본 발명은 청구항의 범주에 의해 정의될 뿐이다. 명세서 전체에 걸쳐 동일 참조 부호는 동일 구성 요소를 지칭한다.The advantages and features of the present invention and methods for achieving them will become clear by referring to the embodiments described in detail below along with the accompanying drawings. However, the present invention is not limited to the embodiments disclosed below and will be implemented in various different forms. The present embodiments only serve to ensure that the disclosure of the present invention is complete and that common knowledge in the technical field to which the present invention pertains is not limited. It is provided to fully inform those who have the scope of the invention, and the present invention is only defined by the scope of the claims. Like reference numerals refer to like elements throughout the specification.

비록 "제1" 또는 "제2" 등이 다양한 구성요소를 서술하기 위해서 사용되나, 이러한 구성요소는 상기와 같은 용어에 의해 제한되지 않는다. 상기와 같은 용어는 단지 하나의 구성요소를 다른 구성요소와 구별하기 위하여 사용될 수 있다. 따라서, 이하에서 언급되는 제1 구성요소는 본 발명의 기술적 사상 내에서 제2 구성요소일 수도 있다.Although terms such as “first” or “second” are used to describe various components, these components are not limited by the above terms. The above terms may be used only to distinguish one component from another component. Accordingly, the first component mentioned below may also be the second component within the technical spirit of the present invention.

본 명세서에서 사용된 용어는 실시예를 설명하기 위한 것이며 본 발명을 제한하고자 하는 것은 아니다. 본 명세서에서, 단수형은 문구에서 특별히 언급하지 않는 한 복수형도 포함한다. 명세서에서 사용되는 "포함한다(comprises)" 또는 "포함하는(comprising)"은 언급된 구성요소 또는 단계가 하나 이상의 다른 구성요소 또는 단계의 존재 또는 추가를 배제하지 않는다는 의미를 내포한다.The terms used in this specification are for describing embodiments and are not intended to limit the invention. As used herein, singular forms also include plural forms, unless specifically stated otherwise in the context. As used in the specification, “comprises” or “comprising” implies that the mentioned component or step does not exclude the presence or addition of one or more other components or steps.

다른 정의가 없다면, 본 명세서에서 사용되는 모든 용어는 본 발명이 속하는 기술분야에서 통상의 지식을 가진 자에게 공통적으로 이해될 수 있는 의미로 해석될 수 있다. 또한, 일반적으로 사용되는 사전에 정의되어 있는 용어들은 명백하게 특별히 정의되어 있지 않는 한 이상적으로 또는 과도하게 해석되지 않는다.Unless otherwise defined, all terms used in this specification can be interpreted as meanings commonly understood by those skilled in the art to which the present invention pertains. Additionally, terms defined in commonly used dictionaries are not interpreted ideally or excessively unless clearly specifically defined.

이하에서는, 도 1 내지 도 5를 참조하여 실시예에 따른 다양한 하드웨어 가속 환경에서 동작하는 인공 지능 추론 장치 및 방법이 상세히 설명된다. Hereinafter, an artificial intelligence inference device and method operating in various hardware acceleration environments according to embodiments will be described in detail with reference to FIGS. 1 to 5.

이때, 인공 지능 추론 장치는 다양한 하드웨어 가속 환경에 독립적인 임베디드 장치로 구현될 수 있다. 즉, 본 발명에서는 다종의 가속기 별로 인공 지능 추론 장치가 새로 구축되는 것이 아니라, 하드웨어 독립적인 부분을 하위 레이어로 분리함으로써, 다양한 인공지능 가속 하드웨어 환경에 쉽게 이식되게 할 수 있는 기술을 제안한다. At this time, the artificial intelligence inference device can be implemented as an embedded device independent of various hardware acceleration environments. In other words, the present invention proposes a technology that can be easily ported to various artificial intelligence acceleration hardware environments by separating the hardware-independent part into lower layers, rather than newly constructing an artificial intelligence inference device for each type of accelerator.

도 1은 실시예에 따른 인공 지능 추론 장치를 포함하는 임베디드 시스템의 개략적인 블록 구성도이다. 1 is a schematic block diagram of an embedded system including an artificial intelligence inference device according to an embodiment.

도 1을 참조하면, 실시예에 따른 인공 지능 추론 장치(100)는 미리 학습된 신경망을 기반으로 하는 다양한 인공 지능 응용들(10)을 구현하는 프로그램 코드가 입력됨에 따라, 응용 프로그램 코드가 하드웨어 시스템(20) 특성에 최적화되어 실행될 수 있도록 한다. Referring to FIG. 1, the artificial intelligence inference device 100 according to the embodiment is inputted with program codes implementing various artificial intelligence applications 10 based on a pre-trained neural network, and the application code is converted into a hardware system. (20) Ensure that it can be executed optimized for its characteristics.

이때, 신경망은 딥러닝(Deep Learning) 신경망일 수 있고, 딥러닝 신경망을 사용하는 많은 응용들은 서버에서 미리 학습 과정을 거치게 된다. 이때, 학습 프레임워크의 예시로는 tensorflow, caffe 등이 포함될 수 있다. 이러한 딥러닝 신경망은 많은 연산 처리 용량을 필요로 하기 때문에 GPU나 전용 가속기와 같은 계산 능력이 우수한 가속 장치를 필요로 하며, 경우에 따라서는 두개 이상의 동종 혹은 이종 가속기가 사용될 수도 있다. At this time, the neural network may be a deep learning neural network, and many applications using deep learning neural networks undergo a learning process in advance on the server. At this time, examples of learning frameworks may include tensorflow, caffe, etc. Because these deep learning neural networks require a large amount of computational processing capacity, they require accelerator devices with excellent computational capabilities, such as GPUs or dedicated accelerators. In some cases, two or more same or heterogeneous accelerators may be used.

그런데, 이때 학습된 신경망 모델 및 가중치(weight) 데이터는 학습 프레임워크에 종속된 형태로 배포되기 때문에, 인공 지능 추론 장치에서는 학습 프레임워크와 동일한 환경 설정이 요구되거나, 추론 엔진에 특화된 포맷으로 변환되는 과정이 수행되어야 한다. 즉, 기존 추론 시스템의 경우 특정 하드웨어에 종속된 시스템을 구현해야 하기 때문에, 가속 하드웨어가 변경될 때마다 새로이 추론 시스템을 만들어야 했었다. 이는 딥러닝 가속 코드에 대한 재사용성을 현저히 저하시킨다, However, since the learned neural network model and weight data are distributed in a form dependent on the learning framework, the artificial intelligence inference device requires the same environment settings as the learning framework or is converted to a format specialized for the inference engine. The process must be carried out. In other words, in the case of existing inference systems, a system dependent on specific hardware had to be implemented, so a new inference system had to be created every time the acceleration hardware was changed. This significantly reduces the reusability of deep learning acceleration code.

따라서, 실시예에 따른 인공 지능 추론 장치(100)는 하드웨어 독립적인 부분과 하드웨어 종속적인 부분으로 설계하고, 하드웨어 환경이 달라지더라도 하드웨어 종속된 부분만을 새로이 구축하도록 설계되었다. Therefore, the artificial intelligence inference device 100 according to the embodiment is designed with a hardware-independent part and a hardware-dependent part, and is designed to newly build only the hardware-dependent part even if the hardware environment changes.

이에 실시예에 따른 인공 지능 추론 장치(100)는 프론트 엔드 레이어(110), DSL 레이어(120) 및 타겟 코드 생성 레이어(130)를 포함할 수 있다. Accordingly, the artificial intelligence inference device 100 according to the embodiment may include a front-end layer 110, a DSL layer 120, and a target code generation layer 130.

프론트 엔드 레이어(110)는 미리 학습된 신경망 및 파라미터를 기반으로 하는 응용을 학습 프레임워크에 독립적인 상위 레벨 언어의 실행 코드로 변환할 수 있다. 즉, 인공지능 응용(10)을 인공지능 프레임워크에 종속적인 코드에서 프레임워크에 독립적인 상위 레벨 언어의 코드로 변환한다. 즉, 프론트 엔드 레이어(110)는 하드웨어 독립적인 레이어로, 다양한 학습 프레임워크에서 생성된 데이터를 공통으로 처리할 수 있다. The front-end layer 110 can convert an application based on a pre-trained neural network and parameters into executable code of a high-level language independent of the learning framework. In other words, the artificial intelligence application 10 is converted from code dependent on the artificial intelligence framework to code in a high-level language independent of the framework. That is, the front-end layer 110 is a hardware-independent layer and can commonly process data generated from various learning frameworks.

이때, 상위 레벨 언어는, 파이썬(Python)일 수 있다. 또한, NNEF(Neural Network Exchange Format), ONNX (Open Neural Network eXchange format) 등과 같은 표준화된 딥러닝 데이터 변환 포맷일 수도 있다. At this time, the high-level language may be Python. Additionally, it may be a standardized deep learning data conversion format such as NNEF (Neural Network Exchange Format), ONNX (Open Neural Network eXchange format), etc.

DSL 레이어(120)는 실행 코드를 가속 연산 필요 여부에 따라 범용 언어(General Purpose Language, GPL) 코드와 도메인 특정 언어(Domain Specific Language, DSL) 코드로 분리할 수 있다. 즉, DSL 레이어(120)는 프론트 엔드 레이어(110)에서 생성된 실행 코드를 DSL 코드를 사용하여 하드웨어에 독립적인 인공지능 처리 루틴으로 변환한다The DSL layer 120 can separate the execution code into general purpose language (GPL) code and domain specific language (Domain Specific Language, DSL) code depending on whether accelerated operations are needed. That is, the DSL layer 120 converts the execution code generated by the front-end layer 110 into a hardware-independent artificial intelligence processing routine using the DSL code.

이때, DSL 레이어(120)는, 실행 코드를 분석한 결과 연산 중심 명령어인지의 여부에 따라 GPL 코드 및 DSL 코드로 생성할 수 있다. 이에 대한 상세한 설명은 도 3을 참조하여 후술하기로 한다. At this time, the DSL layer 120 can be generated as a GPL code or a DSL code depending on whether or not it is a calculation-oriented instruction as a result of analyzing the execution code. A detailed description of this will be provided later with reference to FIG. 3.

타겟 코드 생성 레이어(130)는 분리된 GPL 코드 및 DSL 코드를 하드웨어에 최적화된 타겟 코드로 생성할 수 있다. The target code generation layer 130 can generate the separated GPL code and DSL code into a target code optimized for hardware.

즉, 하드웨어 시스템(20)에서 인공 지능 응용(10)이 실행되는데, CPU(21)와 함께 가속기(22)가 더 탑재될 수 있다. 이때, 가속기(22)로 GPU, FPGA, 전용 가속 칩 등과 같은 다양한 종류의 가속기들이 탑재될 수 있고, 종류가 동일한 가속기가 복수개 존재할 수도 있다. 예컨대, 하드웨어 시스템(20)에 GPU와 가속기 칩이 동시에 탑재될 수도 있고, 동일의 2개의 GPU가 탑재될 수도 있다. 즉, 이때, 하드웨어 시스템(20)의 가속 환경 설정은 인공 지능 응용의 특성에 맞추어 크기, 전력 소모 등을 고려하여 성능을 최적화는 방식으로 구현되는 것이다. That is, the artificial intelligence application 10 is executed in the hardware system 20, and an accelerator 22 may be further installed along with the CPU 21. At this time, various types of accelerators, such as GPU, FPGA, and dedicated acceleration chips, may be mounted as the accelerator 22, and a plurality of accelerators of the same type may exist. For example, a GPU and an accelerator chip may be installed in the hardware system 20 at the same time, or two identical GPUs may be installed. That is, at this time, the acceleration environment settings of the hardware system 20 are implemented in a way that optimizes performance by considering size, power consumption, etc. in accordance with the characteristics of artificial intelligence applications.

CPU(21)에서는 통상적으로 C, C++를 포함하는 GPL 코드가 실행될 수 있다. 따라서, 타겟 코드 생성 레이어(130)는, GPL 코드를 하드웨어의 CPU에서 실행되는 타겟 코드로 생성할 수 있다. GPL code, typically including C and C++, can be executed in the CPU 21. Accordingly, the target code generation layer 130 can generate GPL code as a target code that runs on the CPU of hardware.

또한, 타겟 코드 생성 레이어(130)는, DSL 코드를 분석한 결과 또는 하드웨어의 가속기 구성 상태를 기반으로 하드웨어의 CPU 또는 가속기에서 실행되는 타겟 코드로 생성할 수 있다. 가속기(22)에서는 DSL 코드가 실행될 수 있는데, DSL 코드는 가속기에 특화된 형태로 변환될 수 있다. 또한, DSL 코드의 특성에 따라 DSL 코드 또한 CPU(21)에서 실행될 수 있다. 이에 대한 상세한 설명은 도 4를 참조하여 후술하기로 한다. Additionally, the target code generation layer 130 may generate a target code that is executed in the CPU or accelerator of the hardware based on the result of analyzing the DSL code or the configuration state of the hardware accelerator. DSL code can be executed in the accelerator 22, and the DSL code can be converted into a form specific to the accelerator. Additionally, depending on the characteristics of the DSL code, the DSL code may also be executed in the CPU 21. A detailed description of this will be provided later with reference to FIG. 4 .

도 2는 실시예에 따른 인공 지능 추론 방법을 설명하기 위한 순서도이다.Figure 2 is a flowchart for explaining an artificial intelligence inference method according to an embodiment.

도 2를 참조하면, 실시예는 인공 지능 추론 방법으로, 미리 학습된 신경망을 기반으로 하는 응용을 학습 프레임워크에 독립적인 상위 레벨 언어의 실행 코드로 변환하는 단계(S210)와, 실행 코드를 가속 연산 필요 여부에 따라 범용 언어(General Purpose Language, GPL) 코드와 도메인 특정 언어(Domain Specific Language, DSL) 코드로 분리하는 단계(S220, 도 3 참조) 및 분리된 GPL 코드 및 DSL 코드를 하드웨어에 최적화된 타겟 코드로 생성하는 단계(S230)를 포함한다. Referring to Figure 2, the embodiment is an artificial intelligence inference method, which includes converting an application based on a pre-trained neural network into executable code of a high-level language independent of the learning framework (S210), and accelerating the executable code. Separating into General Purpose Language (GPL) code and Domain Specific Language (DSL) code depending on whether calculation is required (S220, see FIG. 3) and optimizing the separated GPL code and DSL code for hardware It includes a step (S230) of generating the target code.

이때, 분리하는 단계(S220)는, 실행 코드를 분석한 결과 연산 중심 명령어인지의 여부에 따라 GPL 코드 및 DSL 코드로 생성할 수 있다. At this time, in the separation step (S220), GPL code and DSL code can be generated depending on whether the executable code is an operation-oriented instruction or not as a result of analyzing the execution code.

이때, 분리하는 단계(S220)는, 연산 중심 명령어인지를 판단함에 있어, 실행 코드를 렉시칼 분석 및 구문 분석한 결과를 기반으로 검사하는 것일 수 있다. 이에 대한 상세한 설명은 도 3을 참조하여 후술하기로 한다. At this time, the separating step (S220) may be an inspection based on the results of lexical analysis and parsing of the executable code to determine whether it is an operation-oriented instruction. A detailed description of this will be provided later with reference to FIG. 3.

이때, 타겟 코드를 생성하는 단계(S230)는, GPL 코드를 하드웨어의 CPU에서 실행되는 타겟 코드로 생성하는 단계(S231)를 포함할 수 있다. At this time, the step of generating the target code (S230) may include the step of generating the GPL code as a target code that runs on the CPU of the hardware (S231).

이때, 타겟 코드를 생성하는 단계(S230)는, DSL 코드를 분석한 결과 또는 하드웨어의 가속기 구성 상태를 기반으로 하드웨어의 CPU 또는 가속기에서 실행되는 타겟 코드로 생성하는 단계(S232)를 포함할 수 있다. 즉, 인공 지능 추론 장치(100)는 DSL 언어를 특정 하드웨어 환경에 최적화되게 타켓 코드로 변환한다. 이에 대한 상세한 설명은 도 4를 참조하여 후술하기로 한다. At this time, the step of generating the target code (S230) may include the step of generating the target code to be executed in the CPU or accelerator of the hardware based on the result of analyzing the DSL code or the accelerator configuration state of the hardware (S232). . That is, the artificial intelligence reasoning device 100 converts the DSL language into target code to be optimized for a specific hardware environment. A detailed description of this will be provided later with reference to FIG. 4 .

도 3은 실시예에 따른 실행 코드를 GPL 코드와 DSL 코드로 분리하는 단계(S220)를 설명하기 위한 순서도이다. Figure 3 is a flow chart to explain the step (S220) of separating the executable code into GPL code and DSL code according to an embodiment.

도 3을 참조하면, 장치(100)는 렉시칼 분석(S310) 및 구문 분석(S320)를 수행한다. 여기서, 렉시칼 분석이란 프로그램의 각 문장을 최소 단위인 토큰으로 구분하는 것이다. 여기서, 구문 분석이란 어휘 분석 단계에서 만들어진 토큰들로부터 파스트리 혹은 구문 트리를 생성하는 것이다. 이때, 구문 분석 결과로 규칙과 신경망 프레임워크의 명령어 데이터베이스를 이용하여 신경망에 대해 변수, 인자값, 배열값들이 저장된다. Referring to FIG. 3, the device 100 performs lexical analysis (S310) and syntactic analysis (S320). Here, lexical analysis refers to dividing each statement in a program into tokens, which are the minimum units. Here, syntactic analysis refers to creating a pastry or syntax tree from tokens created in the lexical analysis stage. At this time, variables, argument values, and array values for the neural network are stored as a result of the syntax analysis using the rules and the command database of the neural network framework.

그런 후, 장치(100)는 분석 결과 실행 코드가 연산 중심 명령어인지를 판단한다(S330). 즉, 미리 정의된 규칙을 기반으로 연산 중심 명령어 또는 제어 중심 명령어인지를 검사한다. Then, the device 100 determines whether the execution code as a result of the analysis is an operation-oriented instruction (S330). In other words, it is checked whether it is an operation-oriented instruction or a control-oriented instruction based on predefined rules.

S330의 판단 결과 연산 중심 명령어가 아닐 경우, 장치(100)는 실행 코드를 GPL 코드로 생성한다(S340). 즉, 연산의 고성능화를 요구하는 부분이 아닐 경우, GPL 코드로 변환되는 것이다. 예컨대, 응용이 '얼굴 인식'일 경우, 카메라 구동, 촬영 또는 영상 입력 등과 같은 루틴에 해당하는 코드들은 연산의 고성능화가 요구되는 부분이 아니므로, GPL 코드로 생성된다. If, as a result of the determination in S330, it is not an operation-oriented instruction, the device 100 generates the executable code as GPL code (S340). In other words, if it is not a part that requires high performance of operations, it is converted to GPL code. For example, when the application is 'face recognition', the codes corresponding to routines such as camera operation, shooting, or image input are not parts that require high performance in computation, so they are generated as GPL code.

반면, S330의 판단 결과 연산 중심 명령어일 아닐 경우, 장치(100)는 실행 코드를 DSL 코드로 생성한다(S350). 즉, 딥러닝 가속 연산의 고성능화를 요구하는 부분은 DSL 코드로 변환되는 것이다. 예컨대, 응용이 '얼굴 인식'일 경우, 준비된 데이터를 입력받아 실제로 실행되는 딥러닝 신경망에 해당하는 코드들은 연산의 고성능화가 요구되는 부분이므로, DSL 코드로 생성된다. On the other hand, if the determination at S330 is that it is not an operation-oriented instruction, the device 100 generates the execution code as a DSL code (S350). In other words, parts that require high performance of deep learning acceleration calculations are converted to DSL code. For example, if the application is 'face recognition', the codes corresponding to the deep learning neural network that is actually executed by receiving the prepared data are generated as DSL codes because high performance of operations is required.

이때, DSL은 문법에 의해 정의되는데, BLAS 라이브러를 최적으로 표현하는 언어로 설계된다. 딥러닝 가속을 위한 DSL 언어의 일 예는 다음과 같을 수 있다. At this time, DSL is defined by grammar and is designed as a language that optimally expresses the BLAS library. An example of a DSL language for deep learning acceleration may be as follows.

C[i,j: M, N] = A(i,k: M,N) *+ B(k,j:M, N) C[i,j: M, N] = A(i,k: M,N) *+ B(k,j:M, N)

도 4는 실시예에 따른 DSL 코드를 타겟 코드로 생성하는 단계(S232)를 설명하기 위한 순서도이다. Figure 4 is a flowchart for explaining the step (S232) of generating a DSL code as a target code according to an embodiment.

실시예에 따라 DSL 코드를 타겟 코드로 생성하는 단계(S232)는, DSL 코드를 분석한 결과 가속 환경에 유리할 경우, DSL 분리 규칙을 적용하여 DSL 코드를 타겟 코드로 생성하는 것일 수 있다. Depending on the embodiment, the step of generating the DSL code as a target code (S232) may be to generate the DSL code as a target code by applying the DSL separation rule if it is advantageous for an acceleration environment as a result of analyzing the DSL code.

즉, 도 4를 참조하면, 장치(100)는 DSL 코드를 분석한 결과 가속 환경에 유리한지를 판단한다(S410). 장치(100)는 S410의 판단 결과, 가속 환경에 유리하지 않을 경우에는 DSL 코드를 CPU에서 실행되는 타겟 코드로 생성하고(S420), 가속 환경에 유리할 경우에는 S430으로 진행한다. That is, referring to FIG. 4, the device 100 determines whether the acceleration environment is advantageous as a result of analyzing the DSL code (S410). As a result of the determination in S410, if it is not advantageous for the acceleration environment, the device 100 generates the DSL code as a target code to be executed on the CPU (S420). If it is advantageous for the acceleration environment, the device 100 proceeds to S430.

또한, 실시예에 따라 DSL 코드를 타겟 코드로 생성하는 단계(S232)는, 하드웨어에 가속기가 존재할 경우, DSL 분리 규칙을 적용하여 타겟 코드를 생성하는 것일 수 있다.Additionally, depending on the embodiment, the step of generating the DSL code as the target code (S232) may be to generate the target code by applying the DSL separation rule when an accelerator exists in the hardware.

즉, 도 4를 참조하면, 장치(100)는 하드웨어에 가속기가 존재하는지를 판단한다(S430). 장치(100)는 S430의 판단 결과 가속기가 존재하지 않을 경우에는 DSL 코드를 CPU에서 실행되는 타겟 코드로 생성하고(S420), 가속기가 존재할 경우에는 S440으로 진행한다. That is, referring to FIG. 4, the device 100 determines whether an accelerator exists in the hardware (S430). As a result of the determination in S430, if the accelerator does not exist, the device 100 generates the DSL code as a target code to be executed in the CPU (S420). If the accelerator exists, the device 100 proceeds to S440.

또한, 실시예에 따라 DSL 코드를 타겟 코드로 생성하는 단계(S232)는, 하드웨어에 가속기들의 종류가 상이할 경우, 가속기 종류별로 DSL 분리 규칙을 적용하는 것일 수 있다.Additionally, depending on the embodiment, the step of generating DSL code as a target code (S232) may be to apply DSL separation rules for each type of accelerator when the types of accelerators in the hardware are different.

즉, 도 4를 참조하면, 장치(100)는 가속기의 환경을 분석(S440)하고, 하드웨어에 종류가 상이한 복수의 이종 가속기들이 존재하는지를 판단한다(S450). S450의 판단 결과 종류가 상이한 복수의 이종 가속기들이 존재할 경우, 장치(100)는 가속기 종류별로 DSL 분리 규칙을 적용한다(S460).That is, referring to FIG. 4, the device 100 analyzes the environment of the accelerator (S440) and determines whether a plurality of heterogeneous accelerators of different types exist in the hardware (S450). As a result of the determination in S450, if a plurality of heterogeneous accelerators of different types exist, the device 100 applies the DSL separation rule for each accelerator type (S460).

반면, S450의 판단 결과 종류가 상이한 복수의 이종 가속기들이 존재하지 않거나 S460을 수행한 이후, 장치(100)는 S470으로 진행한다. On the other hand, as a result of the determination in S450, if a plurality of heterogeneous accelerators of different types do not exist or after performing S460, the device 100 proceeds to S470.

또한, 실시예에 따라 DSL 코드를 타겟 코드로 생성하는 단계(S232)는, 하드웨어에 동종 가속기들이 복수개 존재할 경우, 동종 가속기 환경 내에서 복수의 가속기들에 대한 DSL 분리 규칙을 적용하는 것일 수 있다.In addition, according to the embodiment, the step of generating the DSL code as the target code (S232) may be to apply the DSL separation rule to the plurality of accelerators in the same accelerator environment when a plurality of homogeneous accelerators exist in the hardware.

즉, 도 4를 참조하면, 장치(100)는 하드웨어에 동종 가속기들이 복수개 존재하는지를 판단한다(S470). S470의 판단 결과 하드웨어에 동종 가속기들이 복수개 존재할 경우, 장치(100)는 동종 가속기 환경 내에서 복수의 가속기들에 대한 DSL 분리 규칙을 적용한다(S480). That is, referring to FIG. 4, the device 100 determines whether a plurality of accelerators of the same type exist in the hardware (S470). As a result of the determination in S470, if a plurality of homogeneous accelerators exist in the hardware, the device 100 applies the DSL separation rule to the plurality of accelerators within the homogeneous accelerator environment (S480).

전술한 바와 같이 실시예에서는 DSL 언어를 사용하여 딥러닝 실행 부분을 중간 언어로 변환하고, DSL 언어에서 하드웨어에 최적화된 타켓 코드로의 생성을 별도의 레이어로 분리함으로써, 추론 시스템의 배포를 쉽게 한다. 특히 가속 하드웨어가 둘 이상인 환경에서도 쉽게 동작하는 구조를 가지고 있다. 또한, 실시예에 따른 인공 지능 추론 장치 및 방법은 딥러닝 신경망을 임베디드 시스템 환경으로 배포(deploy)할 때, 다양한 딥러닝 가속 장치(CPU, GPU, FPGA, 전용 가속기)에 독립적으로 동작할 수 있다. As described above, in the embodiment, the deep learning execution part is converted to an intermediate language using a DSL language, and the generation from the DSL language to a hardware-optimized target code is separated into a separate layer, making distribution of the inference system easy. . In particular, it has a structure that operates easily even in an environment where there is more than one acceleration hardware. In addition, the artificial intelligence inference device and method according to the embodiment can operate independently of various deep learning accelerator devices (CPU, GPU, FPGA, dedicated accelerator) when deploying a deep learning neural network to an embedded system environment. .

도 5는 실시예에 따른 컴퓨터 시스템 구성을 나타낸 도면이다.Figure 5 is a diagram showing the configuration of a computer system according to an embodiment.

실시예에 따른 인공 지능 추론 장치(100)는 컴퓨터로 읽을 수 있는 기록매체와 같은 컴퓨터 시스템(1000)에서 구현될 수 있다.The artificial intelligence inference device 100 according to the embodiment may be implemented in a computer system 1000 such as a computer-readable recording medium.

컴퓨터 시스템(1000)은 버스(1020)를 통하여 서로 통신하는 하나 이상의 프로세서(1010), 메모리(1030), 사용자 인터페이스 입력 장치(1040), 사용자 인터페이스 출력 장치(1050) 및 스토리지(1060)를 포함할 수 있다. 또한, 컴퓨터 시스템(1000)은 네트워크(1080)에 연결되는 네트워크 인터페이스(1070)를 더 포함할 수 있다. 프로세서(1010)는 중앙 처리 장치 또는 메모리(1030)나 스토리지(1060)에 저장된 프로그램 또는 프로세싱 인스트럭션들을 실행하는 반도체 장치일 수 있다. 메모리(1030) 및 스토리지(1060)는 휘발성 매체, 비휘발성 매체, 분리형 매체, 비분리형 매체, 통신 매체, 또는 정보 전달 매체 중에서 적어도 하나 이상을 포함하는 저장 매체일 수 있다. 예를 들어, 메모리(1030)는 ROM(1031)이나 RAM(1032)을 포함할 수 있다.Computer system 1000 may include one or more processors 1010, memory 1030, user interface input device 1040, user interface output device 1050, and storage 1060 that communicate with each other via bus 1020. You can. Additionally, the computer system 1000 may further include a network interface 1070 connected to the network 1080. The processor 1010 may be a central processing unit or a semiconductor device that executes programs or processing instructions stored in the memory 1030 or storage 1060. The memory 1030 and storage 1060 may be storage media including at least one of volatile media, non-volatile media, removable media, non-removable media, communication media, and information transfer media. For example, memory 1030 may include ROM 1031 or RAM 1032.

이상에서 첨부된 도면을 참조하여 본 발명의 실시예들을 설명하였지만, 본 발명이 속하는 기술분야에서 통상의 지식을 가진 자는 본 발명이 그 기술적 사상이나 필수적인 특징을 변경하지 않고서 다른 구체적인 형태로 실시될 수 있다는 것을 이해할 수 있을 것이다. 그러므로 이상에서 기술한 실시예들은 모든 면에서 예시적인 것이며 한정적이 아닌 것으로 이해해야만 한다.Although embodiments of the present invention have been described above with reference to the attached drawings, those skilled in the art will understand that the present invention can be implemented in other specific forms without changing the technical idea or essential features. You will understand that it exists. Therefore, the embodiments described above should be understood in all respects as illustrative and not restrictive.

100 : 인공 지능 추론 장치
110 : 프론트 엔드 레이어 120 : DSL 레이어
130 : 타겟 코드 생성 레이어
100: Artificial Intelligence Reasoning Device
110: Front-end layer 120: DSL layer
130: Target code generation layer

Claims (20)

인공 지능 추론 장치에 의해 수행되는 인공 지능 추론 방법에 있어서,
인공 지능 추론 장치의 프론트 엔드 레이어에 의해 미리 학습된 신경망을 기반으로 하는 응용을 학습 프레임워크에 독립적인 상위 레벨 언어의 실행 코드로 변환하는 단계;
인공 지능 추론 장치의 DSL 레이어에 의해 실행 코드를 가속 연산 필요 여부에 따라 범용 언어(General Purpose Language, GPL) 코드와 도메인 특정 언어(Domain Specific Language, DSL) 코드로 분리하는 단계; 및
인공 지능 추론 장치의 타켓 코드 생성 레이어에 의해 분리된 GPL 코드 및 DSL 코드를 응용을 실행할 하드웨어에 포함된 CPU 또는 가속기의 개수 및 종류에 최적화된 타겟 코드로 생성하는 단계를 포함하되,
분리하는 단계는,
실행 코드를 분석하는 단계; 및
분석 결과 딥러닝 신경망에 해당하는 코드들인 연산 중심 명령어에 해당하는 실행 코드는 DSL 코드로 생성하고, 연산 중심 명령어가 아닌 실행 코드는 GPL 코드로 생성하는 단계;를 포함하는, 인공 지능 추론 방법.
In an artificial intelligence inference method performed by an artificial intelligence inference device,
Converting an application based on a pre-trained neural network by the front-end layer of the artificial intelligence inference device into executable code of a high-level language independent of the learning framework;
Separating the execution code into general purpose language (GPL) code and domain specific language (Domain Specific Language, DSL) code depending on whether accelerated operations are required by the DSL layer of the artificial intelligence reasoning device; and
A step of generating the GPL code and DSL code separated by the target code generation layer of the artificial intelligence inference device into target code optimized for the number and type of CPU or accelerator included in the hardware to run the application,
The separation step is,
Analyzing executable code; and
As a result of the analysis, an artificial intelligence inference method comprising: generating execution codes corresponding to operation-oriented instructions, which are codes corresponding to deep learning neural networks, as DSL codes, and generating execution codes that are not operation-oriented instructions as GPL codes.
삭제delete 제1 항에 있어서, 분석하는 단계는,
연산 중심 명령어인지를 판단함에 있어, 실행 코드를 렉시칼 분석 및 구문 분석한 결과를 기반으로 검사하는 것인, 인공 지능 추론 방법.
The method of claim 1, wherein the analyzing step includes:
An artificial intelligence inference method that checks whether an instruction is an operation-oriented instruction based on the results of lexical analysis and parsing of the executable code.
제1 항에 있어서, 타겟 코드를 생성하는 단계는,
GPL 코드를 하드웨어의 CPU에서 실행되는 타겟 코드로 생성하는, 인공 지능 추론 방법.
The method of claim 1, wherein generating the target code comprises:
An artificial intelligence inference method that generates GPL code into target code that runs on the hardware's CPU.
제1 항에 있어서, 타겟 코드를 생성하는 단계는,
DSL 코드를 분석한 결과 또는 하드웨어의 가속기 구성 상태를 기반으로 하드웨어의 CPU 또는 가속기에서 실행되는 타겟 코드로 생성하는, 인공 지능 추론 방법.
The method of claim 1, wherein generating the target code comprises:
An artificial intelligence inference method that generates a target code that runs on the hardware's CPU or accelerator based on the results of analyzing the DSL code or the hardware's accelerator configuration state.
제5 항에 있어서, 타겟 코드를 생성하는 단계는,
DSL 코드를 분석한 결과 가속 환경에 유리할 경우, DSL 분리 규칙을 적용하여 타겟 코드를 생성하는, 인공 지능 추론 방법.
The method of claim 5, wherein generating the target code includes:
An artificial intelligence inference method that generates target code by applying DSL separation rules if the results of analyzing the DSL code are favorable for an acceleration environment.
제5 항에 있어서, 타겟 코드를 생성하는 단계는,
하드웨어에 가속기가 존재할 경우, DSL 분리 규칙을 적용하여 타겟 코드를 생성하는, 인공 지능 추론 방법.
The method of claim 5, wherein generating the target code includes:
An artificial intelligence inference method that generates target code by applying DSL separation rules when an accelerator exists in hardware.
제7 항에 있어서, 타겟 코드를 생성하는 단계는,
하드웨어에 복수의 가속기들의 종류가 상이할 경우, 가속기 종류별로 DSL 분리 규칙을 적용하는, 인공 지능 추론 방법.
The method of claim 7, wherein generating the target code comprises:
An artificial intelligence inference method that applies DSL separation rules for each accelerator type when hardware has different types of accelerators.
제7 항에 있어서, 타겟 코드를 생성하는 단계는,
하드웨어에 동종 가속기들이 복수개 존재할 경우, 동종 가속기 환경 내에서 복수의 가속기들에 대한 DSL 분리 규칙을 적용하는, 인공 지능 추론 방법.
The method of claim 7, wherein generating the target code comprises:
An artificial intelligence inference method that applies DSL separation rules to multiple accelerators within a homogeneous accelerator environment when there are multiple homogeneous accelerators in hardware.
적어도 하나의 프로그램이 기록된 메모리; 및
프로그램을 실행하는 프로세서를 포함하며,
프로그램은,
미리 학습된 신경망을 기반으로 하는 응용을 학습 프레임워크에 독립적인 상위 레벨 언어의 실행 코드로 변환하는 프론트 엔드 레이어;
실행 코드를 가속 연산 필요 여부에 따라 범용 언어(General Purpose Language, GPL) 코드와 도메인 특정 언어(Domain Specific Language, DSL) 코드로 분리하는 DSL 레이어; 및
분리된 GPL 코드 및 DSL 코드를 응용을 실행할 하드웨어에 포함된 CPU 또는 가속기의 개수 및 종류에 최적화된 타겟 코드로 생성하는 타겟 코드 생성 레어어를 포함하되,
DSL 레이어는,
실행 코드를 분석하는 단계; 및
분석 결과 딥러닝 신경망에 해당하는 코드들인 연산 중심 명령어에 해당하는 실행 코드는 DSL 코드로 생성하고, 연산 중심 명령어가 아닌 실행 코드는 GPL 코드로 생성하는 단계;를 수행하는, 인공 지능 추론 장치.
a memory in which at least one program is recorded; and
Contains a processor that executes a program,
The program is,
A front-end layer that converts applications based on pre-trained neural networks into executable code in a high-level language that is independent of the learning framework;
DSL layer, which separates the executable code into General Purpose Language (GPL) code and Domain Specific Language (DSL) code depending on whether accelerated operations are needed or not; and
Generates separated GPL code and DSL code into target code optimized for the number and type of CPU or accelerator included in the hardware to run the application. Include target code generation rare words,
The DSL layer is,
Analyzing executable code; and
As a result of the analysis, an artificial intelligence inference device that performs the following steps: generating execution codes corresponding to operation-oriented instructions, which are codes corresponding to deep learning neural networks, as DSL codes, and generating execution codes that are not operation-oriented instructions as GPL codes.
삭제delete 제10 항에 있어서, DSL 레이어는,
연산 중심 명령어인지를 판단함에 있어, 실행 코드를 렉시칼 분석 및 구문 분석한 결과를 기반으로 검사하는 것인, 인공 지능 추론 장치.
The method of claim 10, wherein the DSL layer is:
An artificial intelligence inference device that checks whether an instruction is an operation-oriented instruction based on the results of lexical analysis and parsing of the executable code.
제10 항에 있어서, 타겟 코드 생성 레이어는,
GPL 코드를 하드웨어의 CPU에서 실행되는 타겟 코드로 생성하는, 인공 지능 추론 장치.
The method of claim 10, wherein the target code generation layer is:
An artificial intelligence inference device that generates GPL code into target code that runs on the hardware's CPU.
제10 항에 있어서, 타겟 코드 생성 레이어는,
DSL 코드를 분석한 결과 또는 하드웨어의 가속기 구성 상태를 기반으로 하드웨어의 CPU 또는 가속기에서 실행되는 타겟 코드로 생성하는, 인공 지능 추론 장치.
The method of claim 10, wherein the target code generation layer is:
An artificial intelligence inference device that generates target code that runs on the hardware's CPU or accelerator based on the results of analyzing the DSL code or the hardware's accelerator configuration state.
제14 항에 있어서, 타겟 코드 생성 레이어는,
DSL 코드를 분석한 결과 가속 환경에 유리할 경우, DSL 분리 규칙을 적용하여 타겟 코드를 생성하는, 인공 지능 추론 장치.
The method of claim 14, wherein the target code generation layer is:
An artificial intelligence inference device that generates target code by applying DSL separation rules if it is advantageous for an acceleration environment as a result of analyzing DSL code.
제14 항에 있어서, 타겟 코드 생성 레이어는,
하드웨어에 가속기가 존재할 경우, DSL 분리 규칙을 적용하여 타겟 코드를 생성하는, 인공 지능 추론 장치.
The method of claim 14, wherein the target code generation layer is:
An artificial intelligence inference device that generates target code by applying DSL separation rules when an accelerator exists in hardware.
제16 항에 있어서, 타겟 코드 생성 레이어는,
하드웨어에 복수의 가속기들의 종류가 상이할 경우, 가속기 종류별로 DSL 분리 규칙을 적용하는, 인공 지능 추론 장치.
The method of claim 16, wherein the target code generation layer is:
An artificial intelligence inference device that applies DSL separation rules for each accelerator type when the hardware has different types of accelerators.
제16 항에 있어서, 타겟 코드 생성 레이어는,
하드웨어에 동종 가속기들이 복수개 존재할 경우, 동종 가속기 환경 내에서 복수의 가속기들에 대한 DSL 분리 규칙을 적용하는, 인공 지능 추론 장치.
The method of claim 16, wherein the target code generation layer is:
An artificial intelligence inference device that applies DSL separation rules to multiple accelerators within a homogeneous accelerator environment when multiple homogeneous accelerators exist in hardware.
인공 지능 추론 장치에 의해 수행되는 인공 지능 추론 방법에 있어서,
인공 지능 추론 장치의 프론트 엔드 레이어에 의해 미리 학습된 신경망을 기반으로 하는 응용을 학습 프레임워크에 독립적인 상위 레벨 언어의 실행 코드로 변환하는 단계;
인공 지능 추론 장치의 DSL 레이어에 의해 실행 코드를 가속 연산 필요 여부에 따라 범용 언어(General Purpose Language, GPL) 코드와 도메인 특정 언어(Domain Specific Language, DSL) 코드로 분리하는 단계; 및
인공 지능 추론 장치의 타켓 코드 생성 레이어에 의해 분리된 GPL 코드 및 DSL 코드를 응용을 실행할 하드웨어에 포함된 CPU 또는 가속기의 개수 및 종류에 최적화된 타겟 코드로 생성하는 단계를 포함하되,
분리하는 단계는,
실행 코드를 분석하는 단계; 및
분석 결과 딥러닝 신경망에 해당하는 코드들인 연산 중심 명령어에 해당하는 실행 코드는 DSL 코드로 생성하고, 연산 중심 명령어가 아닌 실행 코드는 GPL 코드로 생성하는 단계;를 포함하고,
타겟 코드를 생성하는 단계는,
GPL 코드를 하드웨어의 CPU에서 실행되는 타겟 코드로 생성하고, DSL 코드를 분석한 결과 또는 하드웨어의 가속기 구성 상태를 기반으로 하드웨어의 CPU 또는 가속기에서 실행되는 타겟 코드로 생성하는, 인공 지능 추론 방법.
In an artificial intelligence inference method performed by an artificial intelligence inference device,
Converting an application based on a pre-trained neural network by the front-end layer of the artificial intelligence inference device into executable code of a high-level language independent of the learning framework;
Separating the execution code into general purpose language (GPL) code and domain specific language (Domain Specific Language, DSL) code depending on whether accelerated operations are required by the DSL layer of the artificial intelligence reasoning device; and
A step of generating the GPL code and DSL code separated by the target code generation layer of the artificial intelligence inference device into target code optimized for the number and type of CPU or accelerator included in the hardware to run the application,
The separation step is,
Analyzing executable code; and
As a result of the analysis, the executable code corresponding to the operation-oriented instructions, which is the code corresponding to the deep learning neural network, is generated as DSL code, and the execution code that is not the operation-oriented instruction is generated as GPL code;
The steps to generate target code are:
An artificial intelligence inference method that generates GPL code as target code that runs on the hardware's CPU and generates it as target code that runs on the hardware's CPU or accelerator based on the results of analyzing the DSL code or the hardware's accelerator configuration state.
제19 항에 있어서, 타겟 코드를 생성하는 단계는,
DSL 코드를 분석한 결과 가속 환경에 유리할 경우, DSL 분리 규칙을 적용하여 타겟 코드를 생성하고, 하드웨어에 가속기가 존재할 경우, DSL 분리 규칙을 적용하여 타겟 코드를 생성하는, 인공 지능 추론 방법.
The method of claim 19, wherein generating the target code comprises:
An artificial intelligence inference method that generates target code by applying DSL separation rules if an acceleration environment is advantageous as a result of analyzing DSL code, and if an accelerator exists in the hardware, applies DSL separation rules to generate target code.
KR1020200120585A 2019-10-08 2020-09-18 Apparatus and Method for Artificial Intelligence Inference KR102641240B1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
US17/767,364 US20220374740A1 (en) 2019-10-08 2020-09-28 Artificial intelligence inference apparatus and method
PCT/KR2020/013250 WO2021071160A1 (en) 2019-10-08 2020-09-28 Artificial intelligence inference apparatus and method

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
KR20190124396 2019-10-08
KR1020190124396 2019-10-08

Publications (2)

Publication Number Publication Date
KR20210042012A KR20210042012A (en) 2021-04-16
KR102641240B1 true KR102641240B1 (en) 2024-02-29

Family

ID=75743652

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1020200120585A KR102641240B1 (en) 2019-10-08 2020-09-18 Apparatus and Method for Artificial Intelligence Inference

Country Status (1)

Country Link
KR (1) KR102641240B1 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20230014264A (en) 2021-07-21 2023-01-30 티에스엔랩 주식회사 Artificial intelligence model transformation method, artificial intelligence model transformation apparatus, artificial intelligence model driving method and artificial intelligence model driving apparatus
KR102573644B1 (en) * 2021-08-24 2023-09-01 주식회사 에너자이 Method for, device for, and system for optimizing an inference engine
KR20230030768A (en) 2021-08-26 2023-03-07 티에스엔랩 주식회사 Artificial intelligence model transformation method, artificial intelligence model transformation apparatus, artificial intelligence model driving method and artificial intelligence model driving apparatus for preventing leakage of artificial intelligence model

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10409560B1 (en) * 2015-11-18 2019-09-10 Amazon Technologies, Inc. Acceleration techniques for graph analysis programs

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2952244B1 (en) 2014-06-02 2018-08-22 General Electric Technology GmbH Carbon capture system and method for capturing carbon dioxide

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10409560B1 (en) * 2015-11-18 2019-09-10 Amazon Technologies, Inc. Acceleration techniques for graph analysis programs

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
YU XING 외 5명, "An In-depth Comparison of Compilers for Deep Neural Networks on Hardware", 2019 IEEE International Conference on Embedded Software and Systems (ICESS), (2019.08.01.)*

Also Published As

Publication number Publication date
KR20210042012A (en) 2021-04-16

Similar Documents

Publication Publication Date Title
KR102641240B1 (en) Apparatus and Method for Artificial Intelligence Inference
US11144833B2 (en) Data processing apparatus and method for merging and processing deterministic knowledge and non-deterministic knowledge
CN111178517B (en) Model deployment method, system, chip, electronic equipment and medium
US20220066409A1 (en) Method and system for generating an artificial intelligence model
US10824950B2 (en) System and method for deploying a data analytics model in a target environment
CN112015639A (en) Method and device for generating satellite-borne software test case
US20180039890A1 (en) Adaptive knowledge base construction method and system
CN113157917B (en) OpenCL-based optimized classification model establishing and optimized classification method and system
US20230334292A1 (en) Node fusion method for computational graph and device
US11847436B2 (en) Machine learning (ML) model-based compiler
CN114173355B (en) Method and system for dynamically executing network instruction with separated design running states
CN113031954A (en) Code compiling method and device, electronic equipment, storage medium and heterogeneous system
US11249891B1 (en) Machine-learning framework for testing feedback controller robustness
CN116560666B (en) AI front end unified computing method, device and medium based on multi-level code generation
KR20200053170A (en) Method for setting artificial intelligence execution model and system for acceleration a.i execution
KR102132450B1 (en) Method and apparatus for testing javascript interpretation engine using machine learning
CN116596048A (en) Deep learning model reasoning deployment method and system
KR102610431B1 (en) Apparatus and method for generating summary of program source code based on ai analysis
US20220374740A1 (en) Artificial intelligence inference apparatus and method
KR102574434B1 (en) Method and apparatus for realtime construction of specialized and lightweight neural networks for queried tasks
CN111832218B (en) Spacecraft micro rule reasoning system and method
Rudi et al. CodeFlow: A Code Generation System for Flash-X Orchestration Runtime
JP6263487B2 (en) Process extraction apparatus, process extraction method, and program
KR102591312B1 (en) Apparatus and Method for Converting Neural Network
CN113033337A (en) TensorRT-based pedestrian re-identification method and device

Legal Events

Date Code Title Description
E902 Notification of reason for refusal
E90F Notification of reason for final refusal
E701 Decision to grant or registration of patent right