Domain-specific instruction set determination method
Through the automated domain-specific instruction set determination method, the problem of manual selection of instruction subsets is solved, and the problem of time-consuming and error-prone is achieved, and the instruction subset is quickly filtered and optimized, which improves the construction efficiency and performance of the RISC processor.
Patent Information
- Application Number
- CN202311085097.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-25
- Publication Date
- 2025-02-25
AI Technical Summary
When building RISC processors targeting specific application subfields, designers need to manually analyze and select the right subset of instructions, a process that is time-consuming and error-prone.
Provide a domain-specific instruction set determination method, which determines the optimal instruction subset for application subfields through automation from the domain-specific instruction set, including obtaining the domain-specific instruction set, classifying instructions, determining optimization goals, and building candidate instruction subsets. , filter and optimize the instruction subset, and finally build the optimal instruction subset of the RISC processor.
It realizes rapid filtering and optimization of instruction subsets, improves the construction efficiency of RISC processors, and ensures better performance, power consumption and area balance in specific application subfields.
Smart Images

Figure CN119512729A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing, and in particular to a method for determining a domain-specific instruction set. Background Art
[0002] With the rapid development of science and technology, there is an increasing demand for processors for specialized fields. Specialized fields can be further divided into multiple application sub-fields. RISC (Reduced Instruction Set Computer) processors can be built for specific application sub-fields in order to achieve better performance in these application sub-fields.
[0003] When constructing a RISC processor for a specific application subfield, it is necessary to select the optimal instruction subset from the instruction set of the dedicated field. However, the inventors have found that selecting the optimal instruction subset from a large number of instruction sets to construct a RISC processor for a specific application subfield has the following technical problems:
[0004] Designers usually need to manually analyze and select the appropriate instruction subset, which is a time-consuming and error-prone process. Summary of the invention
[0005] Based on this, an embodiment of the present invention provides a method for determining a domain-specific instruction set to automatically achieve optimal selection of an instruction subset.
[0006] To achieve the above purpose, the embodiment of the present invention provides the following solution:
[0007] A method for determining a domain-specific instruction set is applied to a domain-specific instruction set determination system or electronic device, and the method for determining a domain-specific instruction set includes:
[0008] Acquire a domain-specific instruction set; the domain-specific instruction set is a dedicated instruction set for a specific domain;
[0009] Classifying the instructions in the domain-specific instruction set to obtain instruction subsets of multiple categories;
[0010] Determine an optimization target for each type of workload in a target application sub-field; the optimization target includes at least one of three design factors: performance, power consumption, and area; the target application sub-field is an application sub-field in the dedicated field;
[0011] For each type of workload, multiple groups of candidate instruction subsets are determined; wherein any group of candidate instruction subsets at least includes: some instructions in each instruction subset;
[0012] For each type of workload, multiple groups of candidate instruction subsets are screened and optimized based on the optimization goal to obtain the optimal instruction subset for each type of workload;
[0013] According to the optimal instruction subsets of various workloads, an optimal instruction subset of the RISC processor for the target application subfield is constructed.
[0014] According to the specific embodiments provided by the present invention, the present invention discloses the following technical effects:
[0015] The method for determining a domain-specific instruction set in an embodiment of the present invention initially selects multiple groups of candidate instruction subsets based on feature parameters and corresponding optimization goals, and then further screens and optimizes the multiple groups of candidate instruction subsets to obtain a final optimal instruction subset. The two screenings improve the search efficiency and can quickly and automatically determine the optimal instruction subset from the domain-specific instruction set. The optimal instruction subset is used to construct a RISC processor, thereby improving the construction efficiency of the RISC processor. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0017] Figure 1 An exemplary structural diagram of a domain-specific instruction set determination system provided by an embodiment of the present invention;
[0018] Figure 2 An exemplary flow chart of a method for determining a domain-specific instruction set provided by an embodiment of the present invention;
[0019] Figure 3 Another exemplary flow chart of a method for determining a domain-specific instruction set provided by an embodiment of the present invention;
[0020] Figure 4 Another exemplary flow chart of a method for determining a domain-specific instruction set provided by an embodiment of the present invention;
[0021] Figure 5 An exemplary structural diagram of an electronic device provided for an embodiment of the present invention. DETAILED DESCRIPTION
[0022] The technical solutions in the embodiments of the present invention will be described below in conjunction with the accompanying drawings in the embodiments of the present invention.
[0023] When facing different application sub-fields, the existing RISC processors may not be able to achieve the best balance in terms of performance, power consumption, and area due to the universality of the instruction set. Therefore, it is of great significance to optimize the instruction subset for a specific application sub-field.
[0024] The purpose of the present invention is to provide a method for determining a domain-specific instruction set, which realizes rapid screening of instruction subsets by automatically determining the optimal instruction subset for an application sub-domain from the domain-specific instruction set. Subsequently, an optimized RISC processor can be constructed based on the optimal instruction subset to achieve better performance, power consumption and area balance in a specific application sub-domain.
[0025] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0026] The above-mentioned domain-specific instruction set determination method can be executed by a domain-specific instruction set determination system or an electronic device.
[0027] The electronic device may be a computer (e.g., a special-purpose computer, a general-purpose computer) that provides domain-specific instruction set determination services, an intelligent terminal (e.g., a smart phone, a wearable device, etc.), or other programmable devices, etc. It may also be a large distributed system / device, such as a computer network / cluster, or it may be a device that constitutes a computer network / cluster, without limitation here.
[0028] See also Figure 1 The domain-specific instruction set determination system may exemplarily include: an instruction set acquisition module 101, an instruction classification module 102, an optimization target determination module 103, a candidate instruction subset determination module 104, an instruction screening and optimization module 105, a processor instruction set construction module 106, etc.
[0029] The domain-specific instruction set determination system can be in software or hardware form. When in software form, it can be used as independent software in electronic devices. Of course, it can also be used as a subsystem (subcomponent) of a large system (such as an operating system) to provide domain-specific instruction set determination services;
[0030] When in hardware form, the field-specific instruction set determination system may exemplarily be a controller / processor of an electronic device.
[0031] certainly, Figure 1Each module shown may also be an independent device, or each module may be integrated into one or more devices in any combination. For example, the instruction set acquisition module 101 and the instruction classification module 102 are integrated into one device in the form of software or hardware, the optimization target determination module 103 is an independent device, and the candidate instruction subset determination module 104, the instruction screening and optimization module 105, and the processor instruction set construction module 106 are integrated into one device in the form of software or hardware.
[0032] For another example, the instruction set acquisition module 101, the instruction classification module 102 and the optimization target determination module 103 are integrated into one device in the form of software or hardware, the candidate instruction subset determination module 104 and the instruction screening optimization module 105 are integrated into one device in the form of software or hardware, the processor instruction set construction module 106 is an independent device, etc. Those skilled in the art can integrate any several of the above modules into the same device, which will not be described in detail here.
[0033] This article will provide a more detailed introduction to domain-specific instruction set determination systems and electronic devices later.
[0034] The following describes how to determine the domain-specific instruction set. Figure 2 , which may exemplarily include the following steps:
[0035] Step 201: Obtain a domain-specific instruction set.
[0036] Generally, a domain-specific instruction set can be designed in advance. A domain-specific instruction set is a dedicated instruction set for a specific domain. The domain-specific instruction set will be referred to as a dedicated instruction set in the following.
[0037] Taking the field of digital signal processing as an example, the domain-specific instruction set is specifically a dedicated instruction set for the field of digital signal processing.
[0038] Taking the electronic device executing step 201 as an example, the domain-specific instruction set may be stored on a local storage medium of the electronic device, or may be stored on a non-local storage medium accessible to the electronic device, or stored on other devices accessible to the electronic device. For example, the domain-specific instruction set may be stored on a database, a storage server, etc.
[0039] When the method is executed by a domain-specific instruction set determination system, step 201 may be exemplarily executed by the instruction set acquisition module 101 in the system.
[0040] Step 202: Classify the instructions in the domain-specific instruction set to obtain instruction subsets of multiple categories.
[0041] When the method is executed by a domain-specific instruction set determination system, step 202 may be exemplarily executed by the instruction classification module 102 in the system.
[0042] In an example, see Figure 3 , step 202, specifically includes:
[0043] Step 2021, extracting characteristic parameters of each instruction in the domain-specific instruction set.
[0044] In one example, the domain-specific instruction set can be subjected to static analysis and dynamic analysis to obtain the structural features (Structural Features) and runtime features (Runtime Features) of each instruction. The structural features and runtime features are characteristics of different aspects of the instruction in the instruction set. Then, the characteristic parameters of each instruction can be determined based on the structural features and runtime features.
[0045] Static analysis and dynamic analysis can be performed in parallel or sequentially in any order, which will not be described in detail here.
[0046] The structural features are introduced below. The structural features describe the static properties and components of the instruction. The structural features may include but are not limited to the following: The function of the instruction, which indicates the role of the instruction; the functions include but are not limited to: storage, access, logical operations, etc. The operation code (Opcode) of the instruction, which indicates the type and function of the instruction. The operands (Operands) of the instruction, which indicate the registers, memory addresses or immediate values involved in the instruction. The format (Format) of the instruction, which indicates the layout and arrangement of the instruction in the binary representation. The bit width (BitWidth) of the instruction, which indicates the number of bits or bytes occupied by the instruction. The addressing mode (Addressing Modes) of the instruction, which indicates the way the instruction accesses the operand, such as direct addressing, indirect addressing, etc.
[0047] Runtime characteristics describe the dynamic behavior and performance of instructions during execution. Runtime characteristics may include, but are not limited to, the following: The execution time of the instruction (Execution Time), which represents the time required for the instruction to execute in the processor. The power consumption of the instruction (Power), which represents the energy consumed during the execution of the instruction. The memory access type (MemoryAccessType) of the instruction, which represents the type of memory accessed by the instruction, such as read, write, etc. The parallelism of the instruction (Parallelism), which represents whether the instruction can be executed in parallel or overlapped with other instructions. The data dependencies of the instruction (Data Dependencies), which represents the data dependencies between instructions.
[0048] The characteristic parameters finally determined based on the above structural characteristics and runtime characteristics include but are not limited to instruction function, instruction execution time, instruction power consumption, memory access type involved in the instruction, etc.
[0049] It should be noted that there are many feature extraction methods for extracting feature parameters, including but not limited to principal component analysis (PCA) and linear discriminant analysis (LDA). In addition, deep learning networks can also be used to extract feature parameters.
[0050] Step 2022: Classify the instructions in the domain-specific instruction set according to the instruction functions in the characteristic parameters to obtain instruction subsets of multiple categories.
[0051] For example, domain-specific instruction sets can be divided into multiple instruction subsets based on instruction function classification: storage access instruction subset, logic operation instruction subset, arithmetic operation instruction subset, etc.
[0052] Instructions in different classes of instruction subsets are Turing complete.
[0053] Turing-complete instructions can compute and simulate any possible computer algorithm using a basic set of operations and rules.
[0054] Step 203: Determine the optimization target for each type of workload in the target application sub-domain.
[0055] When the domain-specific instruction set is used to determine the system to execute the above method, step 203 may be exemplarily executed by the optimization target determination module 103 in the system.
[0056] The above-mentioned target application subfield is an application subfield in the special field. Taking the special field of digital signal processing as an example, this field can be subdivided into application subfields such as embedded image processing and real-time image processing, and the target application subfield can be any of these application subfields.
[0057] In one example, the optimization target includes at least one of three design elements: performance (Performance, which may be abbreviated as P), power consumption (Power, which may be abbreviated as W), and area (Area, which may be abbreviated as A); the area refers to the chip area in the processor design.
[0058] First, the workload is introduced.
[0059] Workloads can include various types of computing, data processing, communication, and storage operations.
[0060] Workload refers to a set of tasks or operations performed in a specific application scenario, which represents the actual application requirements and operation mode in a specific application scenario. Workload can be composed of multiple tasks, which may be sequential, parallel or interactive. For example, for the embedded image processing application sub-field, a workload may include tasks such as image acquisition and preprocessing, feature extraction and detection, image processing and enhancement, target tracking and motion estimation, image segmentation and recognition, etc.
[0061] In an example, see Figure 4 , step 203, specifically includes:
[0062] Step 2031, analyzing the workload characteristics of each workload in the target application sub-domain.
[0063] Examples of workload characteristics include, but are not limited to, computing requirement characteristics, data access patterns, parallelism requirement characteristics, data type and precision requirement characteristics, and instruction execution frequency. Precision requirement characteristics may include: data precision level, data selection and rounding rules, error tolerance, numerical stability, and quantization error.
[0064] As mentioned above, a workload may contain multiple tasks, and each task may have different computing requirements, memory access patterns, parallelism requirements, etc., so the requirements for processor performance and resources will also be different. Comprehensive consideration of computing requirements and parallelism requirements can better optimize the design of the processor and the selection of instruction subsets to meet the performance requirements and parallel processing capabilities of the workload. Therefore, understanding and analyzing the workload characteristics of a specific application subfield helps determine the goals of processor optimization and the design of instruction subsets to provide the best balance between performance, power consumption, and area.
[0065] The computing requirements mentioned above characterize the computing resource requirements of each task in the workload, and may further include design factors such as the computational complexity, amount of computation, and computationally intensive operations of each task. Different tasks may require different algorithms and computing operations to complete their functions.
[0066] The parallelism requirement characteristics mentioned above characterize whether tasks can be executed in parallel, that is, whether there are independent subtasks that can be performed simultaneously. This is because, in the workload, some tasks may be executed in parallel, taking advantage of multi-core processors or parallel computing to speed up the processing process. Parallelism requirements can involve design factors such as dependencies between tasks, data dependencies, and the design of parallel algorithms.
[0067] Among them, the instruction execution frequency can be estimated by the following method:
[0068] 1. Static analysis method: By analyzing the task code in the workload, the execution frequency of different instructions in each task can be estimated. For example, the loop structure of the task can be analyzed to determine the execution times of each instruction in the loop body, and the estimated value of the instruction execution frequency can be calculated in combination with the number of loop iterations.
[0069] 2. Simulation execution method: Use a simulator or emulation tool to run the workload in a simulation environment and record the number of times the instructions are executed. By simulating multiple runs of the workload, the average execution frequency of different instructions can be counted.
[0070] 3. Actual operation method: Run the workload on the actual hardware platform and use performance analysis tools to monitor the number of times the instructions are executed. Specifically, this can be achieved through hardware performance counters or other performance analysis tools.
[0071] The above estimated values of instruction execution frequency can be used as a reference to help determine which instructions are executed more frequently in the workload, thereby affecting the optimization direction and strategy of the instruction subset.
[0072] In one example, key indicators (such as instruction execution frequency, data access pattern, etc.) can be further determined from the workload characteristics to facilitate subsequent clustering.
[0073] In addition to the instruction execution frequency and data access pattern mentioned above, key indicators may also include the following: parallelism requirement characteristics, data type and accuracy requirement characteristics, computational complexity and amount of computation characteristics, real-time requirements of tasks, and communication requirements between tasks.
[0074] Step 2032: cluster the workloads in the target application sub-domain based on the workload characteristics to obtain multiple types of workloads.
[0075] Data mining techniques such as cluster analysis can be used to group workloads according to certain similarities to obtain different categories. Each category represents a type of workload with certain commonalities and characteristics.
[0076] There are many ways to cluster. For example, a k-means clustering method can be used to cluster the workloads in the target application sub-domain to obtain multiple categories, each of which includes at least one workload.
[0077] Specifically, when the k-means clustering method is used for clustering, the clustering may be preset to be k clusters. Assuming k=20, the final clustering will obtain 20 clusters (ie, classifications), and each cluster includes at least one workload.
[0078] Each workload can be considered as a sample / data point. The clustering process of the k-means clustering method exemplarily includes:
[0079] (1) Initialization. Randomly select k samples as the centers of the initial clusters (referred to as cluster centers for short).
[0080] (2) Cluster the samples.
[0081] For the cluster center selected during initialization, the distance from all samples to each center is calculated. The default Euclidean distance is used, and each sample is clustered into the class of the center closest to it to form the clustering result.
[0082] (3) Calculate the cluster center after clustering, and calculate the centroid of each class, that is, the mean of the samples in each class, as the new class center.
[0083] (4) Then re-execute steps (2) and (3) until the clustering results no longer change.
[0084] In one example, workloads can be clustered based on key metrics such as instruction execution frequency, data access patterns, etc. to better understand and describe different types.
[0085] The workload (samples / data points) can be in the form of vector representation (x1, x2, ... xn).
[0086] In an example, each element in the above vector representation corresponds to a task of the workload. Taking the above workload including six tasks of image acquisition and preprocessing, feature extraction and detection, image processing and enhancement, target tracking and motion estimation, and image segmentation and recognition as an example, the workload can be expressed as: (x1, x2,...x6).
[0087] Furthermore, any element in the above vector representation may be a subvector, and each element in the subvector may correspond one-to-one to each indicator in the key indicators. Taking x1 as an example, assuming that x1 corresponds to the image acquisition and preprocessing task, x1 may be a subvector, and each element of x1 may correspond one-to-one to the key indicator of the image acquisition and preprocessing task, and the value of the element corresponds to the value of the corresponding indicator. In order to facilitate the calculation of the distance between samples / data points, the values of the elements in the subvector may be quantized (normalized) as numerical values.
[0088] In another example, each element in the above vector representation may correspond one-to-one to each of the above indicators.
[0089] Assuming the total number of key indicators is 2, each workload (sample / data point) can be represented as a vector (x1, x2).
[0090] The elements in the vector (x1, x2) can be further divided into sub-vectors, including the quantized values of multiple tasks on the corresponding key indicators. Taking x2 as an example, assuming that it corresponds to the key indicator of data type, since a workload may include multiple tasks, x2 can further include the quantized value of the data type of each task. For example, assuming that a workload includes 9 tasks, then in the vector form of its workload characteristics, the second element (x2) can include the quantized value of the quantity type of each of the 9 tasks (can be expressed using x2. 21 -x 29 ), then the vector (x1,x2) can be expressed as (x1,(x 21 , x 22 ,……,x 29 )).
[0091] Those skilled in the art can flexibly design the range of the quantization value. For example, assuming there are M data types, M different decimals between 0 and 1 can be selected to represent different data types, and the quantization of the data types can be achieved. These M different decimals are the quantization values of the data types.
[0092] As for how to quantify the values of other key indicators, please refer to the above records and will not be elaborated here.
[0093] Alternatively, in yet another example, each element in the above vector representation corresponds to each key indicator one by one, and the value of each element is the average quantized value of multiple tasks on the corresponding key indicator.
[0094] Assuming that the total number of key indicators is 2, each workload (sample / data point) can be represented as a vector (x1, x2). Taking x2 as an example, assuming that it corresponds to the key indicator of data type, and assuming that a workload includes 9 tasks, then in this example, the value of x2 is: the average value of the data type quantization values of these 9 tasks.
[0095] Step 2033, determining the optimization target for each type of workload based on the performance, power consumption, and area requirements of each type of workload.
[0096] In the aforementioned steps, workload classification is mentioned. Furthermore, each type of workload may have at least one typical workload.
[0097] Typical workloads refer to representative and common workload samples in a specific application subfield. When determining typical workloads, one or more representative workloads are usually selected from each category of workloads as typical samples. These typical workloads are representative and can reflect the characteristics and requirements of the workloads in that category. Therefore, there is a representative and relevant relationship between typical workloads and various types of workloads.
[0098] Therefore, in one example, the optimization goals and demand characteristics of a certain type of workload may be specifically the optimization goals and demand characteristics of its typical workload.
[0099] The workload generally includes one or more tasks. The optimization target of the typical workload may further include: the optimization target of each task included in the typical workload. For example, assuming that the typical workload includes a real-time image processing task and another task, wherein the optimization target of the image processing task includes performance and power consumption, and the optimization target of the other task includes performance, then the optimization target of the typical workload may include performance and power consumption.
[0100] The typical workload includes the requirements of each task in terms of performance, power consumption, and area. Using the previous example, assuming that the requirements of the real-time image processing task include the requirements of performance and power consumption, and the requirements of another task include the requirements of performance, then the requirements of the typical workload include the requirements of performance and power consumption.
[0101] Step 204: For each type of workload, determine (construct) multiple groups of candidate instruction subsets.
[0102] Among them, any group of candidate instruction subsets at least includes: some instructions in the above-mentioned instruction subsets.
[0103] Specifically, any group of candidate instruction subsets includes multiple candidate instruction subsets, and the multiple candidate instruction subsets may correspond to different categories.
[0104] The candidate instructions in the candidate instruction subset can be understood as instruction encodings or combinations of instructions. The candidate instruction subset can be regarded as a set of instruction encodings with advantages for building an optimized processor design.
[0105] The aforementioned step 202 introduces that the instructions in the dedicated instruction set are divided into multiple categories of instruction subsets according to instruction functions.
[0106] In one example, similarly, when constructing any set of candidate instruction subsets, they can also be classified and constructed according to different functions, but are not limited to classification by function. The purpose of classification is to better organize and manage instructions and optimize them according to the needs of specific application subfields.
[0107] Taking the classification and construction based on function as an example, it was mentioned above that the instructions in the dedicated instruction set are divided into multiple categories of instruction subsets according to their functions, for example, storage access instruction subsets, logical operation instruction subsets, arithmetic operation instruction subsets, and other instruction subsets of each functional category.
[0108] When constructing any group of candidate instruction subsets according to functions, a part of instructions can be selected from the instruction subsets of each functional category to form a candidate instruction subset corresponding to the functional category.
[0109] For example, assuming that the domain-specific instruction set is divided into 10 categories according to function, the functional category of the first category instruction subset is storage access class, including storage access class instructions, the functional category of the second category instruction subset is logic operation class, including logic operation class instructions, and so on. When constructing a set of candidate instruction subsets, a part of instructions can be selected from the first category instruction subset to form a candidate instruction subset corresponding to the storage access class function; similarly, a part of logic operation class instructions can be selected from the second category instruction subset to form a candidate instruction subset corresponding to the logic operation class function, and so on, and selections are also made for other functional categories.
[0110] The above classification method can help the system better organize and describe the characteristics of the instruction set, making the candidate instruction subset more readable and manageable.
[0111] In other embodiments of the present invention, the construction of any group of candidate instruction subsets is not limited to classification by function, but should also take into account the requirements and optimization goals of specific application sub-fields. This can ensure that the candidate instruction subsets achieve a better balance in terms of performance, power consumption, and area to meet the requirements of specific application sub-fields.
[0112] For example, if the optimization goal includes optimizing performance (such as execution efficiency, real-time), instructions can be selected based on execution time to construct any set of candidate instruction subsets. Specifically, instructions with relatively short execution time can be preferentially selected to construct candidate instruction subsets.
[0113] For another example, if the optimization goal includes the optimization of power consumption, then any set of candidate instruction subsets can be constructed based on power consumption selection instructions, and specifically, instructions with relatively low power consumption can be preferentially selected to construct the candidate instruction subsets; for another example, if the optimization goal includes the optimization of parallelism, then any set of candidate instruction subsets can be constructed based on parallelism, and specifically, instructions supporting parallelism can be preferentially selected. And so on, no further elaboration is given.
[0114] In addition, in other embodiments of the present invention, all of the above embodiments can also construct candidate instruction subsets in combination with workload characteristics. For example, the aforementioned estimated value of instruction execution frequency can be combined with the estimated value to determine which instructions are executed more frequently in the workload, so that when constructing any set of candidate instruction subsets, instructions with relatively higher execution frequencies are preferentially selected.
[0115] In addition to directly selecting instructions, in other embodiments of the present invention, all of the above embodiments may combine instructions to implement specific functions or operations when constructing any set of candidate instruction subsets, thereby more effectively adapting to specific application sub-fields.
[0116] For example, suppose that in a certain application subfield, matrix multiplication and convolution are frequently performed operations, but these operations are not implemented by instructions with corresponding functions in the domain-specific instruction set, or are implemented by very few instructions even if they are available.
[0117] Then, instruction combinations can be selected from the domain-specific instruction set to form multiple instruction combinations, each of which can implement the same operation, for example, matrix multiplication. Then the multiple instruction combinations with the same functions can constitute a candidate instruction subset for matrix multiplication.
[0118] For another example, for a feature extraction operation in a target tracking task, instructions can be selected from an instruction set to be combined to obtain multiple instruction combinations, each of which can implement a feature extraction operation. Such instruction combinations constitute a candidate instruction subset for the feature extraction operation.
[0119] Similar processing can be performed for other specific operations such as convolution operations to obtain corresponding candidate instruction subsets.
[0120] Of course, for an existing functional category, instructions may be selected from a domain-specific instruction set to form at least one instruction combination to implement the existing functional category. For example, assuming that the instructions of the storage access class in the domain-specific instruction set do not support parallel storage, instructions may be selected from the domain-specific instruction set to form at least one instruction combination, and the obtained instruction combination may support parallel storage, which will not be described in detail here.
[0121] That is, for a specific functional category or specific operation, a candidate instruction subset for the specific functional category or specific operation can be constructed, and the candidate instruction subset includes multiple instruction combinations that implement the specific functional category or specific operation, and each instruction combination is obtained by combining instructions selected from the domain-specific instruction set. These instruction combinations should be able to effectively perform corresponding operations and implement corresponding functions in specific application sub-domains and meet optimization goals.
[0122] In other embodiments of the present invention, when constructing any set of candidate instruction sets, all the above embodiments may also construct a candidate instruction subset that implements a specific task in the workload. The specific task may be a frequently executed task, a task that has a greater impact on the optimization target, or any task.
[0123] Taking the image compression task as an example, at least one instruction combination can be selected from the dedicated instruction set so that each instruction combination can implement the image compression task. Such instruction combinations constitute a candidate instruction subset for image compression in image processing.
[0124] That is, in this embodiment, a candidate instruction subset for a specific task can be constructed, and the candidate instruction subset includes multiple instruction combinations for implementing the specific task, and each instruction combination is obtained by combining instructions selected from the domain-specific instruction set. Each combination can effectively implement the corresponding task and is evaluated and selected in the subsequent optimization process.
[0125] Regardless of the method used to construct the candidate instruction subset, construction constraints can be set according to the needs of the application sub-domain, such as the size of the maximum subset, minimum performance requirements, etc.
[0126] The size of the largest subset and the minimum performance requirement can be determined based on instruction characteristic parameters and workload key indicators.
[0127] For example, suppose the optimization goal includes performance and power consumption, where the performance metric is execution time and the power consumption metric is power consumption. The way to determine the size of the maximum subset and the minimum performance requirement based on the above two criteria is as follows:
[0128] Determine the size of the maximum subset: Based on resource constraints and optimization goals, select an appropriate maximum subset size. Assuming that the processor has a certain number of physical resources, such as registers, functional units, etc., the size of the maximum subset can be ensured not to exceed the resource limit of the processor according to the limitations of these resources to avoid overly complex instruction subsets.
[0129] Determination of minimum performance requirements: Based on performance goals, for example, the desire to optimize performance, that is, to shorten execution time. When evaluating each group of candidate instruction subsets, select the instruction subset that performs better in terms of execution time. Assuming that an evaluation method is used, for each candidate instruction subset, a quantitative value of the execution time (e.g., a value between 0 and 1) can be used to measure its execution time performance. Then, a threshold is set as the minimum performance requirement, and instruction subsets whose execution time quantitative values are lower than the threshold are selected as candidate instruction subsets.
[0130] When the above method is executed by a domain-specific instruction set determination system, step 204 may be exemplarily performed by the candidate instruction subset determination module 104 in the system.
[0131] Step 205: For each type of workload, multiple groups of candidate instruction subsets are screened and optimized based on the optimization target to obtain the optimal instruction subset for each type of workload.
[0132] When the above method is executed by a domain-specific instruction set determination system, step 205 may be exemplarily executed by the instruction screening optimization module 105 in the system.
[0133] In one example, screening may be performed first and then optimization, and step 205 may specifically include:
[0134] 1. Screen multiple groups of candidate instruction subsets for each type of workload to obtain an initial screened instruction subset for each type of workload.
[0135] Different screening methods can be used for screening, and two screening methods are provided as examples below. These two methods can be used either alone or in combination.
[0136] Screening method 1 (verification method):
[0137] (1) Simulate or actually run each candidate instruction subset on a corresponding typical workload. By analyzing and evaluating typical workloads, we can better understand the workload characteristics of a specific application subfield and further determine the optimization goals and instruction subset selection. Typical workloads can be used to analyze and optimize instruction subsets to meet the needs of a specific application subfield.
[0138] In step 203, an example is given where a certain workload may include tasks such as image acquisition and preprocessing, feature extraction and detection, image processing and enhancement, target tracking and motion estimation, image segmentation and recognition, etc.
[0139] In the above examples, each task can be considered as a subtask or a specific operation. These tasks can form a typical workload, representing the actual requirements and operation modes in a specific application field. Therefore, the entire set of tasks in the above examples (image acquisition and preprocessing, feature extraction and detection, image processing and enhancement, object tracking and motion estimation, image segmentation and recognition) can be regarded as a typical workload.
[0140] (2) Evaluate the operation evaluation results of each group of candidate instruction subsets during the operation process; the operation evaluation results are used to characterize the performance of the group of candidate instruction subsets on each design element included in the optimization target.
[0141] Assuming that the optimization target includes two design elements, the operation evaluation result includes evaluation values for the two design elements. For example, taking the optimization target including performance as an example, the operation evaluation result includes evaluation values for performance.
[0142] If the design factor further includes design sub-factors, the evaluation value for the design factor in the operation evaluation result may further include the evaluation value for the design sub-factors. For example, assuming that the design factor of performance further includes execution efficiency, the operation evaluation result includes the evaluation value for execution efficiency.
[0143] Those skilled in the art can flexibly design the value range of the evaluation value, for example, it can be 0-1, which will not be elaborated here.
[0144] In addition, if a design element or design sub-element has only two possibilities, "yes" and "no", its corresponding evaluation value can be 0 or 1 (of course, it can also be two other different numerical values / characters).
[0145] (3) Determine an initial screening instruction subset for the workload type based on at least the running evaluation results of each group of candidate instruction subsets.
[0146] In this step, each group of candidate instruction subsets can be screened according to the running evaluation results to obtain a candidate instruction subset that performs relatively better in terms of the optimization goal as the initial screened instruction subset.
[0147] For example, assuming that the optimization objectives include power consumption and area, and assuming that there are P groups of candidate instruction subsets, and the running evaluation results of each group of candidate instruction subsets represent their performance in power consumption and area, then at least one group of candidate instruction subsets that can reduce power consumption and area can be selected from the P groups of candidate instruction subsets as the initial screening instruction subset.
[0148] It should be noted that the above screening process evaluates the performance of the candidate instruction subset on a specific workload through actual application or simulation operation, which is closer to the actual application scenario, but may require a longer time and resources.
[0149] Screening method 2 (evaluation method):
[0150] (1) Using an evaluation method to perform quantitative evaluation on each set of candidate instruction subsets to obtain a quantitative evaluation result. The quantitative evaluation result includes a quantitative value of the set of candidate instruction subsets on each design element included in the optimization target; each quantitative value is used to characterize the performance of the set of candidate instruction subsets on each design element included in the optimization target.
[0151] Assuming that the optimization target includes two design elements, the quantitative evaluation result includes the quantitative values for the two design elements. For example, taking the optimization target including performance as an example, the operation evaluation result includes the quantitative value for performance.
[0152] If the design factor further includes design sub-factors, the quantitative value for the design factor in the quantitative evaluation result may further include the quantitative value for the design sub-factors. For example, assuming that the design factor of performance further includes execution efficiency, the quantitative evaluation result includes the quantitative value for execution efficiency.
[0153] Those skilled in the art can flexibly design the range of the quantization value, for example, it can be 0-1; still taking the execution efficiency as an example, in the quantitative evaluation result, the quantization value of the execution efficiency can be any value between 0-1, which represents the quality of the execution efficiency.
[0154] In addition, if a design element or a design sub-element has only two possibilities, “yes” and “no”, its corresponding quantitative value may be 0 or 1 (of course, it may also be two other different numerical values / characters).
[0155] Examples of the above evaluation methods include but are not limited to:
[0156] Simulator evaluation: Use a computer system simulator to simulate the execution of a subset of candidate instructions and collect performance, power consumption, and area metrics for evaluation. The simulator can provide detailed analysis of instruction execution behavior and performance estimates.
[0157] Hardware accelerator evaluation: Each candidate instruction subset is deployed on a hardware accelerator (such as FPGA, ASIC, etc.) for actual operation, and its performance on different optimization targets is measured. Hardware accelerators can provide more realistic execution environments and performance data.
[0158] Benchmark evaluation: Use a series of known benchmark programs to evaluate the performance of each candidate instruction subset under different workloads. Benchmarks can provide performance predictions for each candidate instruction subset in actual application scenarios.
[0159] Analysis tool evaluation: Based on instruction set simulation models, performance analysis tools, debuggers, and code analysis tools, each group of candidate instruction subsets is used to quickly simulate the implementation workload to evaluate the performance bottlenecks, memory access patterns, parallelism requirements, and other characteristics of the candidate instruction subsets in the application sub-domain workload.
[0160] These assessment methods can be used in combination or individually, and the appropriate method can be selected for assessment based on specific needs and feasibility.
[0161] (2) Determine an initial screening instruction subset for the workload type based on at least the quantitative evaluation results of each group of candidate instruction subsets.
[0162] In this step, each group of candidate instruction subsets can be screened according to the quantitative evaluation results to obtain a candidate instruction subset that performs relatively better in terms of the optimization goal as the initial screened instruction subset.
[0163] For example, assuming that the optimization objectives include power consumption and area, and assuming that there are P groups of candidate instruction subsets, and each group of candidate instruction subsets has its own quantitative evaluation results in power consumption and area, then one or more groups of candidate instruction subsets with smaller power consumption quantization values and smaller area quantization values can be selected from the P groups of candidate instruction subsets as the initial screening instruction subsets.
[0164] It should be noted that the evaluation method uses simulation tools or other performance evaluation tools to perform rapid simulation and quantitative evaluation. Compared with the verification method, it is faster but may have relatively lower accuracy.
[0165] The two methods mentioned above can be used in combination. There are many ways to combine them, for example:
[0166] First, after obtaining the screening instruction subsets using the two methods respectively, the intersection or union can be taken to obtain the final screening instruction subset.
[0167] The second method is to obtain the operation evaluation results and the quantitative evaluation results corresponding to each group of candidate instruction subsets, and then use the operation evaluation results and the quantitative evaluation results to jointly determine the initial screening instruction subset.
[0168] The third method is to first use the evaluation method to determine X groups of screening instruction subsets from each group of candidate instruction subsets, and then use the verification method to further screen the X groups of screening instruction subsets:
[0169] It should be noted that if Y groups of candidate instruction subsets are constructed through step 104, X needs to be smaller than Y, and X can generally be designed to be much smaller than Y.
[0170] Taking X=20 as an example, assuming that a total of 1000 candidate instruction subsets are constructed through step 104, an evaluation method can be first used to quickly screen out 20 candidate instruction subsets (referred to as target candidate instruction subsets) from these 1000 groups.
[0171] Then, the verification method is used to screen the above 20 groups of target candidate instruction subsets to obtain a screened instruction subset, which may specifically include:
[0172] Simulate or actually run each of the 20 groups of target candidate instruction subsets on a corresponding typical workload; evaluate the operation evaluation results of each group of target candidate instruction subsets during the operation; and determine an initial screening instruction subset based on at least the operation evaluation results of each group of target candidate instruction subsets.
[0173] Please refer to the above records for specific details, which will not be elaborated here.
[0174] The above-mentioned various combinations can complement each other. They can verify the performance of candidate instruction subsets through actual operation and perform rapid performance quantitative evaluation through simulation and evaluation tools. This can more comprehensively evaluate the advantages and disadvantages of candidate instruction subsets and find the optimal instruction subset in terms of PPA.
[0175] 2. Use the optimization algorithm to optimize the initial screening instruction subset for each type of workload to obtain the optimal instruction subset for each type of workload.
[0176] Specifically, an exemplary optimization process of this step may be: using a genetic algorithm or a simulated annealing algorithm to optimize the initial screening instruction subset for each type of workload to obtain the optimal instruction subset for each type of workload. This article will provide a more detailed introduction later.
[0177] Step 206: construct an optimal instruction subset of a “RISC processor for a target application subfield” based on the optimal instruction subsets for each type of workload.
[0178] When the method is executed by a domain-specific instruction set determination system, step 206 may be exemplarily executed by a processor instruction set construction module 106 in the system.
[0179] In one example, step 206 specifically includes:
[0180] The optimal instruction subsets of all categories of workloads are combined to obtain the optimal instruction subset of the target application subfield; the obtained optimal instruction subset is used to construct a RISC processor in the target application subfield.
[0181] The following is an application example to illustrate the method for determining the above-mentioned field-specific instruction set.
[0182] Assume that the application sub-field is embedded image processing system, as follows:
[0183] 1. Instruction set analysis and feature extraction
[0184] (1) Classify the pre-designed domain-specific instruction set. Classify and obtain N instruction subsets of different functional categories (such as storage access instruction subsets, logic operation instruction subsets, arithmetic operation instruction subsets, etc.). For details, please refer to the above records and will not be repeated here.
[0185] (2) Use feature extraction methods, such as principal component analysis (PCA), linear discriminant analysis (LDA), and deep learning networks, to perform static and dynamic analysis on the instruction set to obtain feature parameters. After static and dynamic analysis, structural features (such as instruction opcodes, addressing modes, etc.) and runtime features (such as instruction execution time, power consumption, memory access type, etc.) can be obtained. For details, please refer to the above records and will not be repeated here.
[0186] 2. Workload analysis and optimization target determination
[0187] (1) Analyze the workload of application sub-domains.
[0188] This part corresponds to the aforementioned step 203. Specifically, it may include classifying the workloads of the application sub-fields, and further, at least one typical workload may be determined from each type of workload.
[0189] For an embedded image processing system, a workload may include the following tasks:
[0190] Image acquisition and preprocessing tasks: Acquire image data from sensors or external devices and perform preprocessing operations such as denoising, filtering, color space conversion, etc.
[0191] Feature extraction and detection tasks: Extract key features such as edges, corners, textures, etc. based on image data for applications such as target detection, target recognition, or image analysis.
[0192] Image processing and enhancement tasks: Various image processing algorithms such as image deblurring, image restoration, image enhancement, image compression, etc. can be applied to improve image quality or meet specific requirements.
[0193] Target tracking and motion estimation tasks: track the position and motion of the target in consecutive image frames, and estimate the target's trajectory, speed and other information.
[0194] Image segmentation and recognition tasks: Segment an image into different regions or objects and perform tasks such as object recognition, classification, or semantic segmentation.
[0195] (2) Extract key metrics of the workload, such as instruction execution frequency, data access patterns, etc.
[0196] For details on how to extract, please refer to the introduction in the workload characteristics section above and will not be elaborated here.
[0197] (3) Determine the optimization goals and demand characteristics of each workload.
[0198] The optimization target includes at least one of performance, power consumption and area.
[0199] Specifically, the optimization objectives and demand characteristics of a typical workload may be selected as the optimization objectives and demand characteristics of a class of workloads.
[0200] More specifically, the optimization target of a typical workload may further include: the optimization target of each task included in the workload. And the demand characteristics of a typical workload may include the demand characteristics of each task.
[0201] Taking a typical workload including edge detection task, image compression task, target tracking task, and image enhancement task as an example, their respective requirements and optimization goals are as follows:
[0202] The characteristics of edge detection task requirements mainly include performance requirements: sensitive to edges, requiring high-precision edge detection algorithms and operations; high execution frequency; optimization goals are mainly aimed at performance, including: optimizing the performance and accuracy of edge detection algorithms; optimizing the execution efficiency of edge detection operations.
[0203] The characteristics of image compression task requirements mainly include performance requirements: compression and encoding of image data requires processing of large amounts of data; efficient compression algorithms and data processing operations are required; optimization goals are mainly aimed at performance, including: improving the compression ratio and image quality of the image compression algorithm; optimizing the speed and efficiency of data processing operations.
[0204] The characteristics of target tracking task requirements mainly include performance requirements: tracking and identifying targets in real-time images requires real-time and accuracy; complex target detection and tracking algorithms are required; optimization goals are mainly aimed at performance, including: improving the real-time and accuracy of target tracking algorithms; optimizing the efficiency of image processing and feature extraction operations.
[0205] The requirements of image enhancement tasks mainly include performance requirements: to enhance, repair and improve images, various filtering, denoising and repair algorithms need to be applied; the optimization goals are mainly aimed at performance, including: improving the effect and processing speed of image enhancement algorithms. Optimizing the execution efficiency of filtering and repair operations.
[0206] 3. Candidate instruction subset generation and evaluation
[0207] (1) For the application sub-field of embedded image processing system, according to the results obtained in step 1 and step 2 (instruction subsets of multiple categories, characteristic parameters of instructions, optimization goals and demand characteristics of each type of workload, etc.), a part of instructions is selected from the instructions of each functional category to generate multiple groups of candidate instruction subsets.
[0208] The method for constructing any group of candidate instruction subsets can be found in the above records and will not be elaborated here.
[0209] (2) Use the verification method to select at least one group (corresponding to the aforementioned filtered instruction subset) from multiple groups of candidate instruction subsets.
[0210] The candidate instruction subset can be applied to a typical workload, and the performance of the candidate instruction subset on the optimization target can be evaluated through simulation or actual operation. For details, please refer to the above records in this article, which will not be repeated here.
[0211] In addition, in other embodiments of the present invention, the verification method and the evaluation method may be used in combination. The combination method may refer to the above description and will not be described in detail here.
[0212] 4. Optimization of candidate instruction subsets
[0213] (1) Use optimization algorithms, such as genetic algorithms or simulated annealing algorithms, to further screen and optimize the candidate instruction subsets.
[0214] The following describes the optimization process using the simulated annealing algorithm as an example:
[0215] 1) According to the characteristics and requirements of the workload in the application sub-field of embedded image processing system, the parameters involved in the simulated annealing algorithm are set, such as objective function, initial solution state, initial temperature, temperature, and control parameters.
[0216] Define the objective function of the simulated annealing algorithm. The objective function can be determined based on the instruction characteristic parameters and workload key indicators of the aforementioned screening instruction subset to quantify the performance of the initial screening instruction subset in a specific application subfield (embedded image processing system).
[0217] Furthermore, when determining the objective function, the following aspects can be considered:
[0218] Workload requirements: According to the characteristics and requirements of the workload, determine the main measurement indicators of the objective function. These indicators can be performance, power consumption, area, real-time, accuracy, etc., and are selected according to the specific application scenario.
[0219] Optimization goal: Based on the workload requirements and the goal of system performance optimization, determine the specific form of the objective function. The objective function can be a single indicator or a comprehensive evaluation of multiple indicators. For example, methods such as weighted sum or weighted average can be used to comprehensively consider the importance of different indicators.
[0220] Influence of instruction characteristic parameters: Consider the influence of instruction characteristic parameters in the candidate instruction subset on the objective function. Instruction characteristic parameters may include instruction execution time, memory access mode, parallelism requirements, etc. Based on the relationship between these parameters and the objective function, the objective function can be modeled accordingly.
[0221] For example, instruction execution time and parallelism requirements may be related to performance and real-time performance. In this case, instruction execution time and parallelism requirements can be used as independent variables, and performance and real-time performance can be used as dependent variables to establish a functional relationship between the independent and dependent variables.
[0222] Initial solution state: The initial solution state is a starting point at the beginning of the simulated annealing algorithm, which is usually composed of a set of initial instructions in the initial screening instruction subset. The selection of the initial solution state can be based on the characteristic parameters of the candidate instruction subset and the key indicators of the workload, such as selecting some common instructions or instructions with high frequency as part of the initial solution state.
[0223] Initial temperature, temperature and control parameters: These parameters determine the degree of exploration and convergence of the search space in the simulated annealing algorithm. Their selection can take into account the characteristic parameters of the candidate instruction subset and the key indicators of the workload. For example, the initial temperature can be set according to indicators such as performance and power consumption of the candidate instruction subset, and the temperature and control parameters can be adjusted according to the key indicators of the workload and the optimization goal to achieve better optimization results.
[0224] Furthermore, the setting of the initial temperature can be implemented in a variety of ways, for example, random setting or heuristic setting.
[0225] Random setting: The search space can be explored by randomly generating initial temperatures within a certain range. The size of the initial temperature should match the scale and characteristics of the problem. Generally speaking, a larger initial temperature can make it easier for the algorithm to escape from the local optimal solution, but may lead to slower convergence.
[0226] Heuristic setting: Set a reasonable initial temperature based on the characteristics of the problem and empirical knowledge. For example, the initial temperature can be set based on the constraints of the problem, the range of the objective function, or existing heuristic information.
[0227] The above control parameters (such as cooling strategy, acceptance criteria, and number of iterations) are set as follows:
[0228] Cooling strategy: The cooling strategy determines the rate of temperature drop. Common strategies include linear cooling, exponential cooling, and logarithmic cooling. The choice of cooling strategy and the setting of parameters can be adjusted according to the complexity of the problem and the characteristics of the search space.
[0229] Acceptance criterion: The acceptance criterion defines how to accept or reject a new solution. A common acceptance criterion is the Metropolis criterion, which means that if a new solution is better than the current solution, the new solution is accepted; otherwise, the new solution is accepted with a certain probability, the size of which is related to the temperature. The parameters in the acceptance criterion can be adjusted according to the characteristics of the problem to balance the capabilities of global search and local search.
[0230] Iterations: Controls the total number of algorithm iterations or termination conditions. You can set an appropriate number of iterations based on the complexity of the problem and the convergence of the algorithm.
[0231] 2) Determine the relationship between the above parameters and the initial subset of screened instructions and key workload indicators, which can be adjusted and optimized through experiments and experience.
[0232] It should be noted that the setting of initial temperature and control parameters usually requires certain experience and experimental adjustment. According to the specific problem and actual situation, multiple tests and optimizations can be carried out to find the best parameter combination to obtain better algorithm performance and optimization results.
[0233] The following introduces the optimization involving genetic algorithm. The parameters of genetic algorithm can be set as follows:
[0234] Population, crossover probability, and mutation probability settings: For example, the population size can be set to 50, the crossover probability to 0.8, and the mutation probability to 0.1.
[0235] The individuals in the genetic algorithm are the instructions in the selection instruction subset;
[0236] In addition, if genetic algorithms are used for optimization, selection operators, mutation operators, and crossover operators are methods used to operate individuals in genetic algorithms, and they are determined as follows:
[0237] Selection Operator: The selection operator is used to select individuals to enter the next generation. In the process of determining fitness, key indicators of various workloads under the embedded image processing system can be used as criteria for measuring the quality of individuals, such as performance, power consumption, and area. Based on the evaluation results of these indicators, individuals with better performance are selected as the next generation population.
[0238] Mutation Operator: The mutation operator is used to randomly mutate individuals to increase the diversity of the population. The mutation method can be determined based on the instruction characteristic parameters in the previously obtained filter instruction subset, including but not limited to: changing the execution order of instructions, changing the parameter settings in the instructions, or other mutation operations. The purpose of mutation is to explore a wider solution space by introducing randomness.
[0239] Crossover Operator: The crossover operator is used to generate new individuals by exchanging certain features between two individuals to generate offspring. The crossover method can consider the combination of instructions in the screening instruction subset obtained above and the combination of feature parameters. For example, a new individual can be generated by exchanging certain instructions in the screening instruction subset or changing the order of instructions.
[0240] Fitness is an indicator for evaluating the performance of an individual under a given workload. It is related to the instructions in the filter instruction subset and the data of the key indicators of the workload. The specific determination method can be to design a fitness function based on the demand characteristics and optimization goals of the workload. The fitness function can comprehensively consider the data of the key indicators of the workload, such as real-time performance, accuracy, processing speed, etc., and quantify these indicators into fitness values to evaluate the pros and cons of the individual.
[0241] It should be noted that the design of specific selection operators, mutation operators, crossover operators, and fitness functions needs to be customized according to the specific problem to ensure that they match the initial screening instruction subset and the characteristics of the workload and achieve effective optimization.
[0242] (2) According to instruction characteristic parameters, workload key indicators and optimization goals, adjust the parameters and strategies of the optimization algorithm to obtain a better instruction subset in a specific application sub-field.
[0243] For example, taking the simulated annealing algorithm as an example, during the optimization process, the appropriate objective function and initial solution state can be selected according to the characteristic parameters of the initial screening instruction subset, the key indicators of the workload and the optimization goals, and the settings of the initial temperature, temperature and control parameters can be adjusted to find the optimal simulated annealing algorithm parameter combination and obtain the optimal instruction subset in a specific application subfield. This requires multiple experiments and repeated adjustments to obtain the best parameter configuration and optimization results, and finally obtain the optimal instruction subset for each type of workload.
[0244] In addition, in other embodiments of the present invention, if there is more than one set of screening instruction subsets, each set of screening instruction subsets can be optimized using an optimization algorithm, and then each optimized set of screening instruction subsets can be screened using a screening method to obtain the final optimal instruction subset. How to use the screening method for screening can be referred to the above record, and will not be repeated here.
[0245] 5. Output the optimal instruction subset
[0246] (1) Output the optimal instruction subset after optimization, which can be used to build a RISC processor for real-time image processing with higher performance and lower power consumption.
[0247] (2) Provide detailed information such as instruction encoding, instruction operation, and instruction control signals to facilitate subsequent processor design and implementation.
[0248] The above process shows the process of analyzing, generating, evaluating and optimizing candidate instruction subsets according to the method from step 1 to step 5, and finally obtaining the optimal instruction subset suitable for a specific application subfield. By realizing automated and optimized instruction subset selection, it has strong versatility and is easy to implement while improving efficiency and accuracy. In addition, the above method can be widely used in various embedded systems, such as smartphones, IoT devices, autonomous driving vehicles, etc., which will help promote technological progress and industrial development in related fields.
[0249] In order to execute the above-mentioned domain-specific instruction set determination method to achieve corresponding functions and technical effects, a domain-specific instruction set determination system is provided below.
[0250] See also Figure 1 , the above-mentioned field-specific instruction set determination system includes:
[0251] The instruction set acquisition module 101 is used to acquire a domain-specific instruction set; a domain-specific instruction set is a dedicated instruction set for a specific domain.
[0252] The instruction classification module 102 is used to classify the instructions in the domain-specific instruction set to obtain instruction subsets of multiple categories.
[0253] The optimization target determination module 103 is used to determine the optimization target of each type of workload in the target application sub-field; the optimization target includes at least one of the three design elements of performance, power consumption and area; the target application sub-field is an application sub-field in the dedicated field.
[0254] The candidate instruction subset determination module 104 is used to determine multiple groups of candidate instruction subsets for each type of workload according to the optimization objectives and characteristic parameters of each instruction in the domain-specific instruction set; wherein any group of candidate instruction subsets at least includes: some instructions in each instruction subset.
[0255] The instruction screening and optimization module 105 is used to screen and optimize multiple groups of candidate instruction subsets based on the optimization target for each type of workload to obtain the optimal instruction subset for each type of workload;
[0256] The processor instruction set construction module 106 is used to construct an optimal instruction subset for the RISC processor for the target application sub-field according to the optimal instruction subset for each type of workload.
[0257] For specific details, please refer to the previous record in this article and will not be repeated here.
[0258] Figure 5A possible hardware structure of the electronic device is shown, including: a bus, a processor, a memory, a communication interface, an input device, and an output device. The processor, the memory, the communication interface, the input device, and the output device are interconnected via the bus. Among them:
[0259] A bus may include a pathway that transfers information between components of a computer system.
[0260] The processor can be a general-purpose processor, such as a general-purpose central processing unit (CPU), a network processor (Network Processor, NP for short), a microprocessor, etc., or it can be an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the program of the scheme of the present invention, or it can be a digital signal processor (DSP), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0261] The memory stores a program or script for executing the technical solution of the present invention, and may also store an operating system and other key services. Specifically, the program may include program code, and the program code includes computer operation instructions. The script is usually stored in text (such as ASCII) and is only interpreted or compiled when called.
[0262] The input device may include a device for receiving data and information input by a user, such as a keyboard, a mouse, a camera, a voice input device, a touch screen, etc.
[0263] Output devices may include means that allow information to be output to a user, such as a display screen or the like.
[0264] The communication interface may include using any transceiver or the like to communicate with other devices or communication networks, such as Ethernet, Radio Access Network (RAN), Wireless Local Area Network (WLAN), etc.
[0265] The processor can implement the method for determining the domain-specific instruction set provided in the above embodiment by executing the program stored in the memory and calling other devices.
[0266] also, Figure 1 The domain-specific instruction set shown determines the functions of each module of the system, which can be implemented by the aforementioned processor executing the program stored in the memory and calling other devices.
[0267] Of course, the above modules can also be independent devices, or the above modules can be integrated into one or more devices in any combination. Please refer to the above description, and no further details will be given here.
[0268] The professionals may further appreciate that the units and model steps of each example described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0269] In the above embodiments, the instructions stored in the memory for execution by the processor may be implemented in the form of a computer program product. The computer program product may be pre-written in the memory, or may be downloaded and installed in the memory in the form of software.
[0270] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on the computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from a computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, a computer, a server, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server, or data center. The computer-readable storage medium can be any available medium that a computer can store or a data storage device such as a server, a data center, etc. that includes one or more available media integration. Available media can be magnetic media, (e.g., floppy disk, hard disk, tape), optical media (e.g., DVD), or semiconductor media (e.g., solid state hard disk solid statedisk, SSD), etc.
[0271] When the computer instructions are executed, the domain-specific instruction set determination method described above in this document is implemented.
[0272] All of the above embodiments have the following advantages:
[0273] (1) High efficiency: By automatically selecting instruction subsets, the computer system can quickly select the optimal instruction subset for building a RISC processor from the pre-designed domain-specific instruction set. This is mainly reflected in further screening and optimization of the selected multiple sets of candidate instruction subsets, which improves the search efficiency.
[0274] (2) High precision: In response to the needs of specific application sub-fields, it can automatically find a set of RISC processor instruction subsets that have advantages in PPA. This is mainly reflected in clarifying the optimization goals and using optimization algorithms for precise screening, ensuring that the selected instruction subset has high precision in the specific sub-field.
[0275] (3) Strong versatility: The present invention is applicable to multiple application sub-fields and has wide practicability. This is mainly reflected in the pre-designed field-specific instruction set, whose design ideas and characteristics enable it to cover the needs of different application sub-fields.
[0276] (4) Easy to implement and deploy: The present invention can be implemented on existing computer systems without the need for additional hardware or software support. This is mainly reflected in the fact that the entire process is executed by the computer system, so it is easy to implement and deploy.
[0277] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the system disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0278] This article uses specific examples to illustrate the principles and implementation methods of the present invention. The above examples are only used to help understand the method and core ideas of the present invention. At the same time, for those skilled in the art, according to the ideas of the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting the present invention.
Claims
1. A method for determining a domain-specific instruction set, characterized in that: Applied to a domain-specific instruction set determination system or electronic device, the domain-specific instruction set determination method includes: Acquire a domain-specific instruction set; the domain-specific instruction set is a dedicated instruction set for a specific domain; Classifying the instructions in the domain-specific instruction set to obtain instruction subsets of multiple categories; Determine an optimization target for each type of workload in a target application sub-field; the optimization target includes at least one of three design factors: performance, power consumption, and area; the target application sub-field is an application sub-field in the dedicated field; For each type of workload, multiple groups of candidate instruction subsets are determined; wherein any group of candidate instruction subsets at least includes: some instructions in each instruction subset; For each type of workload, multiple groups of candidate instruction subsets are screened and optimized based on the optimization goal to obtain the optimal instruction subset for each type of workload; According to the optimal instruction subsets of various workloads, an optimal instruction subset of the RISC processor for the target application subfield is constructed.
2. The method for determining a domain-specific instruction set according to claim 1, characterized in that: For each type of workload, multiple groups of candidate instruction subsets are screened and optimized based on the optimization goal to obtain the optimal instruction subset for each type of workload, specifically including: A screening method is used to screen multiple groups of candidate instruction subsets for each type of workload to obtain an initial screening instruction subset for each type of workload; The optimization algorithm is used to optimize the initial screening instruction subset for each type of workload to obtain the optimal instruction subset for each type of workload.
3. The method for determining a domain-specific instruction set according to claim 1, characterized in that: The instructions in the domain-specific instruction set are classified to obtain multiple categories of instruction subsets, including: Extracting characteristic parameters of each instruction in the domain-specific instruction set; the characteristic parameters include: instruction function; The instructions in the domain-specific instruction set are classified according to the instruction functions to obtain instruction subsets of multiple categories.
4. The method for determining a domain-specific instruction set according to claim 1, characterized in that: Determine optimization goals for each type of workload in the target application subdomain, including: Analyze the workload characteristics of each workload in the target application sub-domain; Based on the workload characteristics, clustering the workloads in the target application sub-field to obtain multiple types of workloads; Determine the optimization target for each type of workload based on the performance, power consumption, and area requirements of each type of workload.
5. The method for determining a domain-specific instruction set according to claim 2, characterized in that: Each workload category has at least one typical workload; A screening method is used to screen multiple candidate instruction subsets for each type of workload to obtain an initial screening instruction subset for each type of workload, specifically including: Simulate or actually run each set of candidate instruction subsets on corresponding typical workloads; The evaluation results of each candidate instruction subset during the evaluation process are used to characterize the performance of the candidate instruction subset on each design element included in the optimization target; An initial screening instruction subset for the workload type is determined based at least on the running evaluation results of each group of candidate instruction subsets.
6. The method for determining a domain-specific instruction set according to claim 2, characterized in that: A screening method is used to screen multiple candidate instruction subsets for each type of workload to obtain an initial screening instruction subset for each type of workload, specifically including: Using an evaluation method to perform quantitative evaluation on each group of candidate instruction subsets to obtain a quantitative evaluation result; the quantitative evaluation result includes a quantitative value of the group of candidate instruction subsets on each design element included in the optimization target; each quantitative value is used to characterize the performance of the group of candidate instruction subsets on each design element included in the optimization target; An initial screening instruction subset for the workload of this type is determined at least according to the quantitative evaluation results of each group of candidate instruction subsets.
7. The method for determining a domain-specific instruction set according to claim 2, characterized in that: The optimization algorithm is used to optimize the initial screening instruction subset of each type of workload to obtain the optimal instruction subset for each type of workload, including: Genetic algorithm or simulated annealing algorithm is used to optimize the initial screening instruction subset of each type of workload to obtain the optimal instruction subset of each type of workload.
8. The method for determining a domain-specific instruction set according to claim 1, characterized in that: According to the optimal instruction subsets of various workloads, the optimal instruction subsets of the RISC processor for the target application subfield are constructed, specifically including: The optimal instruction subsets of all categories of workloads are combined to obtain the optimal instruction subset of the target application subfield; the optimal instruction subset of the target application subfield is used to construct a RISC processor in the target application subfield.
9. The method for determining a domain-specific instruction set according to claim 3, characterized in that: Extract characteristic parameters of each instruction in the domain-specific instruction set, specifically including: Perform static and dynamic analysis on the domain-specific instruction set to obtain the structural and runtime characteristics of each instruction in the domain-specific instruction set; Based on the structural features and the runtime features, characteristic parameters of each instruction are determined.
10. The method for determining a domain-specific instruction set according to claim 9, characterized in that: The characteristic parameters also include: instruction execution time, instruction power consumption, and memory access type involved in the instruction.