Pretreatment device and AI chip
By designing a preprocessing device in the AI chip, using message pre-cleaning, classification and shaping modules to manage and debug messages, the problems of complex attributes and large data volume are solved, efficient management and distribution of messages are achieved, and processing efficiency and security are improved. .
Patent Information
- Application Number
- CN202411263287.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-10
- Publication Date
- 2024-12-31
AI Technical Summary
The debugging messages generated by AI chips during operation are complex and the data volume is large, which makes it difficult to directly develop operators or optimize performance, especially message management and data volume control are difficult to effectively carry out.
A preprocessing device is designed, including a message pre-cleaning module, a message classification module, a message shaping module and a set of configuration registers. Through cleaning, classification and shaping operations, debugging message attributes, controlling the amount of data, and supporting flexible distribution.
Effectively manage and distribute multiple types of debugging messages inside the AI chip, reduces the complexity and storage pressure of data processing, improves message processing efficiency and security, and meets the needs of multiple users and multiple types of messages.
Smart Images

Figure CN119226696A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of chip technology, and in particular to a preprocessing device and an AI chip. Background Art
[0002] AI chips (Artificial Intelligence chips) are chips used to process artificial intelligence applications. AI chips can accelerate the application of machine learning, deep learning and other AI algorithms, and improve computer performance in areas such as image recognition, speech recognition and natural language processing.
[0003] AI chips generate a large number of debugging messages during operation, which play an important role in operator development or performance optimization. However, since the debug messages generated during the operation of AI chips have many attributes (i.e., many types of debug messages) and the debug message data volume is large, there are many problems in directly developing operators or optimizing performance based on the debug messages with complex attributes and large data volume.
[0004] Therefore, how to manage the attributes of debug messages, control the data volume of debug messages, and flexibly distribute debug messages has become one of the technical problems that need to be solved urgently in the field of chip technology. Summary of the invention
[0005] Based on the above problems, the present application provides a preprocessing device for managing the properties of debug messages in AI chips, controlling the data volume of debug messages, and flexibly distributing debug messages, so as to meet the current technology requirements for the use of multiple types of debug messages inside AI chips.
[0006] The embodiments of the present application disclose the following technical solutions:
[0007] The first aspect of the present application discloses a preprocessing device, which includes: a message pre-cleaning module, a message classification module, a message shaping module and a configuration register set;
[0008] The configuration register set is used to set the attributes, cleaning strategy, classification mode and shaping operation mode of the debug message;
[0009] The message pre-cleaning module is used to clean the fields in the first debugging message received by the message pre-cleaning module according to the attributes of the debugging message and the cleaning strategy to obtain a second debugging message;
[0010] The message classification module is used to classify the second debugging message according to the attribute of the debugging message and the classification method to obtain a third debugging message;
[0011] The message shaping module is used to shape the third debugging message according to the attribute of the debugging message and the shaping operation mode to obtain a fourth debugging message.
[0012] In an optional implementation, the device further includes a message flush module, and the configuration register set is further used to receive a flush instruction;
[0013] The message flush module is used to flush the target debug message to the memory according to the flush instruction; the target debug message is the debug message indicated by the flush instruction in the third debug message and / or the fourth debug message.
[0014] In an optional implementation, the device supports simultaneous use by a preset number of users, and the configuration register set is further used to set identifiers of users supported by the device.
[0015] In an optional implementation, the device further includes a message receiving module;
[0016] The message receiving module is used to perform format conversion on the received multiple initial debugging messages to obtain debugging messages after format conversion.
[0017] In an optional implementation, the device further includes a message flow control module; the configuration register set is also used to set a flow control strategy;
[0018] The message flow control module is used to adjust the flow of the debug message after the format conversion according to the attribute of the debug message and the flow control strategy to obtain the first debug message.
[0019] In an optional implementation, the device further includes a message cache module, and the message cache module is used to store the fourth debugging message.
[0020] In an optional implementation, the device further includes a message encryption module; the configuration register set is also used to configure public key information;
[0021] The message encryption module is used to encrypt the fourth debugging message according to the public key information to obtain a ciphertext.
[0022] In an optional implementation, the configuration register set is also used to set a side channel protection control strategy;
[0023] The message encryption module is also used to generate pseudo-random data according to the side channel protection control strategy.
[0024] In an optional implementation, the device further includes a message sending module, and the configuration register set is further used to set a message sending strategy;
[0025] The message sending module is further used to send the ciphertext and the pseudo-random data to the memory according to the message sending strategy.
[0026] In an optional implementation, the message classification module includes a first message classification unit, a second message classification unit and a third message classification unit; the classification method includes a first classification method, a second classification method and a third classification method;
[0027] The first message classification unit is used to classify the second debugging message according to the attribute of the debugging message and the first classification method to obtain the first debugging sub-information;
[0028] The second message classification unit is used to classify the first debugging sub-information according to the attribute of the debugging message and the second classification method to obtain the second debugging sub-information;
[0029] The third message classification unit is used to classify the second debugging sub-information according to the attribute of the debugging message and the third classification method to obtain the third debugging message.
[0030] In an optional implementation, the configuration register set is also used to display the execution status of the flush operation.
[0031] In an optional implementation, the configuration register set is further used to configure at least one memory corresponding to a user supported by the device.
[0032] The second aspect of the present application discloses an AI chip, the AI chip comprising a plurality of processors, a preprocessing device and a bus interconnection network; the bus interconnection network comprises a first bus node, a second bus node and a data path; the preprocessing device is the device described in the first aspect;
[0033] The processor is used to generate a debugging message and service data based on multiple user operations, and transmit the debugging message to the first bus node and transmit the service data to the second bus node;
[0034] The preprocessing device is used to receive multiple debugging messages from the first bus node, process the multiple debugging messages, and distribute the processed debugging messages to the memory corresponding to each of the users through the data path.
[0035] Compared with the prior art, this application has the following beneficial effects:
[0036] The present application discloses a preprocessing device, including a message pre-cleaning module, a message classification module, a message shaping module and a configuration register set. The configuration register set is used to set the attributes, cleaning strategy, classification mode and shaping operation mode of the debug message; the message pre-cleaning module is used to clean the fields in the first debug message received by the message pre-cleaning module according to the attributes and cleaning strategy of the debug message to obtain a second debug message; the message classification module is used to classify the second debug message according to the attributes and classification mode of the debug message to obtain a third debug message; the message shaping module is used to shape the third debug message according to the attributes and shaping operation mode of the debug message to obtain a fourth debug message.
[0037] When the preprocessing device is installed in the AI chip, through the message attributes, cleaning strategies, classification methods and shaping operation methods that have been set in the preprocessing device, the debug message process attributes setting, message cleaning, message classification and message shaping with complicated attributes and huge data volume generated during the operation of the AI chip can be performed. It is possible to manage the attributes of the debug messages, control the data volume of the debug messages, and flexibly distribute the debug messages (classify and send the messages), thereby meeting the current technology requirements for the use of multiple types of debug messages inside the AI chip. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0039] Figure 1 A schematic diagram of a structure in which a preprocessing device provided in an embodiment of the present application is installed in an AI chip;
[0040] Figure 2 A schematic diagram of the structure of a pre-processing device provided in an embodiment of the present application;
[0041] Figure 3 A schematic diagram of a multi-user switching process provided in an embodiment of the present application;
[0042] Figure 4 A schematic diagram of a multi-type debugging message distribution process provided in an embodiment of the present application. DETAILED DESCRIPTION
[0043] AI chips generate a large number of debugging messages during operation, which play an important role in operator development or performance optimization. However, since the debug messages generated during the operation of AI chips have many attributes and a large amount of debug message data, there are many problems in directly developing operators or optimizing performance based on the debug messages with complex attributes and large amounts of data. These problems include but are not limited to:
[0044] (1) There are various debugging message types and message attributes.
[0045] Specifically, debug messages can be divided into multiple types according to source attributes, device attributes, die attributes, process attributes, and type attributes.
[0046] According to the source attributes, they can be divided into: debug messages generated by the scheduling processor, debug messages generated by the user host processor, debug messages generated by the application processor, debug messages generated by the system manager, debug messages generated by the video processor, debug messages generated by the intelligent computing processor and debug messages generated by the data handling engine, etc.
[0047] According to device attributes, debug messages can be divided into: debug messages generated by physical devices and debug messages generated by virtual devices.
[0048] According to the die (bare die, bare chip) attributes, debug messages can be divided into: debug messages generated by the main die and debug messages generated by the secondary die.
[0049] Process attributes: Each user has multiple software processes, and the number of processes handled by the chip ranges from a dozen to hundreds.
[0050] According to the type attribute, debug messages can be divided into: interrupt messages, remote procedure call messages, virtual serial port communication messages, processor operation log messages, performance statistics, specific event information, custom event information, etc.
[0051] (2) The amount of debug message data is large, and the internal storage capacity of the AI chip is limited.
[0052] AI chips need to carry out operations such as data transfer, task distribution, operator call, and performance statistics on a large amount of raw data, which will continuously generate a large number of debugging messages. However, the storage capacity of AI chips is limited, so it is necessary to be able to output the debugging messages generated and cached in the AI chip to external storage devices as quickly as possible.
[0053] (3) The software program has low efficiency in distributing debug message data.
[0054] In the traditional solution, the debug message data is distributed by the software program. Since the debug messages are stored in the internal cache of the chip, the software program on the host needs to go through multiple levels of transfer before it can access and process these debug messages, which is time-consuming and inefficient.
[0055] Based on the above problems, the present application provides a preprocessing device for managing the properties of debug messages in AI chips and controlling the data volume of debug messages, thereby meeting the current technology requirements for the use of multiple types of debug messages inside AI chips.
[0056] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0057] Figure 1 A schematic diagram of a structure in which a preprocessing device provided in an embodiment of the present application is installed in an AI chip. Figure 1 As shown, the AI chip includes multiple processors, pre-processing devices and bus interconnection networks. The multiple processors include but are not limited to: scheduling processors, host processors, application processors, system managers, computing processors and data handlers.
[0058] Each processor generates debugging messages and business data according to user operations. Debugging messages and business data are two parallel types of data, which use the bus interconnection network together and occupy the bandwidth of the bus interconnection network together.
[0059] In order to solve the problem of the data flow of debugging messages and the data flow of business data occupying internal network resources in traditional solutions, the present application selects the node with the most obvious debug message convergence point, namely the first bus node, and designs a dedicated "sub-bus" for this node; selects the node with the most obvious business message convergence point, namely the second bus node, and designs another dedicated "sub-bus" for this node; transmits the debug message to the preprocessing device through the sub-bus corresponding to the first bus node, thereby transmitting the debug message flow and the business data flow separately.
[0060] During the operation of the AI chip, each processor transmits the generated debugging messages to the first bus node and transmits the business data to the second bus node; the preprocessing device receives multiple debugging messages from the first bus node, processes the multiple debugging messages, and distributes the processed debugging messages to the memory through the data path in the bus interconnection network.
[0061] Figure 1The preprocessing device in the system adopts a message separation transmission method to completely isolate the debug message from the business data. This not only solves the problem of the debug message data flow and the business data data flow occupying internal network resources in the traditional solution, but also avoids the additional resource investment brought by adding a new dedicated bus, achieving a balance between transmission efficiency and design investment.
[0062] Figure 2 A schematic diagram of the structure of a preprocessing device provided in an embodiment of the present application. Figure 2 The preprocessing device includes: a message receiving module, a message flow control module, a message pre-cleaning module, a message classification module, a message shaping module, a message buffer module, a message flush module, a message encryption module, a message sending module and a configuration register set.
[0063] The configuration register set is the core functional module of the preprocessing device. Other functional modules in the preprocessing device, such as the message pre-cleaning module, the message classification module, the message shaping module, and the message encryption module, can read the strategies that have been set in the configuration register set, such as the cleaning strategy, classification method, shaping strategy, and message encryption strategy, to achieve the corresponding purposes of debugging message cleaning, debugging message shaping, and debugging message encryption. Among them, the value or strategy in the configuration register can be set according to the needs of the user.
[0064] It should be noted that the configuration register set, message pre-cleaning module, message classification module, and message shaping module are essential functional modules in the preprocessing device. These modules are used together to achieve the purpose of managing the attribute types of debug messages and controlling the flow of debug messages; and other functional modules, such as the message receiving module, message flow control module, message flush module, message cache module, message encryption module, and message sending module are modules that exist to achieve specific purposes.
[0065] It should be emphasized that those skilled in the art can determine what other functional modules the preprocessing device can include in addition to the configuration register set, the message pre-cleaning module, the message classification module, and the message shaping module according to actual usage requirements.
[0066] In order to facilitate a comprehensive understanding of the pretreatment device, Figure 2 Taking the preprocessing device shown in the figure as an example, the function of each functional module that may be involved in the preprocessing device is described in detail.
[0067] The following is a detailed introduction to the specific functions of each functional module in the preprocessing device.
[0068] The configuration register set includes multiple groups of configuration registers, each group of configuration registers is used to perform one of the following functions: setting the attributes of the debug message, setting the flow control strategy, setting the cleaning strategy, setting the classification method, setting the message shaping operation mode, receiving the flush instruction, setting the identification of the user supported by the preprocessing setting, setting the public key information, setting the side channel protection control strategy and setting the message sending strategy, displaying the execution status of the flush operation, and configuring at least one memory corresponding to the user supported by the preprocessing device.
[0069] It can be seen that the attributes of the debug message can be realized by the preprocessing device in the present application. Specifically, the first type of configuration register in the configuration register set can be used to realize personalized customization of the attributes of the debug message.
[0070] The debugging message supported by the preprocessing device in the present application is composed of multiple fields, each field represents a separate message attribute; the user can configure the message according to the actual scenario and system solution.
[0071] For example, each data received by the preprocessing device includes 16 bits. The user can set the first type of register, define the first 8 bits as the master ID, indicating which master sent the data; define the second 8 bits as the specific content of the current data information; splice these two bits to obtain the data.
[0072] For another example, the user can also set whether each message attribute is enabled, needs to be overwritten, and the initial value by setting the value of the first type of register according to their own usage requirements.
[0073] It should be noted that in addition to supporting the message attributes such as source attributes, device attributes, die attributes, process attributes, type attributes, etc. mentioned in the aforementioned embodiments, the preprocessing device in the present application also reserves multiple user-defined message attributes to facilitate extended applications.
[0074] It should be noted that the properties of the debug message can be customized and are closely related to the following multiple functional modules, that is, the message pre-cleaning module, message classification module, and message shaping module introduced later are all implemented based on the debug message after property configuration.
[0075] The message receiving module is used to perform format conversion on the received multiple initial debugging messages to obtain the debugging messages after format conversion.
[0076] The preprocessing device in the present application is placed in the AI chip. The various processors in the AI chip will generate debug messages in various formats. These debug messages in different formats are not necessarily in the format of debug messages that can be accepted by the message pre-cleaning module.
[0077] Based on this, a message receiving module can be configured in the preprocessing device, and the module can be used to convert the format of the multiple initial debugging messages received, that is, the debugging messages sent by each processor in the AI chip received by the preprocessing device, to obtain the debugging messages after the format conversion, so that the preprocessing device can process these debugging messages after the format conversion.
[0078] It is understandable that if the format type of the initial debugging message can be processed by the message pre-cleaning module, the message receiving module may not be placed in the pre-processing device.
[0079] The message flow control module performs flow regulation on the debug message after the format conversion according to the attribute of the debug message and the flow control strategy to obtain the first debug message.
[0080] The attributes of the debug message are set in the first type of register in the configuration register set, and the flow control strategy is set in the second type of register in the configuration register set.
[0081] For example, when the user wants the preprocessing device to receive only N data amounts of debugging messages within the T1 time period and within M cycles, the parameters such as T1, M and N can be written into the second type of registers, and the flow control function can be enabled. In this way, the amount of debugging information input into the preprocessing device can be effectively controlled.
[0082] Exemplarily, the flow control strategy may be: when a user wants to obtain target information in a debug message, if the preprocessing device receives a 32-bit debug message from the first bus node each time, and when the user only needs to process 3 bits of information out of the 32 bits, the attribute information corresponding to the required bits can be enabled in the first type of register, and the target information in the debug message can be obtained.
[0083] It is understandable that the preprocessing device may not include the message flow control modules. Adaptively, when the preprocessing device does not include the message flow control module, the configuration register set does not include the second type of registers.
[0084] It can be understood that if the preprocessing device does not include a message receiving module and a message flow control module, the initial debugging message is the first debugging message.
[0085] The message pre-cleaning module is an indispensable functional module in the pre-processing device. The message pre-cleaning module is used to clean the debug messages that match the fields in the first debug message according to the attributes and cleaning strategies of the debug message to obtain the second debug message. In this way, messages that the user is not interested in can be excluded, thereby reducing the bandwidth required for downstream data transmission, saving storage space, and improving data processing messages.
[0086] The attributes of the debug message are set in the first type of registers in the configuration register set, and the flushing strategy is set in the third type of registers in the configuration register set.
[0087] The user can set the third type of registers to specify which debug messages or messages attributes they want to clean. The pre-cleaning operation is to match and filter the source attributes, device attributes, die attributes, process attributes, type attributes and other attribute information in the debug message. It supports pre-cleaning operations for single attributes and combined attributes.
[0088] The message classification module is an essential functional module in the preprocessing device. The message classification module is used to classify the second debugging message according to the attributes and classification method of the debugging message to obtain the third debugging message.
[0089] The attributes of the debug message are set in the first type of register in the configuration register set, and the classification method is set in the fourth type of register in the configuration register set. Classification according to one message attribute is supported, and classification according to a combination of multiple message attributes is also supported.
[0090] It should be noted that those skilled in the art may set a plurality of message classification units in the message classification module according to actual use requirements. In the present application, three message classification units are exemplarily set in the message classification module.
[0091] The message classification module in the present application includes a first message classification unit, a second message classification unit and a third message classification unit; the classification method includes a first classification method, a second classification method and a third classification method.
[0092] Specifically, the first message classification unit is used to classify the second debugging message according to the attributes of the debugging message and the first classification method to obtain the first debugging sub-information; the second message classification unit is used to classify the first debugging sub-information according to the attributes of the debugging message and the second classification method to obtain the second debugging sub-information; the third message classification unit is used to classify the second debugging sub-information according to the attributes of the debugging message and the third classification method to obtain the third debugging message.
[0093] The message shaping module is an essential functional module in the preprocessing device. The message shaping module is used to shape the third debugging message according to the attribute of the debugging message and the shaping operation mode to obtain the fourth debugging message.
[0094] The preprocessing device supports splicing and shaping of the classified debug messages. The attributes of the debug messages are set in the first type of registers in the configuration register set; and the shaping operation mode is set in the fifth type of registers in the configuration register set.
[0095] Exemplarily, the shaping operation methods in the present application include but are not limited to: additional information field insertion, multi-message splicing, message flipping, redundant message splicing, etc.
[0096] Exemplarily, the message shaping module in the preprocessing device caches the received third debug message and performs a shaping operation after recording a certain number. Each message after shaping, that is, the fourth debug message can contain up to 32 third debug messages. This can greatly reduce the number of times the write memory operation is initiated and reduce the bus occupancy frequency in the AI chip.
[0097] The message buffer module is used to buffer the fourth debugging message. Those skilled in the art can determine whether the preprocessing device includes a message buffer module according to actual needs.
[0098] In the actual operation and use of AI chips, AI chips need to support multi-user access scenarios. Due to the uncertain number of users, the number of software processes may far exceed the number of processes that the chip hardware resources can support. Therefore, the chip must also support multi-process switching to replace processes that have expired or have been inactive for a long time with new processes.
[0099] To achieve the above objectives, the preprocessing device in the present application also includes a message flush module. The message flush module is used to flush the target debug message to the memory according to the flush instruction. The target debug message is the debug message indicated by the flush instruction in the third debug message and / or the fourth debug message.
[0100] like Figure 1 As shown, the message flush module and the message shaping module are connected by a bidirectional arrow, and the message flush module and the message cache module are also connected by a bidirectional arrow. Figure 1 The double-line arrow in the figure indicates that the flush operation of the target debug message is implemented through the control signal between the two modules, and the two modules do not directly exchange data streams.
[0101] In other words, the message flush module only flushes the target debug message indicated by the flush instruction in the third debug message input into the message shaping module to the corresponding memory for storage, and / or flushes the target debug message indicated by the flush instruction in the fourth debug message input into the message cache module to the corresponding memory for storage, without changing the structure of the third debug message and the fourth debug message.
[0102] It should be emphasized that when the target debug message in the third debug message needs to be flushed to the corresponding memory, the insertion operation in the message shaping operation needs to be performed by default. The reason is that if the bus width used when the data is sent out is 1024 bits, and each message in this application consists of 32 bits, it is necessary to splice 32 messages, that is, splice 32 32 bits to send the message out from the bus. Therefore, when the target debug message needs to be flushed, if the data volume of the target debug message is not enough to be sent out, that is, the data volume is less than 1024 bits, it is necessary to insert some meaningless data and piece it together into 1024 bits before it can be sent out.
[0103] The message flush module is an optional functional module in the preprocessing device. In two application scenarios, the message flush module needs to be set in the preprocessing device. If the message flush module is included in the preprocessing, the configuration register set needs to include a flush control register adaptively. The flush control register is a register for receiving a flush instruction.
[0104] The first application scenario is that user A no longer uses the chip with the preprocessing device installed in this application, and user A requests to extract and take away all the debugging messages that are cached inside the preprocessing device and belong to him personally. User A can send an instruction to retrieve the debugging message to the control system of the chip with the preprocessing device installed. After receiving the instruction to retrieve the debugging message sent by user A, the control system will send a flush instruction to the flush control register in the configuration register set; when the flush control register in the configuration register set receives the flush instruction, the message flush module will flush the target debugging message, that is, the personal debugging message exclusive to user A, to the memory corresponding to user A. Among them, the flush instruction contains information such as the flush switch to be flushed, the flush user ID, whether the flush operation is performed immediately, and the waiting time.
[0105] It should be noted that the identification of each user supported by the preprocessing device, such as the user ID, can be set by configuring the sixth type of register in the register set; at least one memory matching each user can be set by configuring the seventh type of register in the register set. The seventh type of register, also known as the user information configuration register, includes an enable switch, a user ID, an initial address of the memory corresponding to the user, a space of the memory corresponding to the user, a read-write pointer of the memory corresponding to the user, a water level interruption threshold, and bus configuration information.
[0106] The second usage scenario is that the hardware resources of the preprocessing device can only support N users, such as only supporting 16 users working simultaneously. When user B among the 16 users does not use the preprocessing device temporarily, but user C outside the 16 users needs to use the preprocessing device, user B can be cut out from the user set currently supported by the preprocessing device, and user C can be added to the user set currently supported by the preprocessing device, that is, the "user cut-in and cut-out" operation is performed.
[0107] Specifically, after the control system of the chip installed with the preprocessing device determines that user B is not currently using the preprocessing device to process debug messages, the control system can send a flush instruction to the flush control register in the configuration register set; when the flush control register in the configuration register set receives the flush instruction, the message flush module will flush all the target debug messages, that is, the personal debug messages exclusive to user B, to the memory corresponding to user B; then update the identifier of user B to the identifier of user C in the configuration register, and configure the information of user C into the user information configuration register; in this way, the functional modules in the preprocessing device can provide services to user C.
[0108] In order to monitor the working status of the flush operation, the configuration register set may further include a register for displaying the execution status of the flush operation, namely, a flush status register. The flush status register may display whether the switching instruction is incorrect, the current execution stage of the switching operation, whether the switching is completed, etc.
[0109] Specifically, after the control system of the chip equipped with the preprocessing device sends a flush instruction, when the flush control register receives the flush instruction and the message flush module performs a flush operation on the target debug message, the control system will continue to read the value of the flush status register until it reads that the flush operation has been completed normally.
[0110] For ease of understanding, the following Figure 3 The multi-user switching function supported by the preprocessing device of the present application is further described in detail.
[0111] In the preprocessing device in the present application, supporting user "cutting out" means turning off the processing of debug messages for the "cut-out" user and releasing the hardware resources occupied by the user; supporting user "cutting in" means enabling the processing of debug messages for the new "cut-in" user and allocating hardware resources to the new user; supporting user "switching back" means re-enabling the previously "cut-out" user; supporting user "flush" means forcibly splicing and shaping the cached messages of the specified user and quickly completing preprocessing before writing them to the memory.
[0112] The process by which the preprocessor completes the multi-user switching operation according to the configuration register is:
[0113] In the first step, the control system of the AI chip equipped with the preprocessing device sends a flush instruction to the flush control register for the designated user (i.e., the target user), and the preprocessing device stops receiving messages from the designated user; the message flush module in the preprocessing device flushes all the debug messages of the target user to the memory corresponding to the target user according to the flush instruction, i.e., flushes the messages of the designated user cached internally; the preprocessing device notifies the control system that the flush operation is completed.
[0114] In the second step, the control system modifies the user information configuration register in the configuration register set to "cut out" the specified user, and the preprocessing device releases the resources of the "cut out" user. Figure 3 The control system in shuts down the specified user.
[0115] In the third step, the control system modifies the user information configuration register in the configuration register set again (i.e. Figure 3 The new user information is configured in the preprocessing device to "cut in" the new user, and the preprocessing device enables the processing of the new user message. The preprocessing device receives and processes the new user's message.
[0116] From the introduction of the above embodiments, it can be known that whether the preprocessing device includes a message flush module is optional. When the preprocessing device includes a message flush module, the configuration register set needs to include a flush control register and may also include a flush status register.
[0117] The message encryption module is used to encrypt the fourth debugging message according to the public key information to obtain a ciphertext. When the preprocessing device includes a message encryption module, the configuration register set needs to include a register that can be configured with the public key information, that is, an encryption register.
[0118] The preprocessing device in this application supports message encryption design and uses asymmetric encryption to protect the debug message to be sent. User D can configure the public key information into the encryption register of the preprocessing device and enable the memory with the specified number of user D. The message encryption module in the preprocessing device uses the public key information to encrypt the fourth debug message and send the ciphertext to the memory with the corresponding number; when user D needs to read the information in the memory or the memory capacity is insufficient, user D receives an interrupt signal sent by the control system of the chip equipped with the preprocessing device, and user D can use the private key information corresponding to the public key information to decrypt the encrypted data in the memory to obtain the debug message. Since the debug message in the memory is stored in the form of ciphertext, data security can be enhanced.
[0119] Furthermore, the message encryption module is also used to generate pseudo-random data according to the side channel protection control strategy. At this time, the configuration register set also includes a register for setting the side channel protection control strategy.
[0120] The side channel protection strategy refers to a strategy that improves system security by adding "noise" interference to valid messages, making it impossible for attackers to obtain accurate "side channel information" inside the pre-processing device or chip.
[0121] When the message encryption module can encrypt the fourth debug message according to the public key information to obtain the ciphertext, and can also generate pseudo-random data according to the side channel protection control strategy, after the fourth debug message is input into the message encryption module, the output is the ciphertext and pseudo-random data.
[0122] The message sending module is used to send the ciphertext and pseudo-random data to the memory according to the message sending strategy. When the preprocessing device includes the message sending module, the configuration register set includes a register for setting the message sending strategy.
[0123] In this application, the registers in the configuration register set used to set the message sending strategy are referred to as the eighth type of registers. Users can set the message sending strategy through the eighth type of registers, and the message sending module sends the ciphertext and pseudo-random data to the corresponding memory according to the information indicated in the message sending strategy.
[0124] The message sending strategy supports users to independently define the number of messages sent each time, the sending memory number and address, supports interrupt reminders after distribution, and supports the sending priority corresponding to different users / memory.
[0125] Figure 4 A schematic diagram of a multi-type debugging message distribution process provided by an embodiment of the present application. Figure 4 As shown, after the debugging messages of multiple types and attributes are subjected to message filtering operation (message filtering), multiple message classification and shaping operations (message classification and shaping), the messages are encrypted and sent (message encryption and sending) to the corresponding storage.
[0126] It should be noted that the relevant contents of message filtering, message classification and shaping, message encryption, and message sending refer to the relevant introduction in the aforementioned embodiments and will not be repeated here.
[0127] In summary, the present application discloses a preprocessing device, which uses hardware to implement a message distribution function, with fast distribution speed and high security; the preprocessing device can support message shaping operations, and send a large number of debug messages after shaping and splicing, thereby reducing bus occupancy; the preprocessing device can support pre-cleaning operations on debug messages, reduce the total data volume of debug messages that need to be processed, reduce bus occupancy, and save storage space; the preprocessing device supports customizable message attributes, and users can configure independently according to the required message attributes, with high flexibility and strong applicability; the preprocessing device can support message classification operations, and debug messages can be stored in different caches respectively. Users only need to process messages in a single cache, which reduces the amount of data processed by users and improves processing efficiency; the preprocessing device encrypts debug messages, which can prevent unauthorized users from knowing the message data in the cache, thereby enhancing data security; the preprocessing device supports multi-user switching settings, supports multiple users on a single hardware to use online at the same time, and improves hardware utilization efficiency; the preprocessing device can support message separation transmission design, avoids debug messages from bus preemption of business data, and ensures the normal operation of user services.
[0128] It needs to be emphasized again that Figure 2 The preprocessing device provided in the invention includes necessary functional modules (configuration register set, message pre-cleaning module, message classification module, message shaping module) and all optional functional modules (message receiving module, message flow control module, message flush module, message buffer module, message encryption module and message sending module). Those skilled in the art can Figure 2 Based on the preprocessing device introduced in the present invention, according to actual needs, some functional modules are selected from the optional functional modules to form a new preprocessing device together with necessary functional modules. This application does not limit which optional functional modules are included in the preprocessing device. When the functional modules in the preprocessing device change, the configuration register set in the preprocessing device also changes adaptively.
[0129] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A pretreatment device, characterized in that: The device comprises: a message pre-cleaning module, a message classification module, a message shaping module and a configuration register set; The configuration register set is used to set the attributes, cleaning strategy, classification mode and shaping operation mode of the debug message; The message pre-cleaning module is used to clean the fields in the first debugging message received by the message pre-cleaning module according to the attributes of the debugging message and the cleaning strategy to obtain a second debugging message; The message classification module is used to classify the second debugging message according to the attribute of the debugging message and the classification method to obtain a third debugging message; The message shaping module is used to shape the third debugging message according to the attribute of the debugging message and the shaping operation mode to obtain a fourth debugging message.
2. The device according to claim 1, characterized in that The device also includes a message flush module, and the configuration register set is also used to receive a flush instruction; The message flush module is used to flush the target debug message to the memory according to the flush instruction; the target debug message is the debug message indicated by the flush instruction in the third debug message and / or the fourth debug message.
3. The device according to claim 2, characterized in that The device supports simultaneous use by a preset number of users, and the configuration register set is further used to set identifiers of users supported by the device.
4. The device according to claim 1, characterized in that The device also includes a message receiving module; The message receiving module is used to perform format conversion on the received multiple initial debugging messages to obtain debugging messages after format conversion.
5. The device according to claim 1, characterized in that The device also includes a message flow control module; the configuration register set is also used to set a flow control strategy; The message flow control module is used to adjust the flow of the debug message after the format conversion according to the attribute of the debug message and the flow control strategy to obtain the first debug message.
6. The device according to claim 1, characterized in that The device further includes a message cache module, and the message cache module is used to store the fourth debugging message.
7. The device according to claim 1, characterized in that The device also includes a message encryption module; the configuration register set is also used to configure public key information; The message encryption module is used to encrypt the fourth debugging message according to the public key information to obtain a ciphertext.
8. The device according to claim 7, characterized in that The configuration register set is also used to set a side channel protection control strategy; The message encryption module is also used to generate pseudo-random data according to the side channel protection control strategy.
9. The device according to claim 8, characterized in that The device also includes a message sending module, and the configuration register set is also used to set a message sending strategy; The message sending module is further used to send the ciphertext and the pseudo-random data to the memory according to the message sending strategy.
10. The device according to claim 1, characterized in that The message classification module includes a first message classification unit, a second message classification unit and a third message classification unit; the classification method includes a first classification method, a second classification method and a third classification method; The first message classification unit is used to classify the second debugging message according to the attribute of the debugging message and the first classification method to obtain the first debugging sub-information; The second message classification unit is used to classify the first debugging sub-information according to the attribute of the debugging message and the second classification method to obtain the second debugging sub-information; The third message classification unit is used to classify the second debugging sub-information according to the attribute of the debugging message and the third classification method to obtain the third debugging message.
11. The device according to claim 2, characterized in that The configuration register set is also used to display the execution status of the flush operation.
12. The device according to any one of claims 1 to 11, characterized in that The configuration register set is also used to configure at least one memory corresponding to a user supported by the device.
13. An AI chip, characterized in that: The AI chip includes multiple processors, a preprocessing device and a bus interconnection network; the bus interconnection network includes a first bus node, a second bus node and a data path; the preprocessing device is a device according to any one of claims 1 to 12; The processor is used to generate a debugging message and service data based on multiple user operations, and transmit the debugging message to the first bus node and transmit the service data to the second bus node; The preprocessing device is used to receive multiple debugging messages from the first bus node, process the multiple debugging messages, and distribute the processed debugging messages to the memory corresponding to each of the users through the data path.
