Memory access method, computer program product, electronic device and medium
By identifying and grouping the performance information of the memory in the motherboard slot and the expansion slot, it realizes interleaved memory access, solves the problem of insufficient memory capacity, and improves the memory read and write rate and load balancing.
Patent Information
- Application Number
- CN202410920911.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-10
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2044-07-10
AI Technical Summary
Existing memory technology cannot effectively improve memory bandwidth and capacity, limiting the memory requirements of high-performance processors.
By identifying the performance information of the memory in the motherboard slot and the expansion slot, grouping and staggered access to the memory, unified management and load balancing of the motherboard memory and expansion memory are achieved, and the memory read and write speed is improved.
Expand the memory of the computer when the memory capacity is insufficient, realize interleaved memory access, ensure load balancing, and increase the memory read and write rate.
Smart Images

Figure CN118467182B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a memory access method, a computer program product, an electronic device and a medium. Background Art
[0002] Memory is an important component of a computer, also known as internal memory and main memory. It is used to temporarily store the calculation data in the central processing unit (CPU) and the data exchanged with external memory such as hard disk. The strength of memory performance affects the overall level of the computer. Memory generally adopts the structure of memory sticks, which are composed of multiple memory chips. A memory stick can be inserted into a slot on the motherboard. A memory controller is also provided on the motherboard, which is used to coordinate the data transmission between the CPU and the memory and the memory access operation. The channel between the memory controller and the memory can be called a memory channel. A memory channel can correspond to one or more memory stick slots. With the development of high-performance processors, processors have higher and higher requirements for memory bandwidth and memory capacity. However, due to the characteristics of the memory stick itself and the constraints of manufacturing technology, the bandwidth and capacity of memory cannot be increased indefinitely. Summary of the invention
[0003] In order to solve the above technical problems or at least partially solve the above technical problems, an embodiment of the present invention provides a memory access method, a computer program product, an electronic device and a medium.
[0004] In a first aspect, an embodiment of the present invention provides a memory access method, comprising:
[0005] Identify performance information of a first memory in a motherboard slot;
[0006] Identifying performance information of a second memory in the expansion slot, the second memory being connected to the first memory based on a cache coherent interconnect protocol;
[0007] grouping the first memory and the second memory according to the performance information of the first memory and the performance information of the second memory;
[0008] According to the grouping conditions of the first memory and the second memory, each group of the first memory and the second memory is accessed in an interleaved manner.
[0009] Optionally, the identifying performance information of the first memory in the motherboard slot includes: identifying a first number of memory channels currently used by the motherboard slot and a first memory operating rate corresponding to each memory channel, the first number and the first memory operating rate serving as the performance information of the first memory in the motherboard slot.
[0010] Optionally, identifying the performance information of the second memory in the expansion slot includes: identifying a second number of memory channels currently used by the expansion slot and a maximum operating speed supported by the second memory; determining, based on the second number and the maximum operating speed, a second memory operating speed corresponding to each memory channel of the expansion slot, and using the second number and the second memory operating speed as the performance information of the second memory in the expansion slot.
[0011] Optionally, determining the second memory operating rate corresponding to each memory channel of the expansion slot based on the second number and the maximum operating rate includes: identifying the bandwidth of the expansion slot; taking the product of the second number and the maximum operating rate as the maximum supported bandwidth, and comparing the bandwidth of the expansion slot with the maximum supported bandwidth; when the bandwidth of the expansion slot is greater than the maximum supported bandwidth, taking the maximum operating rate as the second memory operating rate corresponding to each memory channel of the expansion slot; when the bandwidth of the expansion slot is less than or equal to the maximum supported bandwidth, taking the quotient of the bandwidth of the expansion slot and the second number as the second memory operating rate corresponding to each memory channel of the expansion slot.
[0012] Optionally, grouping the first memory and the second memory according to the performance information of the first memory and the performance information of the second memory includes: taking the product of the first number and the operating speed of the first memory as the total operating speed corresponding to the first memory; taking the product of the second number and the operating speed of the second memory as the total operating speed corresponding to the second memory; taking the total operating speed corresponding to the first memory being equal to the total operating speed corresponding to the second memory as a constraint condition, and grouping the first memory and the second memory according to the constraint condition.
[0013] Optionally, the first memory and the second memory are grouped according to the following formula (1):
[0014] (1)
[0015] Wherein, N represents the first number, M represents the second number, p represents the first memory operation rate, and c represents the second memory operation rate;
[0016] The first memory is divided into i groups, each group has n memory channels; the second memory is divided into j groups, each group has m memory channels; i, j, n, and m are positive integers greater than or equal to 1 respectively.
[0017] Optionally, the interleaving access to each group of the first memory and the second memory according to the grouping situation of the first memory and the grouping situation of the second memory includes: receiving data to be processed sent by at least one processor; dividing the data to be processed to obtain multiple data fragments; and allocating the multiple data fragments to each group of the first memory and each group of the second memory in turn.
[0018] Optionally, the sequentially allocating the multiple data fragments to the respective groups of the first memory and the respective groups of the second memory includes: writing the multiple data fragments into a preset queuing queue; allocating the data fragments in the queuing queue in parallel to the respective groups of the first memory and the respective groups of the second memory in the order of the queuing queue; in response to the completion of the allocated data fragments processing of the respective groups of the first memory, allocating the remaining data fragments in the queuing queue in parallel to the respective groups of the first memory; in response to the completion of the allocated data fragments processing of the respective groups of the second memory, allocating the remaining data fragments in the queuing queue in parallel to the respective groups of the second memory.
[0019] Optionally, the segmenting the data to be processed to obtain a plurality of data fragments includes: determining a first segmentation byte number; and segmenting the data to be processed according to the first segmentation byte number to obtain a plurality of first data fragments.
[0020] Optionally, the segmenting the data to be processed to obtain a plurality of data segments includes: determining a first delay time corresponding to the first memory and a second delay time corresponding to the second memory; determining a second segmentation byte number and a third segmentation byte number according to the first delay time and the second delay time, wherein the second segmentation byte number is greater than the third segmentation byte number; segmenting the data to be processed according to the second segmentation byte number and the third segmentation byte number to obtain a plurality of second data segments and a plurality of third data segments;
[0021] The allocating the multiple data fragments to the respective groups of the first memory and the respective groups of the second memory in sequence includes: allocating the multiple second data fragments to the respective groups of the first memory in sequence, and allocating the multiple third data fragments to the respective groups of the second memory in sequence.
[0022] Optionally, the data to be processed is split according to the second split byte number and the third split byte number to obtain multiple second data fragments and multiple third data fragments, including: the data to be processed is split according to the second split byte number, the number of groups in the first memory, the third split byte number and the number of groups in the second memory to obtain multiple second data fragments and multiple third data fragments.
[0023] Optionally, after grouping the first memory and the second memory, the method further includes: allocating continuous address space to each group of the first memory according to the slot code of the motherboard slot; and allocating continuous address space to each group of the second memory according to the slot code of the expansion slot.
[0024] In a second aspect, an embodiment of the present invention provides a computer program product, including a computer program, which, when executed by a processor, implements the memory access method provided by any embodiment of the present invention.
[0025] In a third aspect, an embodiment of the present invention provides an electronic device, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; the memory is used to store computer programs; and the processor is used to implement the memory access method provided by the embodiment of the present invention when executing the program stored in the memory.
[0026] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the memory access method provided by an embodiment of the present invention.
[0027] The technical solution provided by the embodiments of the present invention brings at least the following beneficial effects:
[0028] The memory access method provided by the embodiment of the present invention, by identifying the performance information of the first memory in the mainboard slot and the performance information of the second memory in the extension slot, groups the first memory and the second memory according to the performance information of the first memory and the performance information of the second memory, and interleaves the access to the first memory and the second memory according to the grouping of the first memory and the grouping of the second memory. The method can expand the memory for the server or computer when the memory capacity of the mainboard of the server or computer is insufficient. Furthermore, by grouping the mainboard memory and the extension memory, and then interleave access to each group of the first memory and each group of the second memory, unified management of the mainboard memory and the extension memory can be achieved, load balancing of the mainboard memory and the extension memory is ensured, and memory interleaving access is achieved, thereby improving the memory read and write rate. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art are briefly introduced below.
[0030] Figure 1 A schematic diagram of a flow chart of a memory access method provided by an embodiment of the present invention is shown;
[0031] Figure 2 A schematic diagram showing accessing a memory according to a memory access method provided in an embodiment of the present invention;
[0032] Figure 3 A schematic diagram showing a flow chart of a memory access method provided by another embodiment of the present invention;
[0033] Figure 4 A schematic diagram showing a flow chart of a memory access method provided by another embodiment of the present invention;
[0034] Figure 5 A schematic structural diagram of an electronic device provided by an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0035] Below in conjunction with the accompanying drawings, exemplary embodiments of the present invention are described, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be appreciated by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention.
[0036] Figure 1 FIG. 1 is a flow chart of a memory access method provided by an embodiment of the present invention. Figure 1 As shown, the memory access method includes:
[0037] Step S101: Identify performance information of a first memory in a motherboard slot.
[0038] Among them, the first memory in the motherboard slot is the memory of the current host (such as a server or a computer) itself. The performance information of the first memory may include, for example, the number of memory channels currently used on the motherboard slot (recorded as the first number), the operating speed corresponding to the first memory of each memory channel (recorded as the first memory operating speed) and the capacity, etc. The number of memory channels on the motherboard slot is related to the processor manufacturer, model, design, motherboard model, etc. For example, the number of memory channels on the motherboard slot can be 8, 12, 16, etc. The number of memory channels used on the motherboard slot is less than or equal to the number of memory channels actually provided by the motherboard slot. The operating speed of the first memory is related to the operating speed supported by the processor and the memory insertion method. Optionally, the first memory is directly connected to the processor, and there is no intermediate connector between the first memory and the processor. The operating speed of the first memory is not affected by the intermediate connector, and the operating speed of the first memory is the operating speed of the first memory itself.
[0039] In some optional embodiments, the performance information of the first memory in the motherboard slot is identified through the BIOS system (Basic Input / Output System) of the host (such as a server or a computer). The BIOS system equipped with the host is the most basic control system, which has the function of managing and scheduling the underlying hardware of the computer device. The hardware information control and management of the computer device are all implemented by the BIOS. The performance information of the first memory in the motherboard slot can be obtained through the serial port of the BIOS or the interface between the BIOS and the BMC (Basic Management Controller).
[0040] Step S102: Identify performance information of a second memory in the expansion slot, the second memory being connected to the first memory based on a cache coherent interconnect protocol.
[0041] The second memory in the expansion slot is an extended memory based on the Computer Express Link (CXL) protocol. The Cache Coherent Interconnect Protocol (hereinafter referred to as the CXL protocol) is a high-speed serial protocol designed to solve bottleneck problems in high-performance computing, including memory capacity, memory bandwidth, and I / O (Input / Output) latency. The protocol can achieve memory expansion and memory sharing, and can communicate with peripherals such as computing accelerators (such as graphics processors GPUs and field-programmable gate arrays FPGAs), providing faster and more flexible data exchange and processing methods.
[0042] The performance information of the second memory may include, for example, the number of memory channels currently used on the expansion slot (recorded as the second number), the memory operating speed corresponding to the second memory of each memory channel (recorded as the second memory operating speed), and the capacity. The number of memory channels used on the expansion slot is less than or equal to the number of channels actually possessed by the expansion slot. The operating speed corresponding to the second memory of each memory channel is limited by the operating speed of the memory itself, and because the second memory is not directly connected to the processor, it is also affected by the CXL protocol, the number of memories on the expansion slot, the number of channels, the memory insertion method, and the memory capacity. The actual operating speed of the second memory is less than its own operating speed (i.e., the maximum operating speed supported by the second memory). Optionally, the operating speed of the second memory obtained in this step may be the actual operating speed of the second memory. In other optional embodiments, the operating speed of the second memory obtained in this step may also be the maximum operating speed supported by the second memory.
[0043] Step S103: grouping the first memory and the second memory according to the performance information of the first memory and the performance information of the second memory.
[0044] Optionally, the product of the first number and the operating rate of the first memory is used as the total operating rate corresponding to the first memory, and the product of the second data and the operating rate of the second memory is used as the total operating rate corresponding to the second memory. To ensure load balancing between the first memory and the second memory, the total operating rate corresponding to the first memory is equal to the total operating rate corresponding to the second memory as a constraint condition. The first memory and the second memory are grouped according to the constraint condition. For example, the first memory is divided into i groups, each group has n memory channels, and the operating rate of the first memory corresponding to each memory channel is p. The second memory is divided into j groups, each group has m memory channels, and the operating rate of the second memory corresponding to each memory channel is c. Among them, the constraints are: N×p=M×c, i×n=N, j×m=M. N represents the first number, and M represents the second number.
[0045] According to the above constraints, the values of i, j, n, and m are calculated. It is foreseeable that i, j, n, and m may have multiple sets of integer solutions or non-integer solutions. Furthermore, in the case of multiple sets of integer solutions, in order to make the operation of the computer system most efficient, a set of integer solutions with the smallest i value when the equation is established is selected. When i, j, n, and m cannot be integers, it is necessary to find the smallest number that is closest to the integer solution that can make the equation valid, and obtain the integer solution through rounding.
[0046] After determining the number of first memory groups, the first memory can be divided according to its position on the motherboard slot. Similarly, the second memory can also be divided according to its position on the expansion slot. Then, the preset continuous address space is allocated to each group of the first memory and the second memory. For each group of the first memory, the address space can be allocated to each group of the first memory according to the slot code of the motherboard slot, and the address space is allocated to the memory of each memory channel within the same group according to the arrangement and mapping order of the memory. For each group of the second memory, the address space is allocated to each group of the second memory according to the slot code of the expansion slot, and the address space is allocated to the memory of each memory channel within the same group according to the arrangement and mapping order of the memory.
[0047] Step S104: According to the grouping conditions of the first memory and the second memory, interleavingly access each group of the first memory and the second memory.
[0048] After the first memory and the second memory are grouped, each group of the first memory and each group of the second memory can be accessed alternately to achieve memory interleaving, wherein memory interleaving refers to mapping a continuous memory address to different memories, and improving memory access performance by cross-accessing different memories.
[0049] Optionally, in this embodiment, the data to be processed sent by at least one processor is segmented to obtain multiple data fragments, and the obtained multiple data fragments are sequentially allocated to each group of the first memory and each group of the second memory. The maximum number of bytes that the processor can process can be used as the first segmentation byte number, and the data to be processed is segmented according to the first segmentation byte number to obtain multiple data fragments of the same size.
[0050] As an optional example, Figure 2 As shown, the to-be-processed data Q sent by the processor is divided into K data segments (K is much larger than the sum of the number of groups in the first memory and the number of groups in the second memory), and then data segments are allocated to each group in the first memory and each group in the second memory in parallel: the first data segment is allocated to the first group in the first memory, the second data segment is allocated to the second group in the first memory, and so on, the i-th segment is allocated to the i-th group in the first memory; the (i+1)-th data segment is allocated to the first group in the second memory, the (i+2)-th data segment is allocated to the second group in the second memory, and so on, the (i+j)-th data segment is allocated to the j-th group in the second memory (as shown in FIG. Figure 2If each group in the first memory completes processing of the assigned data fragments, the remaining data fragments are distributed in parallel to each group in the first memory; if each group in the second memory completes processing of the assigned data fragments, the remaining data fragments are distributed in parallel to each group in the second memory (as shown in the solid line in the middle). Figure 2 It is worth noting that in Figure 2 In the example shown, each group of the first memory includes a memory channel, and each group of the second memory also includes a memory channel. Optionally, each group of the first memory may include more than one memory channel, and each group of the second memory may include more than one memory channel. In the case of more than one memory channel, data fragments may be allocated to each memory channel of each group in sequence, for example, firstly allocating data fragments to each memory channel of the first group of the first memory, and then allocating data fragments to each memory channel of the second group of the first memory, and so on, until the allocation of each memory channel of each group of the first memory is completed. After the allocation of each memory channel of each group of the first memory is completed, data fragments are similarly allocated to each memory channel of each group of the second memory. In this embodiment, the data fragments of the data to be processed are allocated to each group of the first memory and the second memory in sequence, so that each group of the first memory and the second memory are in a working state, reducing the situation where some memory is busy and some memory is idle, and ensuring balanced access to memory.
[0051] The memory access method provided by the embodiment of the present invention provides a cross-memory access method, which identifies the performance information of the first memory in the mainboard slot and the performance information of the second memory in the extension slot, groups the first memory and the second memory according to the performance information of the first memory and the performance information of the second memory, and interleaves the access to the first memory and the second memory according to the grouping of the first memory and the grouping of the second memory. The method can expand the memory for the server or computer when the memory capacity of the server or computer mainboard is insufficient. Furthermore, by grouping the mainboard memory and the extension memory, and then interleaving the access to each group of the first memory and each group of the second memory, it is possible to achieve unified management of the mainboard memory and the extension memory, ensure the load balancing of the mainboard memory and the extension memory, and achieve interleaved memory access, thereby improving the memory read and write rate.
[0052] In some optional embodiments, the operating rate of the first memory corresponding to the mainboard end is greater than the operating rate of the second memory corresponding to the expansion end, and there is a rate difference between the memories at both ends, and the data segments of the data to be processed can be written into the queue. The queue is a first-come-first-served, one-to-many queue (one queue corresponds to multiple memory groups). The queue can ensure that the data to be processed is processed in the order in which it arrives at the memory system, and the data segments can be provided to the corresponding memory groups in sequence, thereby reducing the task response time (the time required from the arrival of the data to be processed in the memory system to the completion of the processing of the data to be processed). On the other hand, although the operating rates of the relevant memories are different at the mainboard end and the expansion end, the operating rates at the same end are the same, so the entire memory system only runs at two different rates. This rate difference can ensure that the processing data of the mainboard end itself (or the expansion end) is synchronized, that is, each memory group at the mainboard end completes the processing of the data segments at the same time, and the next group of data segments enters after one group of data segments is processed. Only because the operating rates of the memories at both ends are different, the number of data groups that can be processed by the memories at both ends will be different. It is foreseeable that the mainboard end processes more data segments than the expansion end. Due to the queuing queue of this embodiment, the pre-processing, address mapping and other related operations before data processing will consume as few resources as possible to improve the real-time data processing efficiency.
[0053] Optionally, step S104 of interleaving access to each group of the first memory and the second memory includes: writing multiple data fragments into a preset queuing queue; distributing the data fragments in the queuing queue in parallel to each group of the first memory and each group of the second memory in the order of the queuing queue; in response to each group of the first memory completing the processing of the allocated data fragment, distributing the remaining data fragments in the queuing queue in parallel to each group of the first memory; in response to each group of the second memory completing the processing of the allocated data fragment, distributing the remaining data fragments in the queuing queue in parallel to each group of the second memory. Figure 2 , the first memory operation rate of each group of the first memory is the same, and the time for each group to process the data fragment is the same. Similarly, the time for each group of the second memory to process the data fragment is the same. After allocating data fragments to each group of the first memory and the second memory, if each group of the first memory completes the processing of its data fragment, the remaining data fragments in the queue are allocated to each group of the first memory in turn; if each group of the second memory completes the processing of its data fragment, the remaining data fragments in the queue are allocated to each group of the second memory.
[0054] Figure 3 FIG. 2 is a flow chart of a memory access method provided by another embodiment of the present invention. Figure 3 As shown, the method includes:
[0055] Step S301: identifying a first number of memory channels currently used by a motherboard slot and a first memory operating rate corresponding to each memory channel, the first number and the first memory operating rate being used as performance information of a first memory in the motherboard slot.
[0056] Step S302: Identify the bandwidth of the expansion slot (denoted as Z1). The bandwidth of the expansion slot can be allocated by the host, and its bandwidth is usually higher than the bandwidth of PCIE (Peripheral Component Interconnect Express, a high-speed serial computer expansion bus standard). For example, under the current processor architecture, the maximum bandwidth supported by the cache coherent interconnect protocol can reach 25GB / s. Due to the limitations of the host model and the host allocation logic, the bandwidth allocated to the expansion slot is less than the maximum bandwidth supported by the cache coherent interconnect protocol. Therefore, the bandwidth of the expansion slot can be obtained through the host BIOS system or BMC interface.
[0057] Step S303: taking the product of the second number and the maximum operating rate as the maximum supported bandwidth (denoted as Z2), and comparing the bandwidth Z1 of the expansion slot with the maximum supported bandwidth Z2.
[0058] Step S304: when the bandwidth Z1 of the expansion slot is greater than the maximum supported bandwidth Z2, the maximum operating rate is used as the second memory operating rate corresponding to each memory channel of the expansion slot; the second number and the second memory operating rate are used as performance information of the second memory in the expansion slot.
[0059] Step S305: When the bandwidth Z1 of the expansion slot is less than or equal to the maximum supported bandwidth Z2, the quotient of the bandwidth of the expansion slot and the second number is used as the second memory operation rate corresponding to each memory channel of the expansion slot. The second number and the second memory operation rate are used as the performance information of the second memory in the expansion slot.
[0060] The actual operating speed of the second memory in the expansion slot is limited by the operating speed of the memory itself, the bandwidth of the expansion slot, and because the second memory is not directly connected to the processor, it is also affected by the CXL protocol, the number of memories on the expansion slot, the number of channels, the memory insertion method, and the memory capacity. The actual operating speed of the second memory is lower than its own operating speed (that is, the maximum operating speed supported by the second memory). Therefore, for the second memory at the expansion end, it is necessary to calculate the operating speed of the second memory corresponding to each memory channel of the second memory in two cases:
[0061] Case 1) Z1>Z2, Z2 is used as the second memory operation speed corresponding to each memory channel of the expansion slot;
[0062] Case 2) Z1≤Z2, Z1 / M is used as the second memory operating rate corresponding to each memory channel of the expansion slot.
[0063] Step S306: taking the product of the first number and the operating speed of the first memory as the total operating speed corresponding to the first memory; taking the product of the second number and the operating speed of the second memory as the total operating speed corresponding to the second memory.
[0064] Step S307: taking the total operating rate corresponding to the first memory equal to the total operating rate corresponding to the second memory as a constraint condition, and grouping the first memory and the second memory according to the constraint condition.
[0065] Optionally, the first memory and the second memory are grouped according to the following formula (1):
[0066] (1)
[0067] Wherein, N represents the first number, M represents the second number, p represents the first memory operation rate, and c represents the second memory operation rate;
[0068] The first memory is divided into i groups, each group has n memory channels; the second memory is divided into j groups, each group has m memory channels; i, j, n, and m are positive integers greater than or equal to 1 respectively.
[0069] Step S308: receiving data to be processed sent by at least one processor.
[0070] Step S309: Split the data to be processed into multiple data segments.
[0071] Step S310: Allocate multiple data segments in sequence to each group in the first memory and each group in the second memory.
[0072] Among them, step S301, step S305-step S310 can refer to Figure 1 and Figure 2 The illustrated embodiments are not described in detail here to avoid repetition.
[0073] The memory access method of the embodiment of the present invention can expand the memory for a server or a computer when the memory capacity of the server or computer mainboard is insufficient. Furthermore, by grouping the mainboard memory and the extended memory, and then interleaving access to each group of the first memory and each group of the second memory, unified management of the mainboard memory and the extended memory can be achieved, load balancing of the mainboard memory and the extended memory can be ensured, and interleaved memory access is achieved, thereby improving the memory read and write rate.
[0074] In an optional embodiment, since the path of data transmission from the processor to the extended end memory must be longer than the path of data transmission from the processor to the mainboard end memory, and it involves actions such as protocol handshake, the actual memory delay is not negligible. Optionally, when the mainboard end memory delay is t0 and the extended end memory delay is t1, it is foreseeable that due to the design characteristics, t1>t0. When the data stream to be processed arrives at the memory system, when data fragments are allocated to each group of the first memory and each group of the second memory, since t1>t0, the data fragments allocated to each group of the first memory arrive before the data fragments allocated to each group of the second memory. Further, due to the existence of delay, when the data begins to be processed, the memory of the extended end will have no data processing for a time of (t1-t0). Similarly, after all the data enters the memory, since the processing speed and delay of the mainboard end are lower than those of the extended end, after all the data on the mainboard end is processed, the extended end will continue to be in a state of data processing. If the data read and write rates at both ends are regarded as the same, then (t1-t0) will be generated, and only the extended end will be processing data. Therefore, we need to consider how to perform extended memory access in this case to achieve memory read and write performance consistency. In a high-performance computer system that has already applied extended memory, the existence of latency will further amplify memory inconsistency. In this case, we need to further consider cross-memory access under memory latency.
[0075] In view of this, when an embodiment of the present invention divides the data to be processed, it can divide the data to be processed into data fragments of two sizes, with each group of the first memory processing the large data fragments, and each group of the second memory processing the small data fragments, thereby achieving access balance between the first memory and the second memory and ensuring consistency of memory read and write performance.
[0076] Figure 4 FIG. 2 is a flow chart of a memory access method provided by another embodiment of the present invention. Figure 4 As shown, the method includes:
[0077] Step S401: identifying a first number of memory channels currently used by a motherboard slot and a first memory operating rate corresponding to each memory channel, the first number and the first memory operating rate being used as performance information of a first memory in the motherboard slot.
[0078] Step S402: Identify the bandwidth of the expansion slot.
[0079] Step S403: taking the product of the second number and the maximum operating rate as the maximum supported bandwidth, and comparing the bandwidth of the expansion slot with the maximum supported bandwidth.
[0080] Step S404: when the bandwidth of the expansion slot is greater than the maximum supported bandwidth, the maximum operating rate is used as the second memory operating rate corresponding to each memory channel of the expansion slot; the second number and the second memory operating rate are used as performance information of the second memory in the expansion slot.
[0081] Step S405: When the bandwidth of the expansion slot is less than or equal to the maximum supported bandwidth, the quotient of the bandwidth of the expansion slot and the second number is used as the second memory operation rate corresponding to each memory channel of the expansion slot. The second number and the second memory operation rate are used as the performance information of the second memory in the expansion slot.
[0082] Step S406: taking the product of the first number and the operating speed of the first memory as the total operating speed corresponding to the first memory; taking the product of the second number and the operating speed of the second memory as the total operating speed corresponding to the second memory.
[0083] Step S407: taking the total operating rate corresponding to the first memory equal to the total operating rate corresponding to the second memory as a constraint condition, and grouping the first memory and the second memory according to the constraint condition.
[0084] Optionally, the first memory and the second memory are grouped according to the following formula (1):
[0085] (1)
[0086] Among them, N represents the first number, M represents the second number, p represents the first memory operating rate, and c represents the second memory operating rate; the first memory is divided into i groups, each group has n memory channels; the second memory is divided into j groups, each group has m memory channels; i, j, n, and m are positive integers greater than or equal to 1 respectively.
[0087] Step S408: receiving data to be processed sent by at least one processor.
[0088] Step S409: Determine a first delay time corresponding to the first memory and a second delay time corresponding to the second memory.
[0089] Step S410: Determine a second segmentation byte number and a third segmentation byte number according to the first delay time and the second delay time, wherein the second segmentation byte number is greater than the third segmentation byte number.
[0090] Step S411: Split the data to be processed according to the second split byte number and the third split byte number to obtain a plurality of second data segments and a plurality of third data segments.
[0091] Step S412: allocating the plurality of second data segments to the respective groups in the first memory in sequence, and allocating the plurality of third data segments to the respective groups in the second memory in sequence.
[0092] Among them, steps S401 to S408 can refer to Figure 3 The illustrated embodiments are not described in detail here to avoid repetition.
[0093] For step S409, the first delay time corresponding to the first memory and the second delay time corresponding to the second memory can be determined by the test data. For example, the test data is assigned to the first memory, the time of assigning the test data and the time when the test data arrives at the first memory are recorded, and the difference between the feedback time and the assignment time is used as the first delay time. Similarly, the test data is assigned to the second memory, the time of assigning the test data and the time when the test data arrives at the second memory are recorded, and the difference between the feedback time and the assignment time is used as the second delay time.
[0094] For step S410, in some optional embodiments, a mapping table of delay time and segmentation byte number may be pre-set. For example, as shown in Table 1, the mapping table records the relationship between the first delay time, the second delay time, the second segmentation byte number and the third segmentation byte number.
[0095] Table 1:
[0096]
[0097] The first row of Table 1 indicates that if the first delay time is within the interval [T1, T2], and the second delay time is within the interval [T3, T4], the second segmentation byte number is R1, and the third segmentation byte number is R2.
[0098] In some other optional embodiments, the second segmentation byte number and the third segmentation byte number may be determined according to the ratio between the first delay time and the second delay time. For example, the second segmentation byte number and the third segmentation byte number may be determined according to the following Table 2 or Table 3:
[0099] Table 2:
[0100]
[0101] The first row of Table 2 indicates that when the ratio of the first delay time to the second delay time is in the interval [D1, D2], the second segmentation byte number is R1, and the third segmentation byte number is R2.
[0102] Table 3:
[0103]
[0104] The first row of Table 3 indicates that when the difference between the second delay time and the first delay time and the ratio of the second delay time are in the interval [Y1, Y2], the second segmentation byte number is R1, and the third segmentation byte number is R2.
[0105] For steps S411-S412, optionally, the data to be processed can be segmented in turn according to the second segmentation byte number and the third segmentation byte number to alternately obtain second data segments and third data segments, and then the alternately obtained second data segments and third data segments are allocated to the groups of the first memory and the groups of the second memory.
[0106] Still optionally, the data to be processed is segmented according to the second segmentation byte number, the number of groups in the first memory, the third segmentation byte number, and the number of groups in the second memory to obtain multiple second data fragments and multiple second data fragments. The number of second data fragments may be an integer multiple of the number of groups in the first memory. For example, firstly, a group of second data fragments is segmented according to the second segmentation byte number and the number of groups in the first memory, and a group of third data fragments is obtained according to the third segmentation byte number and the number of groups in the second memory; then, a group of second data fragments is segmented according to the second segmentation byte number and the number of groups in the first memory, and a group of third data fragments is obtained according to the third segmentation byte number and the number of groups in the second memory. And so on, until the segmentation of the data to be processed is completed.
[0107] The memory access method of an embodiment of the present invention takes into account the different delay times of the mainboard end and the expansion end. When interleaving the access to the memory groups of the mainboard end and the expansion end, larger data fragments are allocated to the memory groups of the mainboard end, and smaller data fragments are allocated to the memory groups of the expansion end, thereby achieving access balance between the first memory and the second memory and ensuring consistency in memory read and write performance.
[0108] Figure 5 FIG. 1 is a schematic diagram showing the structure of an electronic device according to an embodiment of the present invention. Figure 5 As shown, the electronic device includes:
[0109] Processor 501, communication interface 502, memory 503 and communication bus 504, wherein the processor 501, communication interface 502, memory 503 communicate with each other via the communication bus 504.
[0110] Memory 503, used for storing computer programs;
[0111] The processor 501 is used to execute the program stored in the memory 503 to achieve:
[0112] Identify performance information of a first memory in a motherboard slot;
[0113] Identifying performance information of a second memory in the expansion slot, the second memory being connected to the first memory based on a cache coherent interconnect protocol;
[0114] grouping the first memory and the second memory according to the performance information of the first memory and the performance information of the second memory;
[0115] According to the grouping conditions of the first memory and the second memory, each group of the first memory and the second memory is accessed in an interleaved manner.
[0116] The communication bus mentioned in the above terminal can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0117] The communication interface is used for communication between the above terminal and other devices.
[0118] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0119] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0120] In another embodiment of the present invention, a computer-readable storage medium is provided. The computer-readable storage medium stores instructions. When the instructions are executed on a computer, the computer executes any of the methods described in the above embodiments.
[0121] In another embodiment of the present invention, a computer program product including instructions is provided. When the computer program product is run on a computer, the computer executes any of the methods described in the above embodiments.
[0122] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from one website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive Solid State Disk (SSD)), etc.
[0123] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0124] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.
Claims
1. A memory access method, characterized in that: include: Identify performance information of a first memory in a motherboard slot; Identifying performance information of a second memory in the expansion slot, the second memory being connected to the first memory based on a cache coherent interconnect protocol; grouping the first memory and the second memory according to the performance information of the first memory and the performance information of the second memory; According to the grouping of the first memory and the grouping of the second memory, interleavingly access each group of the first memory and the second memory; The performance information of the first memory includes: a first number of memory channels currently used by the motherboard slot and a first memory operation rate corresponding to each memory channel; the performance information of the second memory includes: a second number of memory channels currently used by the expansion slot and a second memory operation rate corresponding to each memory channel of the expansion slot; The grouping the first memory and the second memory according to the performance information of the first memory and the performance information of the second memory includes: The product of the first number and the operating speed of the first memory is used as the total operating speed corresponding to the first memory; the product of the second number and the operating speed of the second memory is used as the total operating speed corresponding to the second memory; A total operating rate corresponding to the first memory is equal to a total operating rate corresponding to the second memory as a constraint condition, and the first memory and the second memory are grouped according to the constraint condition.
2. The method according to claim 1, characterized in that The identifying performance information of the second memory in the expansion slot includes: Identify a second number of memory channels currently used by the expansion slot and a maximum operating rate supported by the second memory; The second memory operating speed corresponding to each memory channel of the expansion slot is determined according to the second number and the maximum operating speed, and the second number and the second memory operating speed are used as performance information of the second memory in the expansion slot.
3. The method according to claim 2, characterized in that The determining, according to the second number and the maximum operating rate, a second memory operating rate corresponding to each memory channel of the expansion slot includes: identifying a bandwidth of the expansion slot; Taking the product of the second number and the maximum operating rate as the maximum supported bandwidth, and comparing the bandwidth of the expansion slot with the maximum supported bandwidth; In a case where the bandwidth of the expansion slot is greater than the maximum supported bandwidth, the maximum operating rate is used as a second memory operating rate corresponding to each memory channel of the expansion slot; When the bandwidth of the expansion slot is less than or equal to the maximum supported bandwidth, a quotient of the bandwidth of the expansion slot and the second number is used as a second memory operating rate corresponding to each memory channel of the expansion slot.
4. The method according to claim 1, characterized in that The first memory and the second memory are grouped according to the following formula (1): (1) Wherein, N represents the first number, M represents the second number, p represents the first memory operation rate, and c represents the second memory operation rate; The first memory is divided into i groups, each group has n memory channels; the second memory is divided into j groups, each group has m memory channels; i, j, n, and m are positive integers greater than or equal to 1 respectively.
5. The method according to claim 1, characterized in that The step of interleaving access to each group of the first memory and the second memory according to the grouping condition of the first memory and the grouping condition of the second memory comprises: receiving data to be processed sent by at least one processor; Segmenting the data to be processed to obtain multiple data segments; The plurality of data fragments are sequentially allocated to each group of the first memory and each group of the second memory.
6. The method according to claim 5, characterized in that The step of sequentially allocating the plurality of data fragments to each group of the first memory and each group of the second memory comprises: Writing the plurality of data segments into a preset queuing queue; Allocating the data segments in the queuing queue to the respective groups of the first memory and the respective groups of the second memory in parallel according to the order of the queuing queues; In response to the completion of the allocated data segments by the respective groups of the first memory, the remaining data segments in the queuing queue are allocated to the respective groups of the first memory in parallel; In response to the respective groups in the second memory completing the processing of the allocated data segments, the remaining data segments in the queuing queue are allocated in parallel to the respective groups in the second memory.
7. The method according to claim 5, characterized in that The step of segmenting the data to be processed to obtain a plurality of data segments includes: Determine the number of bytes for the first split; The data to be processed is segmented according to the first segmentation byte number to obtain a plurality of first data segments.
8. The method according to claim 5, characterized in that The step of segmenting the data to be processed to obtain a plurality of data segments includes: Determine a first delay time corresponding to the first memory, and a second delay time corresponding to the second memory; Determine a second segmentation byte number and a third segmentation byte number according to the first delay time and the second delay time, wherein the second segmentation byte number is greater than the third segmentation byte number; Splitting the data to be processed according to the second split byte number and the third split byte number to obtain a plurality of second data segments and a plurality of third data segments; The step of sequentially allocating the plurality of data fragments to each group of the first memory and each group of the second memory comprises: The plurality of second data segments are sequentially allocated to each group of the first memory, and the plurality of third data segments are sequentially allocated to each group of the second memory.
9. The method according to claim 8, characterized in that The step of segmenting the data to be processed according to the second segmentation byte number and the third segmentation byte number to obtain a plurality of second data segments and a plurality of third data segments includes: The data to be processed is segmented according to the second segmentation byte number, the number of groups in the first memory, the third segmentation byte number and the number of groups in the second memory to obtain a plurality of second data segments and a plurality of third data segments.
10. The method according to claim 1, characterized in that After grouping the first memory and the second memory, the method further includes: Allocating continuous address space to each group of the first memory according to the slot code of the mainboard slot; Allocate continuous address space to each group of the second memory according to the slot code of the expansion slot.
11. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 10 are implemented.
12. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, for implementing the steps of the method according to any one of claims 1 to 10 when executing a program stored in a memory.
13. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 10 are implemented.
