Register data storage method and access method
By storing the register data of the thread bundle in the same bank, storing the different thread data of Warp in different banks, and splitting the bank into sub-banks, the Bank conflict problem in GPU register data access is solved, achieving efficient data access reduces hardware resource requirements.
Patent Information
- Application Number
- CN202411225814.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-03
- Publication Date
- 2024-11-22
- Estimated Expiration
- 2044-09-03
AI Technical Summary
Bank conflicts often occur when register data access of GPUs, causing pipelines to pause and affect performance. The existing methods can increase the number of banks or pre-process access requests, but they are costly and difficult to completely resolve conflict problems.
By storing the register data of different thread bundles into the same bank and storing the register data of different threads of the same Warp into different banks, each bank is split into multiple sub-banks in an average column, and the register data of the thread is the same as that of the thread. Stored continuously in different sub-banks, and the design access circuit calculates the sub-bank where the data resides according to the Warp number and register number to reduce invalid reading.
Effectively eliminate bank conflicts, reduce data access delays, reduce hardware resource costs, and realize conflict resolution when threads access data without preprocessing or additional circuit overhead.
Smart Images

Figure CN118733124B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of register data storage and access, and more specifically, to a register data storage method and an access method. Background Art
[0002] Faced with the computing needs of various fields, the computing power of graphics processors (GPUs) continues to increase, but the storage problem has become an important bottleneck that limits the current GPU performance improvement. In order to improve the throughput of reading data, GPUs divide storage into storage banks to obtain higher bandwidth. The smallest execution unit of a GPU is a thread, which completes the corresponding instruction operation. However, when a thread accesses a bank, access conflicts often occur, such as different threads accessing the same bank, or the same thread accessing multiple operands in the same bank. Bank conflicts result in the inability to obtain data in a timely manner, causing pipeline pauses, which seriously affects the overall performance of the GPU. In order to alleviate the problem of bank conflicts, the number of banks and channels can be further increased, or access requests can be preprocessed through software and hardware to avoid accessing the same bank at the same time. However, simply increasing the number of access channels to eliminate bank conflicts is a simple method, but it consumes a lot of hardware resources. Alleviating bank conflicts by preprocessing thread access requests will introduce additional time and area overhead, and it is difficult to completely solve the conflict problem. By reasonably dividing the data for storage, bank conflicts can be eliminated without adding additional delays, and only a small amount of hardware resources are required to implement access control circuits. Summary of the invention
[0003] The present invention aims at the technical problems existing in the prior art and provides a register data storage method and an access method, which can prevent the access conflict problem of register data.
[0004] According to a first aspect of the present invention, there is provided a register data storage method, comprising:
[0005] Store the register data of threads with the same number in different warps into the same storage bank, and store the register data of different threads in the same warp into different banks;
[0006] The register data of threads with the same number in different warps each occupy only one address in the same bank, where one bank occupies one storage area;
[0007] Split a bank into multiple sub-banks with the same bit width evenly by column;
[0008] The address of the register data of each Warp thread in the Bank is the same as the Warp number, and the register data of each thread is stored continuously and evenly in different sub-Banks, among which the register data with smaller numbers is stored in the lower sub-Bank, and the register data with larger numbers is stored in the higher sub-Bank.
[0009] Based on the above technical solution, the present invention can also make the following improvements.
[0010] Optionally, the number of thread warps is 8, numbered 0 to 7, each warp includes 8 threads, numbered 0 to 7, and each thread has 128 register data, numbered 0 to 127;
[0011] The register data of thread 0 of Warp0~Warp7 is stored in Bank0, the register data of thread 1 of Warp0~Warp7 is stored in Bank1, the register data of thread 2 of Warp0~Warp7 is stored in Bank2, the register data of thread 3 of Warp0~Warp7 is stored in Bank3, the register data of thread 4 of Warp0~Warp7 is stored in Bank4, the register data of thread 5 of Warp0~Warp7 is stored in Bank5, the register data of thread 6 of Warp0~Warp7 is stored in Bank6, and the register data of thread 7 of Warp0~Warp7 is stored in Bank7.
[0012] Optionally, the register data of threads with the same number in different warps each occupy only one address in the same bank, including:
[0013] Store the register data of thread No. 0 of Warp0 at the first address of Bank0, store the register data of thread No. 0 of Warp1 at the second address of Bank0, store the register data of thread No. 0 of Warp2 at the third address of Bank0, store the register data of thread No. 0 of Warp3 at the fourth address of Bank0, store the register data of thread No. 0 of Warp4 at the fifth address of Bank0, store the register data of thread No. 0 of Warp5 at the sixth address of Bank0, store the register data of thread No. 0 of Warp6 at the seventh address of Bank0, and store the register data of thread No. 0 of Warp7 at the eighth address of Bank0;
[0014] Store the register data of thread No. 1 of Warp0 at the first address of Bank1, store the register data of thread No. 1 of Warp1 at the second address of Bank1, store the register data of thread No. 1 of Warp2 at the third address of Bank1, store the register data of thread No. 1 of Warp3 at the fourth address of Bank1, store the register data of thread No. 1 of Warp4 at the fifth address of Bank1, store the register data of thread No. 1 of Warp5 at the sixth address of Bank1, store the register data of thread No. 1 of Warp6 at the seventh address of Bank1, and store the register data of thread No. 1 of Warp7 at the eighth address of Bank1;
[0015] Store the register data of thread No. 2 of Warp0 at the first address of Bank2, store the register data of thread No. 2 of Warp1 at the second address of Bank2, store the register data of thread No. 2 of Warp2 at the third address of Bank2, store the register data of thread No. 2 of Warp3 at the fourth address of Bank2, store the register data of thread No. 2 of Warp4 at the fifth address of Bank2, store the register data of thread No. 2 of Warp5 at the sixth address of Bank2, store the register data of thread No. 2 of Warp6 at the seventh address of Bank2, and store the register data of thread No. 2 of Warp7 at the eighth address of Bank2;
[0016] Store the register data of thread No. 3 of Warp0 at the first address of Bank3, store the register data of thread No. 3 of Warp1 at the second address of Bank3, store the register data of thread No. 3 of Warp2 at the third address of Bank3, store the register data of thread No. 3 of Warp3 at the fourth address of Bank3, store the register data of thread No. 3 of Warp4 at the fifth address of Bank3, store the register data of thread No. 3 of Warp5 at the sixth address of Bank3, store the register data of thread No. 3 of Warp6 at the seventh address of Bank3, and store the register data of thread No. 3 of Warp7 at the eighth address of Bank3;
[0017] Store the register data of thread No. 4 of Warp0 at the first address of Bank4, store the register data of thread No. 4 of Warp1 at the second address of Bank4, store the register data of thread No. 4 of Warp2 at the third address of Bank4, store the register data of thread No. 4 of Warp3 at the fourth address of Bank4, store the register data of thread No. 4 of Warp4 at the fifth address of Bank4, store the register data of thread No. 4 of Warp5 at the sixth address of Bank4, store the register data of thread No. 4 of Warp6 at the seventh address of Bank4, and store the register data of thread No. 4 of Warp7 at the eighth address of Bank4;
[0018] Store the register data of thread No. 5 of Warp0 at the first address of Bank5, store the register data of thread No. 5 of Warp1 at the second address of Bank5, store the register data of thread No. 5 of Warp2 at the third address of Bank5, store the register data of thread No. 5 of Warp3 at the fourth address of Bank5, store the register data of thread No. 5 of Warp4 at the fifth address of Bank5, store the register data of thread No. 5 of Warp5 at the sixth address of Bank5, store the register data of thread No. 5 of Warp6 at the seventh address of Bank5, and store the register data of thread No. 5 of Warp7 at the eighth address of Bank5;
[0019] Store the register data of thread No. 6 of Warp0 at the first address of Bank6, store the register data of thread No. 6 of Warp1 at the second address of Bank6, store the register data of thread No. 6 of Warp2 at the third address of Bank6, store the register data of thread No. 6 of Warp3 at the fourth address of Bank6, store the register data of thread No. 6 of Warp4 at the fifth address of Bank6, store the register data of thread No. 6 of Warp5 at the sixth address of Bank6, store the register data of thread No. 6 of Warp6 at the seventh address of Bank6, and store the register data of thread No. 6 of Warp7 at the eighth address of Bank6;
[0020] The register data of thread No. 7 of Warp0 is stored in the first address of Bank7, the register data of thread No. 7 of Warp1 is stored in the second address of Bank7, the register data of thread No. 7 of Warp2 is stored in the third address of Bank7, the register data of thread No. 7 of Warp3 is stored in the fourth address of Bank7, the register data of thread No. 7 of Warp4 is stored in the fifth address of Bank7, the register data of thread No. 7 of Warp5 is stored in the sixth address of Bank7, the register data of thread No. 7 of Warp6 is stored in the seventh address of Bank7, and the register data of thread No. 7 of Warp7 is stored in the eighth address of Bank7.
[0021] Optionally, the step of evenly splitting a Bank into multiple sub-Banks with the same bit width by column includes:
[0022] Each bank is divided into 32 sub-banks, and each row of each sub-bank stores 4 register data.
[0023] According to a second aspect of the present invention, there is provided a register data access method, comprising:
[0024] Storing register data based on a register data storage method;
[0025] Design an access circuit for each storage area, and the access circuit calculates the sub-bank where the data to be read is located according to the input Warp number and the register number to be accessed;
[0026] For the output data of each sub-Bank, the output selector is used to select the output register data according to the access register number that accesses the data.
[0027] Optionally, the access circuit includes 4 read register channels, a Warp input channel, an include unit, a select unit, 128 output selectors and 4 or units, wherein each sub-Bank corresponds to 4 output selectors, the 4 read register channels are connected to the include unit and the select unit, the p-th output selector of each sub-Bank is connected to the p-th or unit, p=1, 2, 3, 4, and the register input pins r0_in, r1_in, r2_in, r3_in correspond to the register data output pins r0_out, r1_out, r2_out, r3_out one by one;
[0028] The register number to be accessed is received through the register input pins r0_in, r1_in, r2_in, and r3_in, and the register data to be accessed is output through the register data output pins r0_out, r1_out, r2_out, and r3_out.
[0029] Optionally, for each storage area, an access circuit is designed, wherein the access circuit calculates the sub-Bank where the data to be read is located according to the input Warp number and the register number to be accessed, including:
[0030] Use the 32-row and 4-column register Bin[0:31][0:3] to record the register position that needs to be accessed. Set the corresponding row and column positions in the register Bin to 1 according to the register position that needs to be accessed. Perform a bit-by-bit logical OR on each row of data in the register Bin, and the results obtained correspond to the read enable of sub-Bank 0~31, that is, the number of the sub-Bank where the data to be read is located.
[0031] Optionally, for each sub-Bank output data, an output selector is used to select output register data according to the register number to be accessed, including:
[0032] The four register data output from each sub-Bank are input into four output selectors respectively. The outputs of the four output selectors are connected to the corresponding output channels respectively. Each output selector selects the correct register data to output according to the select signal.
[0033] The register data output by each sub-Bank is sent to the corresponding or unit, and the or operation is performed through the or unit, and the result is output through the corresponding register data output pin r_out.
[0034] Optionally, the select signal for each output selector is generated as follows:
[0035] Determine whether the current sub-Bank has been read. If not, the select signals of the four selectors of the current sub-Bank are all 0.
[0036] If the current sub-bank is read in this round, the output of the current sub-bank is filtered, and the 4-bit data of Bin[i] determines the sub-bank i The register number contained in r j The lower two bits of _in are the register to be accessed in the sub-bank i The position in the row, according to r j The lower two bits of _in and Bin[j] generate s w select_s to be used w, where i=0,2,....,31, i represents the index of the sub-Bank, j=0,1,2,3, j represents the index of the register input pin, and w=0,1,2....,127, w represents the index of the output selector.
[0037] The present invention provides a register data storage method and access method, which divides the storage into three levels: Warp, thread, and thread corresponding register. By dividing Warp and thread, as few banks as possible are used to eliminate the problem of GPU thread reading register data conflict, and by dividing the thread corresponding register, the reading of invalid data is reduced. This design does not require preprocessing and does not introduce additional circuit overhead. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1 This is a diagram showing conflicts caused by different threads accessing the same bank at the same time;
[0039] Figure 2 A schematic diagram of conflicts that occur when threads execute single instruction multiple data to read data;
[0040] Figure 3 A flow chart of a register data storage method provided by the present invention;
[0041] Figure 4 This is a diagram of the relationship between Warp and thread in storage;
[0042] Figure 5 A schematic diagram showing the location of Warps and threads in each bank;
[0043] Figure 6 This is a schematic diagram of further storage division of Bank0;
[0044] Figure 7 A flow chart of a register data access method provided by the present invention;
[0045] Figure 8 A circuit structure block diagram for each storage area;
[0046] Fig. 9 Select the schematic for Bank output;
[0047] Fig.10 Generate a select signal flow chart. DETAILED DESCRIPTION
[0048] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention. In addition, the technical features in the various embodiments or single embodiments provided by the present invention can be arbitrarily combined with each other to form a feasible technical solution. This combination is not subject to the constraints of the sequence of steps and / or the structural composition mode, but must be based on the ability of ordinary technicians in this field to achieve. When the combination of technical solutions is contradictory or cannot be achieved, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection required by the present invention.
[0049] When GPU threads access a bank, read conflicts may occur, including conflicts between threads and conflicts when a single thread reads multiple data. The GPU divides tasks into different warps, each of which contains multiple threads, and executes single instruction multi-threaded operations. When multiple threads access the same storage bank at the same time, read conflicts may occur between these threads, such as Figure 1 As shown in the figure, Thread 1, 2, and 3 read Bank 1 at the same time, resulting in a Bank conflict. In order to read the data correctly, it is necessary to access the Bank in a queue, resulting in data delay.
[0050] When a thread executes a single instruction with multiple operands, if the operands (register data) required by the thread are located at different addresses in the bank, a read data conflict will also occur. Figure 2 As shown, Thread0 needs to read data from four registers, registers 0, 1, 4, and 9. Registers 0 and 1 are located at the same address addr0 and can be read out at one time, while registers 4 and 9 are located at different addresses and need to be read out separately.
[0051] To solve these problems, the present invention reasonably divides the storage mode on the basis of increasing the number of banks, and stores the data that may cause read conflicts separately to eliminate the above two conflicts.
[0052] Figure 3 A flow chart of a register data storage method provided by the present invention, the method comprising the following steps:
[0053] Step 1: store the register data of threads with the same number in different warps into the same storage bank, and store the register data of different threads in the same warp into different banks.
[0054] It is understandable that a thread warp includes multiple threads Thread, and a thread Thread has multiple register data, and each thread warp, thread and register are numbered separately.
[0055] At the warp level, different warps are executed serially without access conflicts, so the register data of threads with the same number in different warps can be stored in the same storage bank.
[0056] At the thread level, since different threads of the same Warp may conflict with each other, in order to avoid conflicts between threads, the register data of threads with different numbers in the same Warp are stored in different Banks. Assuming the number of threads in each warp is T, T Banks are required.
[0057] For example, there are 8 warps, numbered 0 to 7, each warp includes 8 threads, numbered 0 to 7, and each thread has 128 register data, numbered 0 to 127.
[0058] First, store the register data of threads with the same number in different warps in the same bank. Figure 4 As shown, the register data of thread No. 0 of Warp0~Warp7 is stored in Bank0, the register data of thread No. 1 of Warp0~Warp7 is stored in Bank1, the register data of thread No. 2 of Warp0~Warp7 is stored in Bank2, the register data of thread No. 3 of Warp0~Warp7 is stored in Bank3, the register data of thread No. 4 of Warp0~Warp7 is stored in Bank4, the register data of thread No. 5 of Warp0~Warp7 is stored in Bank5, the register data of thread No. 6 of Warp0~Warp7 is stored in Bank6, and the register data of thread No. 7 of Warp0~Warp7 is stored in Bank7.
[0059] Step 2: The register data of threads with the same number in different warps each occupy only one address in the same bank, where one bank occupies one storage area.
[0060] It is understandable that at the register level of each thread, in order to avoid possible read conflicts when threads execute single instruction multiple operands, based on step 1, the register data of threads with the same number in different warps only occupy one address in the Bank respectively. Assuming the number of thread warps is W, the depth of the Bank is W at this time.
[0061] like Figure 5 As shown, the register data of thread No. 0 of Warp0 is stored at the first address of Bank0, the register data of thread No. 0 of Warp1 is stored at the second address of Bank0, the register data of thread No. 0 of Warp2 is stored at the third address of Bank0, the register data of thread No. 0 of Warp3 is stored at the fourth address of Bank0, the register data of thread No. 0 of Warp4 is stored at the fifth address of Bank0, the register data of thread No. 0 of Warp5 is stored at the sixth address of Bank0, the register data of thread No. 0 of Warp6 is stored at the seventh address of Bank0, and the register data of thread No. 0 of Warp7 is stored at the eighth address of Bank0.
[0062] The register data of thread No. 1 of Warp0 is stored in the first address of Bank1, the register data of thread No. 1 of Warp1 is stored in the second address of Bank1, the register data of thread No. 1 of Warp2 is stored in the third address of Bank1, the register data of thread No. 1 of Warp3 is stored in the fourth address of Bank1, the register data of thread No. 1 of Warp4 is stored in the fifth address of Bank1, the register data of thread No. 1 of Warp5 is stored in the sixth address of Bank1, the register data of thread No. 1 of Warp6 is stored in the seventh address of Bank1, and the register data of thread No. 1 of Warp7 is stored in the eighth address of Bank1.
[0063] The register data of thread No. 2 of Warp0 is stored in the first address of Bank2, the register data of thread No. 2 of Warp1 is stored in the second address of Bank2, the register data of thread No. 2 of Warp2 is stored in the third address of Bank2, the register data of thread No. 2 of Warp3 is stored in the fourth address of Bank2, the register data of thread No. 2 of Warp4 is stored in the fifth address of Bank2, the register data of thread No. 2 of Warp5 is stored in the sixth address of Bank2, the register data of thread No. 2 of Warp6 is stored in the seventh address of Bank2, and the register data of thread No. 2 of Warp7 is stored in the eighth address of Bank2.
[0064] The register data of thread No. 3 of Warp0 is stored in the first address of Bank3, the register data of thread No. 3 of Warp1 is stored in the second address of Bank3, the register data of thread No. 3 of Warp2 is stored in the third address of Bank3, the register data of thread No. 3 of Warp3 is stored in the fourth address of Bank3, the register data of thread No. 3 of Warp4 is stored in the fifth address of Bank3, the register data of thread No. 3 of Warp5 is stored in the sixth address of Bank3, the register data of thread No. 3 of Warp6 is stored in the seventh address of Bank3, and the register data of thread No. 3 of Warp7 is stored in the eighth address of Bank3.
[0065] The register data of thread No. 4 of Warp0 is stored in the first address of Bank4, the register data of thread No. 4 of Warp1 is stored in the second address of Bank4, the register data of thread No. 4 of Warp2 is stored in the third address of Bank4, the register data of thread No. 4 of Warp3 is stored in the fourth address of Bank4, the register data of thread No. 4 of Warp4 is stored in the fifth address of Bank4, the register data of thread No. 4 of Warp5 is stored in the sixth address of Bank4, the register data of thread No. 4 of Warp6 is stored in the seventh address of Bank4, and the register data of thread No. 4 of Warp7 is stored in the eighth address of Bank4.
[0066] The register data of thread No. 5 of Warp0 is stored in the first address of Bank5, the register data of thread No. 5 of Warp1 is stored in the second address of Bank5, the register data of thread No. 5 of Warp2 is stored in the third address of Bank5, the register data of thread No. 5 of Warp3 is stored in the fourth address of Bank5, the register data of thread No. 5 of Warp4 is stored in the fifth address of Bank5, the register data of thread No. 5 of Warp5 is stored in the sixth address of Bank5, the register data of thread No. 5 of Warp6 is stored in the seventh address of Bank5, and the register data of thread No. 5 of Warp7 is stored in the eighth address of Bank5.
[0067] The register data of thread No. 6 of Warp0 is stored in the first address of Bank6, the register data of thread No. 6 of Warp1 is stored in the second address of Bank6, the register data of thread No. 6 of Warp2 is stored in the third address of Bank6, the register data of thread No. 6 of Warp3 is stored in the fourth address of Bank6, the register data of thread No. 6 of Warp4 is stored in the fifth address of Bank6, the register data of thread No. 6 of Warp5 is stored in the sixth address of Bank6, the register data of thread No. 6 of Warp6 is stored in the seventh address of Bank6, and the register data of thread No. 6 of Warp7 is stored in the eighth address of Bank6.
[0068] The register data of thread No. 7 of Warp0 is stored in the first address of Bank7, the register data of thread No. 7 of Warp1 is stored in the second address of Bank7, the register data of thread No. 7 of Warp2 is stored in the third address of Bank7, the register data of thread No. 7 of Warp3 is stored in the fourth address of Bank7, the register data of thread No. 7 of Warp4 is stored in the fifth address of Bank7, the register data of thread No. 7 of Warp5 is stored in the sixth address of Bank7, the register data of thread No. 7 of Warp6 is stored in the seventh address of Bank7, and the register data of thread No. 7 of Warp7 is stored in the eighth address of Bank7.
[0069] Step 3: Split a bank into multiple sub-banks with the same bit width evenly by column.
[0070] It is understandable that in order to reduce the reading of invalid data each time, each Bank is split into multiple sub-Banks with the same bit width by column. Assuming that each thread has R n-bit registers, the Bank is split into B sub-Banks by column. At this time, the bit width of the Bank is R*n, and the number of sub-Banks is T*B. T storage areas, one Bank, or B sub-Banks are stored in one storage area.
[0071] Based on step S2, each Bank is further divided into 32 sub-Banks, and each row of each sub-Bank stores 4 register data.
[0072] Step 4: The address of the register data of each Warp thread in the Bank is the same as the Warp number, and the register data of each thread is continuously and evenly stored in different sub-Banks, among which the register data with smaller numbers is stored in the lower sub-Bank, and the register data with larger numbers is stored in the higher sub-Bank.
[0073] In order to facilitate data access, in each Bank, the address of the register data of each Warp thread is the same as the Warp number, and the register data of each thread is continuously and evenly stored in different sub-Banks. Figure 6 According to the register number, the data of small registers is stored in the low order of the Bank, and the data of large registers is stored in the high order of the Bank, so that the 128-bit register data of each thread is continuously and evenly stored in 32 sub-Banks.
[0074] See also Figure 7 , a register data access method provided by the present invention, the method comprising:
[0075] Step S1 ′, storing register data based on a register data storage method.
[0076] It is understandable that the register data is stored in the manner of steps S1 to S4 above.
[0077] Step S2', designing an access circuit for each storage area, wherein the access circuit calculates the sub-Bank where the data to be read is located according to the input Warp number and the register number to be accessed.
[0078] It is understandable that a corresponding thread data access method is designed for the above storage partitioning method, assuming that the number of registers to be accessed is K.
[0079] In order to reduce the access of invalid data, we must first calculate the sub-bank according to the register number, and only read the sub-bank where the required data is located. The register numbered m is stored in the m / (T / B)th sub-bank, and the read address is the Warp number being executed at this time. There are two sources of register numbers, one is external input, and the other is the output of the access sub-bank. The first is the regular access mode, which is read out in one cycle. The second is the proxy mode, which first reads the register area number that is actually to be accessed according to the external input, and then accesses the corresponding data, which is read out in two cycles.
[0080] It should be noted that for each storage area, an access circuit is designed, see Figure 8, the access circuit includes 4 read register channels, Warp input channels, include units, select units, 128 output selectors and 4 or units, among which, each sub-Bank corresponds to 4 output selectors, and the 4 read register channels are connected to the include unit and the select unit. The p-th output selector of each sub-Bank is connected to the p-th or unit, p=1, 2, 3, 4, and the register input pins r0_in, r1_in, r2_in, r3_in correspond to the register data output pins r0_out, r1_out, r2_out, r3_out one by one;
[0081] The register number to be accessed is received through the register input pins r0_in, r1_in, r2_in, and r3_in, and the register data to be accessed is output through the register data output pins r0_out, r1_out, r2_out, and r3_out.
[0082] For example, r0_in, r1_in, r2_in, and r3_in input 3, 1, 4, and 9 respectively. At this time, the Warp number Warp_number of the access register is 0, and the access circuit is the access circuit of Bank0, that is, accessing registers 3, 1, 4, and 9 of Warp 0 and Thread 0.
[0083] The access circuit calculates the sub-Bank where the data to be read is located according to the input Warp number and the register number to be accessed, including:
[0084] Use the 32-row and 4-column register Bin[0:31][0:3] to record the register position that needs to be accessed. Set the corresponding row and column position in the register Bin to 1 according to the register position that needs to be accessed. Perform a bit-wise logical OR on each row of data in the register Bin. The results obtained correspond to the read enable of sub-Bank0_0~0_31 (indicating sub-Bank 0 to sub-Bank 31 of Bank0), that is, the number of the sub-Bank where the data to be read is located.
[0085] For details, see Figure 8, according to the register numbers input by the above four read channels, determine the sub-Bank to be accessed. Use the 32-row and 4-column register Bin[0:31][0:3] to record the register position to be accessed. According to the currently accessed register numbers 3, 1, 4, and 9, the 1st and 3rd columns of the 0th row of register Bin[0:31][0:3] are 1, the 0th column of the 2nd row is 1, the 1st column of the 3rd row is 1, and the other bits in the array are 0. The results obtained after bitwise OR of each row of data correspond to the read enable of sub-Bank0_0~0_31 in Bank0, among which the read enable of Bank0_0, Bank0_1, and Bank0_2 is valid, and Bank0_0, Bank0_1, and Bank0_2 represent the 0th, 1st, and 2nd sub-Banks of Bank0, respectively.
[0086] Step S3', for the output data of each sub-Bank, use the output selector to select the output register data according to the register number that needs to be accessed.
[0087] It is understandable that if the number of registers to be accessed is K, invalid data may exist in the T / B register data output by each sub-Bank, and the output register data needs to be screened. Each sub-Bank corresponds to K output selectors, and the output selector selects the output data according to the register number, selects valid data from all sub-Bank output data, and outputs invalid data as 0. Each output selector sends data to a fixed output channel.
[0088] It can be understood that, taking the currently accessed register numbers 3, 1, 4, and 9 as an example, the sub-banks where the register data to be accessed are located are determined to be sub-bank0_0, sub-bank0_1, and sub-bank0_2. Each row of each sub-bank stores 4 register data, and each sub-bank is equipped with 4 output selectors, which can be seen in Fig. 9 Each bit of the sub-Bank corresponds to an output selector. For example, the four bits of sub-Bank0_0 correspond to the four output registers s0, s1, s2 and s3 respectively.
[0089] According to the need to access sub-Bank0_0, sub-Bank0_1 and sub-Bank0_2 as determined in step S2', the four register data output by each sub-Bank are respectively input into four output selectors, and the outputs of the four output selectors are respectively connected to the corresponding output channels. Each output selector selects the correct register data according to the select signal and outputs it to the corresponding output channel.
[0090] in, Fig. 9 The select signal received by the selector is generated as follows Fig.10First, determine whether the current Bank has been read. If not, the select signals of the selectors of the Bank are all 0. If the current sub-Bank is read in this round, the output of the current sub-Bank is screened, and the 4-bit data of Bin[i] determines the sub-Bank. i The register number contained in r j The lower two bits of _in are the register to be accessed in the sub-bank i The position in the row, according to r j The lower two bits of _in and Bin[j] generate s w select_s to be used w , where i=0,2,....,31, j=0,1,2,3, w=0,1,2....,127.
[0091] Fig.10 In the example, the output selector s0 in sub-Bank0_0 is connected to the output channel r0_out. S0 should output the data to be accessed by r0_in. The 4-bit data of Bin[0] determines which register data is contained in sub-Bank0_0. The lower two bits of r0_in are the position of the register in the sub-Bank row. Fig. 9 In the example, the select signal used by s0 is generated according to the lower two bits of r0_in and Bin[0], and the other selectors are the same as above. There are 128 output selectors, of which s(4n) is connected to r0_out, n is the number of the sub-Bank, s(4n) is the first output selector of sub-Bankn, that is, the output channel corresponding to the first output selector of each sub-Bank is r0_out, and each output channel will receive data sent by B sub-Banks, where B is the number of sub-Banks divided into columns. Invalid data is set to 0, and each or unit performs bitwise or on the received B register data to output the final result.
[0092] For example, according to the selection operation in the previous step, there is only one valid data among the 32 data sent to r0_out at this time, and the other invalid data are all 0. The 32 register data are sent to the first or unit, and the or unit performs a bitwise OR operation on the 32 register data and outputs the data to be accessed by r0_in. The same is true for other outputs.
[0093] A register data storage method and access method provided by an embodiment of the present invention stores threads of the same number of different Warps in the same Bank, thereby minimizing the number of Banks used in this patent. By storing different threads of a Warp in different Banks, the problem of data read conflicts between threads is solved. In each Bank, each thread only occupies one address, thereby solving the conflict problem of one thread accessing multiple data. As a result, there is no data conflict problem when threads access data, and there is no need to generate queues for serial access, thereby reducing data access delays. At the same time, threads of different Warps are stored in the same Bank, thereby reducing the number of Banks and reducing hardware resource costs. A thread is evenly stored in multiple Banks. When the thread reads multiple registers, it only accesses the Bank storing the corresponding registers, thereby reducing access to invalid data. This method is completely transparent to the software layer and does not require the development of other software to support it.
[0094] It should be noted that in the above embodiments, the description of each embodiment has its own emphasis, and for parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0095] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0096] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded computer, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0097] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0098] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0099] Although the preferred embodiments of the present invention have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.
[0100] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
Claims
1. A register data storage method, characterized in that: include: Store the register data of threads with the same number in different warps into the same storage bank, and store the register data of different threads in the same warp into different banks; The register data of threads with the same number in different warps each occupy only one address in the same bank, where one bank occupies one storage area; Split a bank into multiple sub-banks with the same bit width evenly by column; The address of the register data of each warp thread in the bank is the same as the warp number, and the register data of each thread is stored in different sub-banks in a continuous and even manner, among which the register data with a small number is stored in the low-order sub-bank, and the register data with a large number is stored in the high-order sub-bank; There are 8 thread warps, numbered 0 to 7. Each warp includes 8 threads, numbered 0 to 7. Each thread has 128 register data, numbered 0 to 127. The register data of threads with the same number in different warps each occupy only one address in the same bank, including: Store the register data of thread No. 0 of Warp0 at the first address of Bank0, store the register data of thread No. 0 of Warp1 at the second address of Bank0, store the register data of thread No. 0 of Warp2 at the third address of Bank0, store the register data of thread No. 0 of Warp3 at the fourth address of Bank0, store the register data of thread No. 0 of Warp4 at the fifth address of Bank0, store the register data of thread No. 0 of Warp5 at the sixth address of Bank0, store the register data of thread No. 0 of Warp6 at the seventh address of Bank0, and store the register data of thread No. 0 of Warp7 at the eighth address of Bank0; Store the register data of thread No. 1 of Warp0 at the first address of Bank1, store the register data of thread No. 1 of Warp1 at the second address of Bank1, store the register data of thread No. 1 of Warp2 at the third address of Bank1, store the register data of thread No. 1 of Warp3 at the fourth address of Bank1, store the register data of thread No. 1 of Warp4 at the fifth address of Bank1, store the register data of thread No. 1 of Warp5 at the sixth address of Bank1, store the register data of thread No. 1 of Warp6 at the seventh address of Bank1, and store the register data of thread No. 1 of Warp7 at the eighth address of Bank1; Store the register data of thread No. 2 of Warp0 at the first address of Bank2, store the register data of thread No. 2 of Warp1 at the second address of Bank2, store the register data of thread No. 2 of Warp2 at the third address of Bank2, store the register data of thread No. 2 of Warp3 at the fourth address of Bank2, store the register data of thread No. 2 of Warp4 at the fifth address of Bank2, store the register data of thread No. 2 of Warp5 at the sixth address of Bank2, store the register data of thread No. 2 of Warp6 at the seventh address of Bank2, and store the register data of thread No. 2 of Warp7 at the eighth address of Bank2; Store the register data of thread No. 3 of Warp0 at the first address of Bank3, store the register data of thread No. 3 of Warp1 at the second address of Bank3, store the register data of thread No. 3 of Warp2 at the third address of Bank3, store the register data of thread No. 3 of Warp3 at the fourth address of Bank3, store the register data of thread No. 3 of Warp4 at the fifth address of Bank3, store the register data of thread No. 3 of Warp5 at the sixth address of Bank3, store the register data of thread No. 3 of Warp6 at the seventh address of Bank3, and store the register data of thread No. 3 of Warp7 at the eighth address of Bank3; Store the register data of thread No. 4 of Warp0 at the first address of Bank4, store the register data of thread No. 4 of Warp1 at the second address of Bank4, store the register data of thread No. 4 of Warp2 at the third address of Bank4, store the register data of thread No. 4 of Warp3 at the fourth address of Bank4, store the register data of thread No. 4 of Warp4 at the fifth address of Bank4, store the register data of thread No. 4 of Warp5 at the sixth address of Bank4, store the register data of thread No. 4 of Warp6 at the seventh address of Bank4, and store the register data of thread No. 4 of Warp7 at the eighth address of Bank4; Store the register data of thread No. 5 of Warp0 at the first address of Bank5, store the register data of thread No. 5 of Warp1 at the second address of Bank5, store the register data of thread No. 5 of Warp2 at the third address of Bank5, store the register data of thread No. 5 of Warp3 at the fourth address of Bank5, store the register data of thread No. 5 of Warp4 at the fifth address of Bank5, store the register data of thread No. 5 of Warp5 at the sixth address of Bank5, store the register data of thread No. 5 of Warp6 at the seventh address of Bank5, and store the register data of thread No. 5 of Warp7 at the eighth address of Bank5; Store the register data of thread No. 6 of Warp0 at the first address of Bank6, store the register data of thread No. 6 of Warp1 at the second address of Bank6, store the register data of thread No. 6 of Warp2 at the third address of Bank6, store the register data of thread No. 6 of Warp3 at the fourth address of Bank6, store the register data of thread No. 6 of Warp4 at the fifth address of Bank6, store the register data of thread No. 6 of Warp5 at the sixth address of Bank6, store the register data of thread No. 6 of Warp6 at the seventh address of Bank6, and store the register data of thread No. 6 of Warp7 at the eighth address of Bank6; The register data of thread No. 7 of Warp0 is stored in the first address of Bank7, the register data of thread No. 7 of Warp1 is stored in the second address of Bank7, the register data of thread No. 7 of Warp2 is stored in the third address of Bank7, the register data of thread No. 7 of Warp3 is stored in the fourth address of Bank7, the register data of thread No. 7 of Warp4 is stored in the fifth address of Bank7, the register data of thread No. 7 of Warp5 is stored in the sixth address of Bank7, the register data of thread No. 7 of Warp6 is stored in the seventh address of Bank7, and the register data of thread No. 7 of Warp7 is stored in the eighth address of Bank7.
2. The register data storage method according to claim 1, characterized in that: The register data of threads with the same number in different warps are stored in the same storage bank, and the register data of different threads in the same warp are stored in different banks, including: The register data of thread 0 of Warp0~Warp7 is stored in Bank0, the register data of thread 1 of Warp0~Warp7 is stored in Bank1, the register data of thread 2 of Warp0~Warp7 is stored in Bank2, the register data of thread 3 of Warp0~Warp7 is stored in Bank3, the register data of thread 4 of Warp0~Warp7 is stored in Bank4, the register data of thread 5 of Warp0~Warp7 is stored in Bank5, the register data of thread 6 of Warp0~Warp7 is stored in Bank6, and the register data of thread 7 of Warp0~Warp7 is stored in Bank7.
3. The register data storage method according to claim 1, characterized in that: The method of evenly splitting a bank into multiple sub-banks with the same bit width by column includes: Each bank is divided into 32 sub-banks, and each row of each sub-bank stores 4 register data.
4. A register data access method, characterized in that: include: Storing register data based on the register data storage method according to claim 1; Design an access circuit for each storage area, and the access circuit calculates the sub-bank where the data to be read is located according to the input Warp number and the register number to be accessed; For the output data of each sub-Bank, the output selector is used to select the output register data according to the register number to be accessed.
5. The register data access method according to claim 4, characterized in that: The access circuit includes 4 read register channels, a Warp input channel, an include unit, a select unit, 128 output selectors and 4 or units, wherein each sub-Bank corresponds to 4 output selectors, the 4 read register channels are connected to the include unit and the select unit, the p-th output selector of each sub-Bank is connected to the p-th or unit, p=1, 2, 3, 4, and the register input pins r0_in, r1_in, r2_in, r3_in correspond to the register data output pins r0_out, r1_out, r2_out, r3_out one by one; The register number to be accessed is received through the register input pins r0_in, r1_in, r2_in, and r3_in, and the register data to be accessed is output through the register data output pins r0_out, r1_out, r2_out, and r3_out.
6. The register data access method according to claim 5, characterized in that: The access circuit is designed for each storage area, and the access circuit calculates the sub-Bank where the data to be read is located according to the input Warp number and the register number to be accessed, including: Use the 32-row and 4-column register Bin[0:31][0:3] to record the register position that needs to be accessed. Set the corresponding row and column positions in the register Bin to 1 according to the register position that needs to be accessed. Perform a bit-by-bit logical OR on each row of data in the register Bin, and the results obtained correspond to the read enable of sub-Bank 0~31, that is, the number of the sub-Bank where the data to be read is located.
7. The register data access method according to claim 6, characterized in that: For each sub-Bank output data, use the output selector to select the output register data according to the register number to be accessed, including: The four register data output from each sub-Bank are input into four output selectors respectively. The outputs of the four output selectors are connected to the corresponding output channels respectively. Each output selector selects the correct register data to output according to the select signal. The register data output by each sub-Bank is sent to the corresponding or unit, and the or operation is performed through the or unit, and the result is output through the corresponding register data output pin r_out.
8. The register data access method according to claim 7, characterized in that: The select signal for each output selector is generated as follows: Determine whether the current sub-Bank has been read. If not, the select signals of the four selectors of the current sub-Bank are all 0. If the current sub-bank is read in this round, the output of the current sub-bank is filtered, and the 4-bit data of Bin[i] determines the sub-bank i The register number contained in r j The lower two bits of _in are the register to be accessed in the sub-bank i The position in the row, according to r j The lower two bits of _in and Bin[j] generate s w select_s to be used w , where i=0,2,....,31, i represents the index of the sub-Bank, j=0,1,2,3, j represents the index of the register input pin, and w=0,1,2....,127, w represents the index of the output selector.
Citation Information
Patent Citations
Processor device and instruction execution method thereof
CN114489792A
SIMT instruction processing method and device
CN114625421A
Method for distributing and releasing shared register file of unified dyeing graphics processor
CN115393156A
Method and device for reading and writing register file, electronic equipment and storage medium
CN116560726A
Computer system
JP2006190120A
