(19)
(11)EP 3 486 767 B1

(12)EUROPEAN PATENT SPECIFICATION

(45)Mention of the grant of the patent:
22.07.2020 Bulletin 2020/30

(21)Application number: 18208395.6

(22)Date of filing:  14.12.2010
(51)International Patent Classification (IPC): 
G06F 8/41(2018.01)
G06F 12/0842(2016.01)
G06F 12/0837(2016.01)
G06F 8/70(2018.01)

(54)

METHOD OF MANAGING A STORAGE AREA OF A MEMORY IN A MULTIPROCESSOR SYSTEM

VERFAHREN ZUR VERWALTUNG EINES SPEICHERBEREICHS EINES SPEICHERS IN EINEM MULTIPROZESSORSYSTEM

PROCÉDÉ DE GESTION D'UNE ZONE DE STOCKAGE D'UNE MÉMOIRE DANS UN SYSTÈME MULTIPROCESSEUR


(84)Designated Contracting States:
AL AT BE BG CH CY CZ DE DK EE ES FI FR GB GR HR HU IE IS IT LI LT LU LV MC MK MT NL NO PL PT RO RS SE SI SK SM TR

(30)Priority: 16.12.2009 JP 2009285586

(43)Date of publication of application:
22.05.2019 Bulletin 2019/21

(62)Application number of the earlier application in accordance with Art. 76 EPC:
10837595.7 / 2508992

(73)Proprietor: Waseda University
Tokyo 169-8050 (JP)

(72)Inventors:
  • KASAHARA, Hironori
    Shinjuku-ku, Tokyo 169-8050 (JP)
  • KIMURA, Keiji
    Shinjuku-ku, Tokyo 169-8050 (JP)
  • MASE, Masayoshi
    Shinjuku-ku, Tokyo 169-8050 (JP)

(74)Representative: Mewburn Ellis LLP 
Aurora Building Counterslip
Bristol BS1 6BX
Bristol BS1 6BX (GB)


(56)References cited: : 
EP-A2- 1 376 348
US-A1- 2003 163 745
US-B1- 7 062 631
US-A- 6 138 216
US-A1- 2009 287 885
  
  • DUBOIS M ET AL: "Synchronization, coherence, and event ordering in multiprocessors", COMPUTER, IEEE COMPUTER SOCIETY, USA, vol. 21, no. 2, 1 February 1988 (1988-02-01), pages 9-21, XP011477952, ISSN: 0018-9162, DOI: 10.1109/2.15
  
Note: Within nine months from the publication of the mention of the grant of the European patent, any person may give notice to the European Patent Office of opposition to the European patent granted. Notice of opposition shall be filed in a written reasoned statement. It shall not be deemed to have been filed until the opposition fee has been paid. (Art. 99(1) European Patent Convention).


Description

BACKGROUND OF THE INVENTION



[0001] This invention relates to a method of managing memory within a multiprocessor formed of a plurality of processing elements, and more particularly, to a method of controlling data stored in a shared memory so as to maintain consistency (coherency) thereof based on information acquired by a compiler.

[0002] Multiprocessors in which a plurality of processing elements are integrated have been released one after another from respective microprocessor manufacturers. In the fields of information home electric appliances and device embedding (such as cellular phones, game machines, car navigation systems, digital television receivers, HDD/DVD recorders/players), as well as in the fields of super computers, servers, desktop computers, and PC servers, there is a trend toward employment of multi-core microprocessors.

[0003] The multiprocessor includes a plurality of processing elements, an inter-connection network, and a centralized shared memory, and each of the processing elements includes a processor and a cache memory and independently performs arithmetic processing. The thus-configured multiprocessor uses the centralized shared memory as a main memory, and the plurality of processing elements are used as main memory sharing processors that access the same data stored in the centralized shared memory.

[0004] At this time, in order to maintain the coherency among shared data pieces, it is necessary to perform such coherency control that, in a case where a given processor is accessing a shared data piece on the cache memory, another processor is inhibited from loading the same shared data piece from the centralized shared memory to the cache memory for access thereto.

[0005] Herein, the coherency represents that all the processors can access a value stored at an address at which the memory exists as the same value at a given time instant, and refers to control for guaranteeing that contents of the memory accessed by the respective processors are the same within a main memory sharing multiprocessor. Functions for maintaining the coherency include a coherent cache that controls memory access by hardware.

[0006] A first problem to be solved in the coherency control is stale data, and a second problem thereof is false sharing.

[0007] FIG. 22 is an explanatory diagram illustrating the first problem (stale data) in the coherency control.

[0008] First, global variables a, b, and c are declared (2200), variables a=0, b=0, and c=1 are stored in the shared memory (2201).

[0009] After that, in a case where the shared data (a=0, b=0, and c=1) is stored in the cache memory of a given processing element (PE0) (2202) and the same shared data is stored in the cache memory of another processing element (PE1) (2203), when the shared data is updated (a=0→1) by the PE0, the shared data on the cache of the PE1 is old data that has not been updated (a=0) (2205). In this state, when the shared data is updated (c=a) by the PE1, the variable c is updated to 0 without copying a correct value of a (2206).

[0010] Therefore, the variables, which should be a= 1, b=0, and c= 1 if the coherency control has been performed, become a=0, b=0, c=0. Therefore, data stored in the cache memory of the PE0 does not match data stored in the cache memory of the PE1. Therefore, the PE1 causes an erroneous operation.

[0011] FIG. 23 is an explanatory diagram illustrating the second problem (false sharing) in the coherency control.

[0012] First, the global variables a and b are declared (2300), and the variables a=0 and b=0 are stored in the shared memory (2301). The variables a and b are stored on the same cache line of the shared memory. Further, the shared memory is accessed in units of lines.

[0013] After that, the shared data stored in the cache memory of a given processing element (PE0) is updated (a=0→1) (2302), and the shared data stored in the cache memory of the other processing element (PE1) is updated (b=0→2) (2303). In other words, the respective processing elements update the different variables stored on the same line. In this case, when the PE0 first writes back data to the shared memory, data obtained by the PE1 writing back data later is stored in the shared memory (2304). On the other hand, when the PE1 first writes back data to the shared memory, data obtained by the PE0 writing back data later is stored in the shared memory (2305).

[0014] If the coherency control is performed, a= 1 and b=2 are stored in the shared memory, but if the coherency control is not performed, it is not determined which data is finally stored in the shared memory. In other words, the contents of the memory differ depending on a line destaging timing, and the processing element causes an erroneous operation in any case.

[0015] In order to solve such a problem that a mismatch occurs between the shared memory and the cache memory, a coherency control module is provided to the respective processing elements and shared resources (such as the inter-connection network and the shared memory), to thereby maintain the coherency of the data stored in the memory.

[0016] Specifically, until a given processing element (PE0) reads data x from the shared memory, PE0 reads data x from the shared memory, updates the data x, and discards ownership of the data x, the other processing element (PE1) is not permitted to write the data x to the shared memory.

[0017] Through such ownership control, it is possible to solve the problems of the stale data and the false sharing which reside in the coherency control. The following prior art documents use a technique of marking certain memory areas as non-cacheable in order to tackle the problem of shared data inconsistency in a multiprocessor system that may arise when the shared data is cached by different processors, :
DUBOIS M ET AL: "Synchronization, coherence, and event ordering in multiprocessors",COMPUTER, IEEE COMPUTER SOCIETY, USA, vol. 21, no. 2, 1 February 1988; US 6,138,216 A (HARVEY IAN NIGEL [GB]) 24 October 2000; US 2009/287885 A1 (KRIEGEL JON K [US] ET AL) 19 November 2009; US 2003/163745 A1 (KARDACH JAMES P [US]) 28 August 2003; US 7,062,631 B1 (KLAIBER ALEXANDER C [US] ET AL) 13 June 2006; EP 1 376 348 A2 (FUJITSU LTD [JP]) 2 January 2004.

Citation List


Patent Literature



[0018] 

PTL 1 : JP 2004-30362 A

PLT 2 : JP H9-44403 A


SUMMARY OF THE INVENTION



[0019] However, with the coherent cache that controls the ownership of the memory access by using hardware, an increase in the number of processors due to cost of hardware causes an increase in cost of the multiprocessor system. Further, the memory access is controlled by hardware, which results in slow memory access.

[0020] In addition, in coherency control performed by using hardware, signals are sent to all the processors, the memory, and a bus control mechanism for every event, which causes overhead at a time of execution. The overhead increases in accordance with the number of processors included in the multiprocessor system. Therefore, if the number of processors increases, a bus is occupied by communications for the coherency control, which hinders the operation of the processor.

[0021] Therefore, there is a demand for the coherency control performed with a more simple hardware configuration, in particular, the coherency control performed by using software.

[0022] A representative example of the invention disclosed herein is as follows. Specifically, there is provided a method of managing a storage area of a memory when a multiprocessor system executes a program, as set forth in claim 1.

[0023] According to representative embodiments of this invention, it is possible to simplify hardware. Therefore, it is possible to realize a low-cost and low-power-consumption multiprocessor system.

BRIEF DESCRIPTION OF THE DRAWINGS



[0024] 

FIG. 1 is a configuration diagram of a multiprocessor system according to embodiments of this invention.

FIG. 2 is a diagram illustrating a state that can be taken by each line of a cache memory of the multiprocessor system according to the embodiments of this invention.

FIG. 3A is an explanatory diagram illustrating a method of avoiding consumption of stale data according to the embodiments of this invention.

FIG. 3B is an explanatory diagram illustrating the method of avoiding consumption of the stale data according to the embodiments of this invention.

FIG. 4 is an explanatory diagram illustrating an outline of a method of avoiding occurrence of false sharing according to the embodiments of this invention.

FIG. 5A is a explanatory diagram illustrating an example in which the false sharing occurs among elements of an array variable in the case of handling a one-dimensional array.

FIG. 5B is an explanatory diagram illustrating the example in which the false sharing occurs among the elements of the array variable in the case of handling the one-dimensional array.

FIG. 6A is an explanatory diagrams illustrating a method of avoiding occurrence of the false sharing according to a first embodiment of this invention.

FIG. 6B is an explanatory diagrams illustrating the method of avoiding the occurrence of the false sharing according to the first embodiment of this invention.

FIG. 7A is an explanatory diagram illustrating a method of avoiding occurrence of the false sharing according to a second embodiment of this invention.

FIG. 7B is an explanatory diagram illustrating the method of avoiding the occurrence of the false sharing according to the second embodiment of this invention.

FIG. 8A is an explanatory diagram illustrating a method of avoiding occurrence of the false sharing according to a third embodiment of this invention.

FIG. 8B is an explanatory diagram illustrating the method of avoiding the occurrence of the false sharing according to the third embodiment of this invention.

FIG. 8C is an explanatory diagram illustrating an example in which a non-cacheable area is provided to a centralized shared memory according to the third embodiment of this invention.

FIG. 8D is an explanatory diagram illustrating an example in which the non-cacheable area is provided to a distributed shared memory according to the third embodiment of this invention.

FIG. 9A is an explanatory diagram illustrating a modified example of a method of avoiding an occurrence of the false sharing according to the third embodiment of this invention.

FIG. 9B is an explanatory diagram illustrating an example in which the non-cacheable area is provided to a centralized shared memory according to the modified example shown in FIG. 9A.

FIG. 9C is an explanatory diagram illustrating an example in which the non-cacheable area is provided to a distributed shared memory according to the modified example shown in FIG. 9A.

FIG. 10A is an explanatory diagram illustrating another modified example of a method of avoiding the occurrence of the false sharing according to the third embodiment of this invention.

FIG. 10B is an explanatory diagram illustrating the another modified example of the method of avoiding the occurrence of the false sharing according to the third embodiment of this invention.

FIG. 11 is an explanatory diagram illustrating a modified example of a method of avoiding an occurrence of the false sharing according to a fourth embodiment of this invention.

FIG. 12A is an explanatory diagrams illustrating an example in which the false sharing occurs between elements of an array variable in the case of handling the multi-dimensional array.

FIG. 12B is an explanatory diagrams illustrating an example in which the false sharing occurs between the elements of the array variable in the case of handling the multi-dimensional array.

FIG. 13A is an explanatory diagram illustrating an example of applying the first embodiment to a two-dimensional array variable.

FIG. 13B is an explanatory diagram illustrating the example of applying the first embodiment to a two-dimensional array variable.

FIG. 14A is an explanatory diagram illustrating an example of applying the second embodiment to a two-dimensional array variable.

FIG. 14B is an explanatory diagram illustrating the example of applying the second embodiment to the two-dimensional array variable.

FIG. 15A is an explanatory diagram illustrating an example of applying the third embodiment to a two-dimensional array variable.

FIG. 15B is an explanatory diagram illustrating the example of applying the third embodiment to the two-dimensional array variable.

FIG. 16 is an explanatory diagram illustrating an example of applying the fourth embodiment to a two-dimensional array variable.

FIG. 17A is a macro-task graph illustrating processing performed before the loop division according to the embodiments of this invention.

FIG. 17B is a macro-task graph illustrating processing performed after the loop division according to the embodiments of this invention.

FIG. 17C is an explanatory diagram illustrating an example of a code for detecting the false sharing.

FIG. 18 is an explanatory diagram illustrating an outline of processing for generating a software coherency control code performed by a parallelizing compiler according to the embodiments of this invention.

FIG. 19 is a flowchart of processing executed by a compiler according to the embodiments of this invention.

FIG. 20A is a flowchart of the false sharing avoiding processing according to the embodiments of this invention.

FIG. 20B is a flowchart of the false sharing avoiding processing according to the embodiments of this invention.

FIG. 21 is a flowchart of a processing for inserting a cache manipulation instruction according to the embodiments of this invention.

FIG. 22 is an explanatory diagram illustrating a first problem (stale data) in a coherency control.

FIG. 23 is an explanatory diagram illustrating a second problem (false sharing) in the coherency control.


DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS



[0025] FIG. 1 is a configuration diagram of a multiprocessor system according to embodiments of this invention.

[0026] The multiprocessor system according to the embodiments of this invention includes a plurality of processing elements (PE0, PE1, ..., PEn) 100, 110, and 120, an inter-connection network 150, and a centralized shared memory 160.

[0027] The processing element 100 includes a processor 101 for performing arithmetic processing, a cache memory 102 for temporarily storing data, a distributed shared memory (DSM) 103, and a transfer data controller, and operates independently.

[0028] The processor 101 can be any processor capable of an integer arithmetic processing and a floating point arithmetic processing, and the function thereof is not specifically limited. For example, a CPU of the single-issue RISC architecture which is simple in architecture of loading/storing data may be used. Moreover, a superscalar processor, a VLIW processor, and the like may be used.

[0029] The cache memory 102 is a memory for temporarily storing data read by the processor 101 from the centralized shared memory 160. The processor 101 performs the arithmetic processing by using the data stored in the cache memory 102. After the arithmetic processing performed by the processor 101 is finished, the data stored in the cache memory 102 is written back to the centralized shared memory 160. Data is read/written between the cache memory 102 and the centralized shared memory 160 in units of lines. The line is a management unit for the data stored in the cache memory 102.

[0030] It should be noted that the processing element 100 may use the cache memory 102 as a secondary cache and include a primary cache in addition to the cache memory 102. In this case, the primary cache and the secondary cache (cache memory 102) may be subjected to coherency control. In other words, the multiprocessor according to the embodiments of this invention does not include a coherency function of maintaining equality of data between the centralized shared memory 160 functioning as a main memory and the cache memory 102 provided on an outermost side.

[0031] The distributed shared memory 103 is a memory capable of reading/writing the stored data directly from another processing element. It should be noted that, if the distributed shared memory 103 is formed of a dual port memory, the distributed shared memory 103 can be accessed without a conflict between the processor 101 and the transfer data controller. It should be noted that the distributed shared memory 103 is not a component essential to the multiprocessor according to this embodiment.

[0032] The transfer data controller transfers the data stored in the memory included in the processing element between the processing elements.

[0033] Further, in addition to the components illustrated in the figure, the processing element 100 may include a local program memory, a local data memory, a network interface, and a power control register.

[0034] It should be noted that the processing elements 110 and 120 also include the same components as those of the processing element 100.

[0035] The inter-connection network 150 is realized by an existing coupling technology (such as a crossbar switch, a bus, or a multistage network), and couples the plurality of processing elements 100 and the like and the centralized shared memory 160 to each other.

[0036] The centralized shared memory 160 (CSM) functions as the main memory that stores data shared by all the processing elements 100 and the like across a system, and is a memory capable of being accessed from the respective processing elements 100 and the like.

[0037] It should be noted that the multiprocessor according to this embodiment does not include the coherency function by hardware for maintaining the equality of the data between the cache memory 102 and the like and the centralized shared memory 160.

(Solution to stale data)



[0038] First, a description is made of a method of avoiding occurrence of stale data being the first problem.

[0039] As described above, the multiprocessor according to the embodiments of this invention does not include the coherency function by hardware for maintaining the equality of the data between the cache memory 102 and the like and the centralized shared memory 160. Therefore, if a given processing element updates the data on a cache memory, the other processing element is not notified of the data update. Further, the updated data is not even copied to the centralized shared memory 160 until the updated data is written back.

[0040] Therefore, a compiler according to the embodiments of this invention generates an explicit cache manipulation code by software based on results (data control flow and data dependence relationship) of analyzing a program.

[0041] The cache manipulation code to be generated is only a command for manipulating the data stored in the cache memory of the processing element that executes the command, and is not a command for manipulating a state of the data stored in the cache memory of the other processing element such as a cache manipulation request in a coherency protocol by hardware. The cache manipulation code to be generated includes three kinds of commands including writeback, self-invalidate, and purge.

[0042] The writeback is a command for writing back the data stored in the cache memory 102 to the centralized shared memory 160. When the data is updated on the cache memory 102 to become different from the data stored in the centralized shared memory 160 at an address corresponding thereto, the state of the line becomes dirty, and the data stored in the cache memory 102 needs to be written back to the centralized shared memory 160.

[0043] It should be noted that the data is written back to the centralized shared memory 160 also by the writing back of the data accompanied by line replacement of the cache memory 102 (auto-writeback).

[0044] The self-invalidate is a command for invalidating the line of the cache memory 102. Even if being stored in the cache memory, the data invalidated by the self-invalidate cannot be used until the reading from the centralized shared memory 160 again.

[0045] The purge is a command for executing the self-invalidate after the writing back (writeback) of the data stored in the line of the cache memory 102.

[0046] Further, the cache manipulation code is inserted in a portion in which communications occur between tasks executed by the respective processing elements.

[0047] In addition, in a case where different processing elements retain the data on the same line, the compiler controls the data on the same line stored in the different processing elements so as not to be simultaneously updated.

[0048] FIG. 2 is a diagram illustrating a state that can be taken by each line of the cache memory 102 of the multiprocessor according to the embodiments of this invention.

[0049] The cache memory 102 takes four states of "Modified", "Valid", "Stale", and "Invalid" for each line.

[0050] "Modified" indicates dirty data obtained by updating the data stored in the cache memory 102, and represents a state of being different from the data stored in the centralized shared memory 160 at the corresponding address. In this case, the data stored in the cache memory 102 needs to be written back to the centralized shared memory 160 by the writeback.

[0051] "Valid" represents a clean state in which the data stored in the cache memory 102 matches the data stored in the centralized shared memory 160 at the corresponding address.

[0052] "Stale" represents a clean state in which data to be synchronized with the data stored in the cache memory 102 has been rewritten by the other processing element, but the updated data has not been written back to the centralized shared memory 160 yet, and hence the cache data matches the data stored in the centralized shared memory 160 at the corresponding address.

[0053] "Invalid" represents a state of being data that may not match the data stored in the cache memory 102.

[0054] The above-mentioned four states are controlled to transition by access to the cache memory 102 and cache manipulation.

[0055] The access to the cache memory 102 includes reading (read) of data from the centralized shared memory 160 which is performed by the processor 101 and writing (write) of data to the cache memory 102 which is performed by the processor 101.

[0056] The compiler according to the embodiments of this invention controls the data on the same line stored in the cache memories of the plurality of processing elements so that the data does not simultaneously take the "Modified" state. Further, the compiler according to this embodiment controls the "Stale" data so as not to be read/written.

[0057] FIGS. 3A and 3B are explanatory diagrams illustrating a method of avoiding consumption of the stale data according to the embodiments of this invention.

[0058] In a case where data dependence exists across the processing elements, the compiler according to the embodiments of this invention synchronizes the data at an edge of the data dependence. For example, the edge of the data dependence to be detected by the compiler as a result of analyzing the program is a def-use relationship caused by flow dependence.

[0059] For example, in a case where, as illustrated in FIG. 3A, the PE0 defines a variable A in a task block 1 (SB1) (300) and then the PE1 uses the variable A in a task block 3 (SB3), as illustrated in FIG. 3B, the PE1 changes the state of the line that stores the variable A to "Invalidate" in accordance with the updating of the variable A performed by the PE0 (302). Further, after the PE0 writes back the variable A to a centralized shared memory (301), the PE1 uses the variable A.

[0060] More specifically, before the other processing element (PE1) uses the variable A updated by the PE0, the compiler inserts a writeback command (301). In this case, next time the own processing element (PE0) uses the variable A, the writeback command is not inserted, and the writeback command may be inserted before the other processing element (PE1) uses the variable A.

[0061] In addition, for data synchronization between the processing elements using a flag variable, the compiler inserts a command (302) to write a value indicating synchronization to a synchronization flag variable (sync_flg) on a send side (PE0) of the synchronization, and inserts a command (303) to write back the line of the cache memory that stores the synchronization flag variable to the centralized shared memory.

[0062] On the other hand, with regard to the PE1, the compiler inserts a self-invalidate command (304) before using the variable A updated by the other processing element (PE0). It should be noted that it is desired that the portion in which the self-invalidate command (304) is inserted (timing for self-invalidation) be immediately before the variable A is used.

[0063] In addition, the compiler repeatedly invalidates and reads the synchronization flag variable (sync_flg), and inserts a command (305) to stand by in a busy wait state until the value of the synchronization flag variable is updated to the value indicating the synchronization.

[0064] The PE1 has the variable A invalidated and cannot use the variable A on the cache memory. Therefore, the PE1 loads the variable A from the centralized shared memory 160 to the cache memory, and acquires the variable A updated by the PE0.

[0065] The def-use relationship is described above, but a def-def relationship exhibited by output dependence, a use-def relationship based on reverse dependence, and a use-use relationship based on input dependence can cause the same situations.

[0066] In this manner, the compiler according to the embodiments inserts a cache manipulation command in accordance with the result of analyzing the flow dependence and the output dependence between the tasks, and hence the stale data is not consumed without performing the coherency control.

(Solution to false sharing)



[0067] Next, a description is made of a method of avoiding occurrence of false sharing being the second problem.

[0068] FIG. 4 is an explanatory diagram illustrating an outline of a method of avoiding occurrence of the false sharing according to the embodiments of this invention.

[0069] In this embodiment, in order to prevent the variables used by the respective processing elements from falling on the same cache line, alignment for placing the respective variables at heads of the cache lines is performed. It should be noted that the alignment of the variables may be designated by declaration of an array variable, or may be separately described in a setting file or the like.

[0070] First, in the same manner as described above with reference to FIG. 23, global variables a and b are declared (400), and the variables a=0 and b=0 are stored in the centralized shared memory 160. However, in the embodiments of this invention, unlike the manner described above with reference to FIG. 23, the declared global variables a and b are placed at the heads of the cache lines of the centralized shared memory 160, thereby being stored on the different lines.

[0071] After that, shared data on the cache of a given processing element (PE0) is updated (a=0→1) (401), and shared data on the cache of the other processing element (PE1) is updated (b=0→2) (402). However, the respective processing elements update the different variables stored on the different lines, and hence even when the respective processing elements write back the data stored in the cache memory to the centralized shared memory 160 at any time (404 and 405), correct data pieces (a=1 and b=2) are stored in the centralized shared memory 160.

[0072] Next, a description is made of a case of handling a one-dimensional array.

[0073] FIGS. 5A and 5B are explanatory diagrams illustrating an example in which the false sharing occurs among the elements of the array variable in the case of handling the one-dimensional array.

[0074] First, as illustrated in FIG. 5B, the global variable a is declared, and the variable a is placed at the head of the line of the centralized shared memory (head of the line of the cache memory) (500). The embodiments are directed to a case where four variables can be stored in one 16-byte line of the cache memory. Therefore, as illustrated in FIG. 5A, a[0] to a[3] are stored in a first line 511 of the cache memory, a[4] to a[7] are stored in a second line 512, and a[16] to a[19] are stored in a fifth line 515.

[0075] After that, the processing element (PE0) 100 processes the variable a[i] (0≤i<18) on the cache memory 102 (501), the processing element (PE1) 110 processes the variable a[i] (18≤i<36) on a cache memory 112 (502), and the PE0 and the PE1 write back the results of the processing from the cache memories 102 and 112 to the centralized shared memory 160.

[0076] The writing back of the data from the cache memories 102 and 112 to the centralized shared memory 160 is performed in the units of lines. From the fact that a[16] and a[17] processed by the PE0 and a[18] and a[19] processed by the PE1 exist on the fifth line 515, a conflict occurs between the access by the PE0 and the access by the PE1 on the line, with the result that the false sharing occurs.

[0077] FIGS. 6A and 6B are explanatory diagrams illustrating a method of avoiding the occurrence of the false sharing according to a first embodiment of this invention.

[0078] In the method of the first embodiment, as illustrated in FIG. 6A, the respective elements of the global variable a are placed at the heads of the lines of the centralized shared memory (heads of the lines of the cache memory), and hence the respective elements are placed on the different lines. Therefore, the processing is divided by a boundary between the cache lines.

[0079] First, as illustrated in FIG. 6B, the global variable a is declared, and the respective thirty-six elements of the array variable included in the variable a are placed at the heads of the lines of the centralized shared memory (heads of the lines of the cache memory) (600).

[0080] After that, the processing element (PE0) 100 processes the variable a[i] (0≤i<18) (601), the processing element (PE1) 110 processes the variable a[i] (18≤i<36) (602), and the PE0 and the PE1 write back the results of the processing to the centralized shared memory 160. However, unlike the case described above with reference to FIG. 5A, as illustrated in FIG. 6B, the PE0 and the PE1 do not access the same line of the centralized shared memory 160. Therefore, the plurality of processing elements do not write back the data to the same line, and hence the false sharing does not occur.

[0081] It should be noted that, in this embodiment, only one variable is stored in one line having a capacity that can store four variables, which reduces use efficiency of the cache memory. Therefore, this embodiment is effective in a case where the number of elements of the array variable is small. Further, this embodiment is effective in a case where the same processing element performs indirect memory access such as accessing elements of different subscripts of the array variable (a(i) and a(i+1)).

[0082] FIGS. 7A and 7B are explanatory diagrams illustrating a method of avoiding the occurrence of the false sharing according to a second embodiment of this invention.

[0083] As described above with reference to FIG. 5A, the false sharing occurs when the data processed by the different processing elements is stored on one line of the cache memory. Therefore, in this embodiment, as illustrated in FIG. 7A, the data processed by the respective processing elements is divided by the boundary of the line of the cache memory so as to avoid the data processed by the plurality of processing elements from being stored on one line of the cache memory.

[0084] First, as illustrated in FIG. 7B, the global variable a is declared, and the variable a is placed at the head of the line of the centralized shared memory (head of the line of the cache memory) (700).

[0085] After that, the processing element (PE0) 100 processes the variable a[i] (0≤i<16) (701), and the processing element (PE1) 110 processes the variable a[i] (16≤i<36) (702). After that, the PE0 writes back the result of the processing from the cache memory 102 to the centralized shared memory 160, and the PE1 writes back the result of the processing from the cache memory 112 to the centralized shared memory 160.

[0086] In this embodiment, one line has the capacity that can store four variables, and hence the respective processing elements are configured to process the elements of the array variable, the number of which is a multiple of four being a cache line size. Therefore, as illustrated in FIG. 7A, an access range of the PE0 and an access range of the PE1 are divided by the boundary of the line of the cache memory, and the PE0 and the PE1 do not access the same line of the cache memory. Therefore, the plurality of processing elements do not write back the data to the same line, and hence the false sharing does not occur.

[0087] It should be noted that, in this embodiment, the processing using sixteen and twenty elements of the array variable is allocated to the PE0 and the PE1, respectively, but the processing using twenty and sixteen elements of the array variable may be allocated to the PE0 and the PE1, respectively, as long as the elements are divided into a multiple of the cache line size (number of elements of the array variable that can be stored on one line). Further, the processing using the elements of the array variable, the number of which is based on a ratio of processing performance of the respective processing elements, may be allocated.

[0088] It should be noted that, in this embodiment, the numbers of elements of the array variable allocated to the respective processing elements may not be equal to each other depending on the cache line size, the number of elements of the array variable, and the number of processing elements, and an imbalance may occur in processing load on the processing element. Therefore, this embodiment is effective in a case where an array size is sufficiently large and the imbalance is small enough to be ignored compared to the array size.

[0089] FIGS. 8A and 8B are explanatory diagrams illustrating a method of avoiding the occurrence of the false sharing according to a third embodiment of this invention.

[0090] In the third embodiment, a non-cacheable area is used in the boundary of the processing, to thereby avoid the occurrence of the false sharing.

[0091] First, as illustrated in FIG. 8B, the global variable a and a variable ncbuf are declared, the variable a is placed at the head of the line of the centralized shared memory (head of the line of the cache memory), and the variable ncbuf having a size of four elements of the array variable is provided to the non-cacheable area (800).

[0092] The non-cacheable area represents an area that is used, when the processing element reads the data stored in the area from the memory, without having the read data loaded in the cache memories of the respective processing elements. The non-cacheable area is distinguished from a normal cacheable area by designating an area (address) of the memory or a specific variable as being non-cacheable. The designation of being non-cacheable may be previously defined by a predetermined setting file, or may be defined by a command that declares the variable.

[0093] After that, the processing element (PE0) 100 processes the variable a[i] (0≤i<18) on the cache memory (801), the processing element (PE1) 110 processes the variable a[i] (18, 19) on the non-cacheable area by using ncbuf[i] (i=2, 3) (802), and the PE1 processes the variable a[i] (20≤i<36) on the cache memory (803).

[0094] After that or in parallel with the processing 803, the PE0 reads the variable ncbuf[i] (i=2, 3) processed by the PE1 from the non-cacheable area, and writes the variable ncbuf[i] (i=2, 3) to the variable a[i] (i=18, 19) of the cache memory of the PE0 (804). By the above-mentioned data dependence, the variable a[i] (i=18, 19) processed by the PE1 is transferred to the PE0.

[0095] After that, the PE0 writes back the variable a[i] (0≤i<20) to the centralized shared memory 160, and the PE1 writes back the variable a[i] (20≤i<36) to the centralized shared memory 160.

[0096] In this manner, in the third embodiment, as illustrated in FIG. 8A, the result of an arithmetic processing performed by the PE1 using a non-cacheable buffer is copied to the variable of the cache memory of the PE0. In other words, in a case where the plurality of processing elements access the data on the same line, one processing element (PE1) stores the data on the line in the non-cacheable area provided within the memory, such as the centralized shared memory or the distributed shared memory, while the other processing element (PE0) stores the data within the non-cacheable area in the centralized shared memory, and hence the plurality of processing elements do not write back the data to the same line. Therefore, the false sharing does not occur.

[0097] It should be noted that the data stored in the lines 811 to 814 is used only by the PE0, while the data stored in the lines 816 to 819 is used only by the PE1, and hence the lines 811 to 814 and the lines 816 to 819 may be localized on the cache memory. The localized data is retained on the cache memory before being used next by the PE0 or PE1 without being written back to the main memory. In the same manner, the data to be stored in the lines 811 to 814 and the data to be stored in the lines 816 to 819 may be stored in the local memory.

[0098] In other words, it suffices that only a fifth line 815 exists on the cache memory (cacheable area), and the other areas (lines 811 to 814 and lines 816 to 819) may not exist on the cacheable area.

[0099] It should be noted that, in this embodiment, the non-cacheable area needs to be provided on the memory, but the non-cacheable area may be provided on any one of the centralized shared memory, the distributed shared memory, and the like. Further, in this embodiment, the processing for copying the data from the non-cacheable area to the cache memory causes overhead. However, through use of the distributed shared memory as the non-cacheable buffer, data transfer can be realized with low overhead.

[0100] The method according to the third embodiment is effective in a case where the division or the expansion of the array cannot be performed by the above-mentioned method according to the second embodiment.

[0101] FIG. 8C illustrates an example in which the non-cacheable area is provided to the centralized shared memory 160 according to the third embodiment of this invention. In the example illustrated in FIG. 8C, a partial area of the centralized shared memory 160 is designated as the non-cacheable area.

[0102] The PE0 processes the variable a[i] (0≤i<18) on the cache memory (801), the processing element (PE1) 110 processes the variable a[i] (i=18, 19) on the non-cacheable area provided to the centralized shared memory 160 by using ncbuf[i] (i=2, 3) (802), and the PE1 processes the variable a[i] (20≤i<36) on the cache memory (803).

[0103] After that, the variable ncbuf[i] (i=2, 3) processed by the PE1 is read from the non-cacheable area of the centralized shared memory 160, and written to the variable a[i] (i=18, 19) of the cache memory of the PE0 (804). With this operation, the variable a[i] (i=18, 19) processed by the PE1 is transferred to the PE0.

[0104] Therefore, even when the PE0 writes back the variable a[i] (0≤i<20) to the centralized shared memory 160 and the PE1 writes back the variable a[i] (20≤i<36) to the centralized shared memory 160, the false sharing does not occur.

[0105] FIG. 8D illustrates an example in which the non-cacheable area is provided to the distributed shared memory 103 according to the third embodiment of this invention. In the example illustrated in FIG. 8D, a partial area of the distributed shared memory 103 is designated as the non-cacheable area.

[0106] The PE0 processes the variable a[i] (0≤i<18) on the cache memory (801), the processing element (PE1) 110 processes the variable a[i] (i=18, 19) on the non-cacheable area provided to the distributed shared memory 103 of the PE0 by using ncbuf[i] (i=2, 3) (802), and the PE1 processes the variable a[i] (20≤i<36) on the cache memory (803).

[0107] After that, the variable ncbuf[i] (i=2, 3) processed by the PE1 is read from the non-cacheable area of the distributed shared memory 103, and written to the variable a[i] (i=18, 19) of the cache memory of the PE0 (804). With this operation, the variable a[i] (i=18, 19) processed by the PE1 is transferred to the PE0.

[0108] Therefore, even when the PE0 writes back the variable a[i] (0≤i<20) to the centralized shared memory 160 and the PE1 writes back the variable a[i] (20≤i<36) to the centralized shared memory 160, the false sharing does not occur.

[0109] FIG. 9A is an explanatory diagram illustrating a modified example of the method of avoiding the occurrence of the false sharing according to the third embodiment of this invention.

[0110] The modified example to be described with reference to FIG. 9A is different from the above-mentioned example in that the respective processing elements perform the arithmetic processing their own memories, and transfer arithmetic processing results thereof to the non-cacheable area, thereby avoiding the occurrence of the false sharing. Therefore, it is possible to reduce access to the other memory, the processing element, or the like, and to speed up the processing.

[0111] First, as illustrated in FIG. 9A, the global variable a, the variable ncbuf, and a variable localbuf_pe1 are declared, and the variable a is placed at the head of the line of the centralized shared memory (head of the line of the cache memory). Further, the variable ncbuf having the size of four elements of the array variable is provided to the non-cacheable area, and the variable localbuf_pe1 having the size of four elements of the array variable is provided to the non-cacheable area (900). It should be noted that the variable Localbuf_pe1 is used only by the processing element (PE1) 110, and may therefore be a local variable.

[0112] After that, the processing element (PE0) 100 processes the variable a[i] (0≤i<18) on the cache memory (901), and the PE1 processes the variable a[i] (18, 19) by using localbuf_pe1[i] (i=2, 3)) (902), and writes the results of the processing (localbuf_pe1[i] (i=2, 3)) to ncbuf[i] (i=2, 3) (903). After that, the PE1 processes the variable a[i] (20≤i<36) on the cache memory (904).

[0113] After that or in parallel with the processing 904, the PE0 reads the variable ncbuf[i] (i=2, 3) processed by the PE1 from the non-cacheable area, and writes the variable ncbuf[i] (i=2, 3) to the variable a[i] (i=18, 19) of the cache memory of the PE0 (905). By the above-mentioned data dependence, the variable a[i] (i=18, 19) processed by the PE1 is transferred to the PE0.

[0114] After that, the PE0 writes back the variable a[i] (0≤i<20) to the centralized shared memory 160, and the PE1 writes back the variable a[i] (20≤i<36) to the centralized shared memory 160.

[0115] FIG. 9B illustrates an example in which the non-cacheable area is provided to the centralized shared memory 160 and an arithmetic processing area (localbuf_pe1) is provided to the memory of the PE1 according to the third embodiment of this invention. The memory of the PE1 to which the arithmetic processing area is provided may be any one of the local memory, the distributed shared memory, and the cache memory.

[0116] The PE0 processes the variable a[i] (0≤i<18) on the cache memory (901), and the PE1 processes the variable a[i] (18, 19) by using localbuf_pe1[i] (i=2, 3) provided on the memory of the PE1 (902), and writes the results of the processing (localbuf_pe1[i] (i=2, 3)) to ncbuf[i] (i=2, 3) on the non-cacheable area provided to the centralized shared memory 160 (903). After that, the PE1 processes the variable a[i] (20≤i<36) on the cache memory (904).

[0117] After that, the variable ncbuf[i] (i=2, 3) processed by the PE1 is read from the non-cacheable area of the centralized shared memory 160, and written to the variable a[i] (i=18, 19) of the cache memory of the PE0 (905). With this operation, the variable a[i] (i=18, 19) processed by the PE1 is transferred to the PE0.

[0118] Therefore, even when the PE0 writes back the variable a[i] (0≤i<20) to the centralized shared memory 160 and the PE1 writes back the variable a[i] (20≤i<36) to the centralized shared memory 160, the false sharing does not occur.

[0119] FIG. 9C illustrates an example in which the non-cacheable area is provided to the distributed shared memory 103 and the arithmetic processing area (localbuf_pe1) is provided to the memory of the PE1 according to the third embodiment of this invention. In the example of FIG. 9C, a partial area of the distributed shared memory 103 is designated as the non-cacheable area. Further, the memory of the PE1 to which the arithmetic processing area is provided may be any one of the local memory, the distributed shared memory, and the cache memory.

[0120] The PE0 processes the variable a[i] (0≤i<18) on the cache memory (901), and the PE1 processes the variable a[i] (18, 19) by using localbuf_pe1[i] (i=2, 3) provided on the memory of the PE1 (902), and writes the results of the processing (localbuf_pe1[i] (i=2, 3)) to ncbuf[i] (i=2, 3) on the non-cacheable area provided to the distributed shared memory 103 of the PE0 (903). After that, the PE1 processes the variable a[i] (20≤i<36) on the cache memory (904).

[0121] After that, the variable ncbuf[i] (i=2, 3) processed by the PE1 is read from the non-cacheable area of the distributed shared memory 103, and written to the variable a[i] (i=18, 19) of the cache memory of the PE0 (905). With this operation, the variable a[i] (i=18, 19) processed by the PE1 is transferred to the PE0.

[0122] Therefore, even when the PE0 writes back the variable a[i] (0≤i<20) to the centralized shared memory 160 and the PE1 writes back the variable a[i] (20≤i<36) to the centralized shared memory 160, the false sharing does not occur.

[0123] According to the modified example described with reference to FIGS. 9A to 9C, the variable in a boundary portion is subjected to the arithmetic processing in the memory on the own processing element, and hence it is possible to reduce the transfer of the data to the other processing element or the memory via the bus is reduced, and to speed up the processing.

[0124] FIGS. 10A and 10B are explanatory diagrams illustrating another modified example of the method of avoiding the occurrence of the false sharing according to the third embodiment of this invention.

[0125] First, as illustrated in FIG. 10B, the global variables a, ncbuf_pe0, and ncbuf_pe1 are declared, the variable a is placed at the head of the line of the centralized shared memory (head of the line of the cache memory), and the variable ncbuf_pe0 and the variable ncbuf_pe1 each having the size of four elements of the array variable are provided to the non-cacheable area (1000). The variable ncbuf_pe0 is placed in the distributed shared memory of the PE0, and the variable ncbuf_pe1 is placed in the distributed shared memory of the PE1.

[0126] In this embodiment, the processing element (PE0) 100 processes the variable a with i=0 to i=17, and the processing element (PE1) 110 processes the variable a with i=18 to i=35.

[0127] Specifically, the processing element (PE0) 100 processes the variable a[i] (0≤i<16) on the cache memory (1001). Further, the PE0 processes the variable a[i] (i=16, 17) in ncbuf_pe0 on the distributed shared memory, and writes the results of the processing to ncbuf_pe1 in the distributed shared memory of the PE1 (1002).

[0128] In parallel therewith or before or after that, the processing element (PE1) 110 processes the variable a[i] (i=18, 19) in ncbuf_pe1 on the distributed shared memory, and writes the results of the processing to ncbuf_pe0 in the distributed shared memory of the PE0 (1004). Further, the PE1 processes the variable a[i] (20≤i<36) on the cache memory (1005).

[0129] Further, the PE0 reads the variable ncbuf_pe0[i] (0≤i<4) from the non-cacheable area, and writes the variable ncbuf_pe0[i] to the variable a[i] (16≤i<20) in the cache memory of the PE0 (1003). It should be noted that, due to the data dependence from the writing of the results of the processing to ncbuf_pe0 (1004) onto the writing of ncbuf_pe0 to a[i] (1003), the variable a[i] (i=18, 19) processed by the PE1 is stored in ncbuf_pe0[i]. Therefore, in Step 1003, the variable a[i] (i=16, 17) processed by the PE0 and the variable a[i] (i=18, 19) processed by the PE1 are written to the cache memory of the PE0.

[0130] After that, the PE0 and the PE1 write back the results of the processing to the centralized shared memory 160. However, unlike the case described above with reference to FIG. 5A, the same data is stored in the variable a[i] (16≤i<20) in a boundary area between the PE0 and the PE1, and hence the data stored in the centralized shared memory 160 is not changed no matter which processing element writes back the data.

[0131] In other words, in the third embodiment, the respective processing elements use the data on the distributed shared memory to perform calculation on the boundary portion between the area of the centralized shared memory accessed by the PE0 and the area of the centralized shared memory accessed by the PE1.

[0132] It should be noted that ncbuf_pe0 of the PE0 and ncbuf_pe1 of the PE1 are written of each other, and hence the same value is stored therein. Therefore, when the PE0 writes the variable ncbuf_pe0 to the centralized shared memory, i=2, 3 of the variable ncbuf_pe1 is also written to the centralized shared memory, and by having any one of ncbuf_pe0 and ncbuf_pe1 written to the centralized shared memory, the other one of the data pieces is also written to the centralized shared memory.

[0133] In this manner, in the third embodiment, as illustrated in FIG. 10A, in the case where the plurality of processing elements access the data on the same line, the data on the line is stored in the non-cacheable areas provided within the distributed shared memories of both the processing elements, and by copying the data pieces within both the non-cacheable areas, the data pieces within both the non-cacheable areas match. Therefore, no matter which data is written back, the false sharing does not occur.

[0134] It should be noted that, in this embodiment, the non-cacheable area needs to be provided on the distributed shared memory, the processing for copying data between the distributed shared memories causes the overhead.

[0135] FIG. 11 is an explanatory diagram illustrating a modified example of the method of avoiding the occurrence of the false sharing according to a fourth embodiment of this invention.

[0136] In the fourth embodiment, the local variable is used, to thereby avoid the occurrence of the false sharing.

[0137] First, as illustrated in FIG. 11, the global variable a is declared, and the variable a is placed at the head of the line of the centralized shared memory (head of the line of the cache memory) (1100).

[0138] After that, the processing element 0 (PE0) 100 declares the local variable local_a (1101), processes the variable a[i] (0≤i<18) in the local variable (1102), and writes the local variable local_a[i] (0≤i<18) to the global variable a[i] (0≤i<18) (1103).

[0139] In parallel therewith or before or after that, the processing element 1 (PE1) 110 declares the local variable local_a (1104), processes the variable a[i] (18≤i<36) in the local variable (1105), and writes the local variable local_a[i] (18≤i<36) with i=18 to i=35 to the global variable a[i] (18≤i<36) (1106).

[0140] In Step 1006, the data dependence from Step 1103 is set, and hence before local_a[i] is written to a[i] in Step 1106, a[i] (i=16, 17) is loaded from the centralized shared memory 160. Therefore, in Step 1106, a[16] and a[17] updated by the PE0 are written back to the centralized shared memory along with a[18] and a[19].

[0141] In this manner, in the fourth embodiment, as illustrated in FIG. 11, the plurality of processing elements use the local variable to update the data, and the respective processing elements write back the local variable to a global variable. Therefore, in the fourth embodiment, the false sharing does not occur.

[0142] It should be noted that, in this embodiment, the processing for copying data between the processing elements causes the overhead.

[0143] Next, a description is made of a case of handling a multi-dimensional array.

[0144] FIGS. 12A and 12B are explanatory diagrams illustrating an example in which the false sharing occurs between the elements of the array variable in the case of handling the multi-dimensional array.

[0145] First, as illustrated in FIG. 12B, the global variable a of a 6×6 two-dimensional array is declared, and the variable a is placed at the head of the line of the centralized shared memory (head of the line of the cache memory) (1200). Four variables can be stored in one line of the cache memory. Therefore, as illustrated in FIG. 12A, a[0][0] to a[0][3] exist in a first line 1211 of the cache memory, a[0][4] to a[1][1] exist in a second line 1212, and a[2][4], a[2][5], a[3][0], and a[3][1] exist in a fifth line 1215.

[0146] After that, the processing element (PE0) 100 processes the variable a[i][j]] (0≤i<3, 0≤j<6) on the cache memory 102 (1201), the processing element (PE1) 110 processes the variable a[i][j]] (3≤i<6, 0≤j<6) on the cache memory 112 (1202), and the PE0 and the PE1 write back the results of the processing from the cache memories 102 and 112 to the centralized shared memory 160.

[0147] The writing back of the data from the cache memories 102 and 112 to the centralized shared memory 160 is performed in the units of lines. Further, as described above, if a loop can be divided by the boundary of the cache line, the false sharing does not occur. However, from the fact that a[2][4] and a[2][5] processed by the PE0 and a[3][0] and a[3][1] processed by the PE1 exist on the fifth line 1215, a conflict occurs between the access by the PE0 and the access by the PE1 on the line, with the result that the false sharing occurs.

[0148] FIGS. 13A and 13B are explanatory diagrams illustrating an example of applying the first embodiment to a two-dimensional array variable.

[0149] In the first embodiment, in order to divide the loop by the boundary of the cache line, the respective elements of the array variable are placed in different lines for each parameter of an outer loop.

[0150] First, as illustrated in FIG. 13B, the global variable a of a 6×10 two-dimensional array is declared, and the variable a is placed at the head of the line of the centralized shared memory (head of the line of the cache memory) (1300). The respective variables a[i][j] of the arrays are placed in different lines for each parameter of the outer loop.

[0151] In this embodiment, four variables can be stored in one line of the cache memory, and the necessary variable is the 6×6 array. Therefore, extra variables, the number of which is a line size (four), are provided, and the 6×10 array variable are defined.

[0152] It should be noted that the extra variables, the number of which is (the line size)-1, only needs to be provided.

[0153] In addition, to be generalized, the smallest value of the number of extra array variables is given by the smallest value of S obtained when the following expression is equal to or larger than zero.

S: line size

jmax: number (6) of second outer loops of the array variable



[0154] After that, the processing element (PE0) 100 processes the variable a[i][j] (0≤i<3, 0≤j<6) on the cache memory 102 (1301), the processing element (PE1) 110 processes the variable a[i][j] (3≤i<6, 0≤j<6) on the cache memory 112 (1302), and the PE0 and the PE1 write back the results of the processing from the cache memories 102 and 112 to the centralized shared memory 160.

[0155] The writing back of the data from the cache memories 102 and 112 to the centralized shared memory 160 is performed in the units of lines. However, unlike the case described above with reference to FIGS. 12, as illustrated in FIG. 13B, the PE0 and the PE1 do not access the same line of the cache memory. Therefore, the plurality of processing elements do not write back the data to the same line, and the false sharing does not occur.

[0156] It should be noted that, in this embodiment, the extra variables are reserved, which deteriorates the use efficiency of the cache memory. Therefore, this embodiment is effective in the case where the number of elements of the array variable is small.

[0157] FIGS. 14A and 14B are explanatory diagrams illustrating an example of applying the second embodiment to a two-dimensional array variable.

[0158] In the second embodiment, the respective processing elements divide the data to be processed by a delimiter of the line of the cache memory, and prevent the data processed by the plurality of processing elements from being stored on one line of the cache memory.

[0159] First, as illustrated in FIG. 14B, the global variable a of a 6×6 two-dimensional array is declared, and the variable a is placed at the head of the line of the centralized shared memory (head of the line of the cache memory) (1400).

[0160] After that, the processing element (PE0) 100 processes the variable a[i][j] (0≤i<4, 0≤j<6) on the cache memory 102 (1401), and the processing element (PE1) 110 processes the variable a[i][j] (4≤i<6, 0≤j<6) on the cache memory 112 (1402). After that, the PE0 writes back the results of the processing from the cache memory 102 to the centralized shared memory 160, and the PE1 writes back the results of the processing from the cache memory 112 to the centralized shared memory 160.

[0161] In this embodiment, as illustrated in FIG. 14A, one line has the capacity that can store four variables, but a[3][5] and a[4][0] exist on the different lines. Therefore, the plurality of processing elements do not write back the data to the same line, and the false sharing does not occur.

[0162] It should be noted that, in this embodiment, the processing using twenty-four and twelve elements of the array variable is allocated to the PE0 and the PE1, respectively, but the processing using twelve and twenty-four elements of the array variable may be allocated to the PE0 and the PE1, respectively, as long as the elements are divided into a multiple of the cache line size. Further, the processing using the elements of the array variable, the number of which is based on the ratio of processing performance of the respective processing elements, may be allocated.

[0163] It should be noted that, in this embodiment, loop division is possible if the size of the elements of the array variable being equal to or smaller than the subject dimension becomes a multiple of the line size. In this case, the allocated numbers of elements of the array variable may not be equal to each other depending on the number of elements of the array variable and the number of the processing elements, and an imbalance may occur in the processing load on the processing element. Therefore, this embodiment is effective in the case where the array size is sufficiently large and the imbalance is small enough to be ignored compared to the array size.

[0164] FIGS. 15A and 15B are explanatory diagrams illustrating an example of applying the third embodiment to a two-dimensional array variable.

[0165] In the third embodiment, the non-cacheable area is used to avoid the occurrence of the false sharing.

[0166] First, as illustrated in FIG. 15B, the global variable a of a 6×6 two-dimensional array is declared, and the variable a is placed at the head of the line of the centralized shared memory (head of the line of the cache memory). Further, a 1×6 one-dimensional array variable nc_buf2 is declared, and the non-cacheable area in which the variable nc_buf2 has a size of six variables (number of inner loops) is provided (1500).

[0167] After that, the processing element (PE0) 100 processes the variable a[i][j] (0≤i<3, 0≤j<6) on the cache memory (1501), the processing element (PE1) 110 processes the variable a[3][j] (0≤j<6) on the non-cacheable area by using nc_buf2[0][j] (0≤j<6) (1502), and the PE1 processes the variable a[i][j] (4≤i<6, 0≤j<6) on the cache memory (1503).

[0168] After that or in parallel with the processing 1503, the PE0 reads the variable nc_buf2[0][j] (0≤j<6) processed by the PE1 from the non-cacheable area, and writes the variable nc_buf2[0][j] (0≤j<6) to the variable a[3][j] (0≤j<6) of the cache memory of the PE0 (1504). With this operation, the variable a[3][j] (0≤j<6) processed by the PE1 by using nc_buf2[0][j] (0≤j<6) is transferred to the PE0.

[0169] After that, the PE0 writes back the variable a[i][j] (0≤i<4, 0≤j<6) to the centralized shared memory 160, and the PE1 writes back the variable a[i][j] (4≤i<6, 0≤j<6) to the centralized shared memory 160.

[0170] In this manner, in the third embodiment, as illustrated in FIG. 15A, the result of the arithmetic processing performed by the PE1 using the non-cacheable buffer is copied to the variable of the cache memory of the PE0. In other words, in the case where the plurality of processing elements access the data on the same line, one processing element (PE1) stores the data on the line in the non-cacheable area, while the other processing element (PE0) stores the data within the non-cacheable area in the cacheable area of the centralized shared memory, and hence the plurality of processing elements do not write back the data to the same line, and hence the false sharing does not occur.

[0171] It should be noted that, in this embodiment, the non-cacheable area needs to be provided on the memory, but the non-cacheable area may be provided to the memory of any one of the centralized shared memory, the distributed shared memory, and the like. Further, in this embodiment, the processing for copying data from the non-cacheable area to the cache memory causes the overhead. However, through use of the distributed shared memory as the non-cacheable buffer, the data transfer can be realized with low overhead.

[0172] FIG. 16 is an explanatory diagram illustrating an example of applying the fourth embodiment to a two-dimensional array variable.

[0173] First, as illustrated in FIG. 16, the global variable a of a 6×6 two-dimensional array is declared, and the variable a is placed at the head of the line of the centralized shared memory (head of the line of the cache memory) (1600).

[0174] After that, the processing element 0 (PE0) 100 declares the local variable local_a of the 6×6 two-dimensional array (1601), processes the variable a[i][j] (0≤i<3, 0≤j<6) by using the local variable local_a[i][j] (1602), and writes the local variable local_a[i][j] (0≤i<3, 0≤j<6) to the global variable a[i][j] (0≤i<3, 0≤j<6) (1603).

[0175] In parallel therewith or before or after that, the processing element 1 (PE1) 110 declares the local variable local_a of the 6x6 two-dimensional array (1604), processes the variable a[i][j] (3≤i<6, 0≤j<6) by using the local variable /oca/_a[i][j] (1605), and writes the local variable local_a[i][j] (3≤i<6, 0≤j<6) to the global variable a[i][j] (3≤i<6, 0≤j<6) (1606).

[0176] In Step 1606, the data dependence from Step 1103 is set, and hence before local_a[i][j] is written to a[i][j] in Step 1006, a[2][4] and a[2][5] are loaded from the centralized shared memory 160. Therefore, in Step 1606, a[2][4] and a[2][5] updated by the PE0 are written back to the centralized shared memory along with a[3][0] and a[3][1].

[0177] In this manner, in the fourth embodiment, as illustrated in FIG. 16, the plurality of processing elements use the local variable to update the data, and the respective processing elements write back the local variable to the global variable. Therefore, in the fourth embodiment, the false sharing does not occur.

[0178] It should be noted that, in this embodiment, the processing for copying data between the processing elements causes the overhead.

[0179] The embodiments and the modified examples that are described above can be used by selecting one therefrom or combining a plurality thereof when the program is compiled.

[0180] Next, a description is made of a procedure for selecting a method optimal for the compiler to avoid the false sharing.

[0181] FIG. 17A is a macro-task graph illustrating processing performed before the loop division according to the embodiments of this invention.

[0182] In the task of Step 1710, which is a loop with the variable i set as a control variable, parallel processing is performed by scheduling partial tasks generated by the loop division to mutually different processing elements. In the respective partial tasks generated in a case of subjecting the tasks to the loop division by a maximum division number, in other words, in a case of subjecting the tasks to the loop division so as to assume processing for one iteration of an i-loop as one partial task, it is analyzed by a data access range analysis that 0 to 99 elements in the first dimension and i to i elements in the second dimension are likely to be changed with regard to a two-dimensional array variable A. In the same manner, it is analyzed that in the task of Step 1720, the 0 to 99 elements in the first dimension and the i to i elements in the second dimension are likely to be used with regard to a two-dimensional array variable B, that in the task of Step 1730, the 0 to 99 elements in the first dimension and the i to i elements in the second dimension are likely to be changed with regard to the two-dimensional array variable B, that in the task of Step 1740, the 0 to 99 elements in the first dimension and the i to i elements in the second dimension are likely to be changed with regard to the two-dimensional array variable B, and that in the task of Step 1740, the 0 to 99 elements in the first dimension and the i to i elements in the second dimension are likely to be changed with regard to the two-dimensional array variable B. Here, the access range in the case of subjecting the respective tasks to the loop division by the maximum division number is taken into consideration in order to analyze whether or not the false sharing is likely to occur in a case where task division is performed by an arbitrary division pattern.

[0183] Analyzed from the access range of data in the respective partial tasks of the respective tasks are a portion that is likely to cause the false sharing, the array variable being a factor thereof, and an array dimension thereof. Specifically, it can be determined that the false sharing is likely to occur in a case where, in a data access range of the above-mentioned partial task, in the lowest dimension among dimensions including a loop control variable in a division source task, a residual occurs when a partial array size of the lowest dimension is divided by the line size of the cache memory. In that case, the false sharing is likely to occur between the respective partial tasks obtained after dividing the task for updating the array or between the respective partial tasks obtained after dividing the task for updating the array and the respective partial tasks obtained after dividing the task that uses the array.

[0184] It should be noted that a method of storing the variable in the memory differs depending on a program language, and hence which subscript to be set as the first dimension differs depending on the method of storing the variable in the memory. In other words, in a case where the subscript changed depending on the element of the array variable stored in a continuous area of the memory and the subscript that forms an innermost loop are different, the compiler may perform an interchange for changing a calculation sequence as necessary.

[0185] Further, in a case where the array variable is not aligned at the head of the line of the centralized shared memory 160, it is analyzed that the false sharing is likely to occur irrespective of the above-mentioned condition.

[0186] FIG. 17B is a macro-task graph illustrating processing performed after the loop division according to the embodiments of this invention. In this example, the division number of the respective tasks is set to three, but the division number can be arbitrarily set.

[0187] In FIG. 17B, the solid line (single line) indicates the data dependence on the program, and the double line indicates a portion that is likely to cause the false sharing.

[0188] It should be noted that FIG. 17C illustrates an example of a code for detecting the false sharing.

[0189] FIG. 18 is an explanatory diagram illustrating an outline of processing for generating a software coherency control code performed by a parallelizing compiler according to the embodiments of this invention.

[0190] First, a program 2001 to be compiled is input to a parallelizing compiler 2002. The input program 2001 is a sequential program described in a language such as C or Fortran.

[0191] The parallelizing compiler 2002 parallelizes the input sequential program, and generates a parallel API program 2003 into which a control code to be executed in a non-coherent cache is inserted. The generated parallel API program 2003 is of a parallel program format including an instruction (API) for executing the program by using the cache memory that does not have the coherency function.

[0192] The generated parallel API program 2003 is input to a code generation compiler 2004. The code generation compiler 2004 converts the program into a machine language command (execute form program) 2005 while interpreting the instruction (API) for executing the program by using the cache memory that does not have the coherency function. The execute form program 2005 also includes the command for executing the program in the non-coherent cache.

[0193] FIG. 19 is a flowchart of processing executed by the compiler according to the embodiments of this invention.

[0194] First, the compiler subjects the program to be compiled to a lexical analysis, and analyzes a syntax of the program (2101).

[0195] Based on a result of analyzing the syntax, a hierarchical task, in other words, an expression using a hierarchical macro-task of the program is generated (2102).

[0196] After that, a dependence relationship (control flow) between the generated tasks is analyzed (2103), the data dependence between the tasks is analyzed (2104), and a range of data accessed by each task is analyzed (2105).

[0197] After that, an analysis result of the program is used to analyze conditions on which the program can be executed at the fastest speed (2106), and an analysis result of a fastest executable condition is used to determine a parallel processing segment and the number of processors to which the tasks are to be assigned and generate the macro-task graph.

[0198] After that, from the data dependence relationship within the macro-task graph, the false sharing is detected by the method which has been described referring to FIGS. 17A, 17B, and 17C, and the false sharing information including the portion in which the false sharing has been detected and the variable in which the false sharing has been detected is generated (2107).

[0199] After that, based on the generated false sharing information, the method of avoiding the false sharing is determined for each portion in which the false sharing has been detected, the command is inserted in accordance with the determined method, and a parallel program in which the false sharing is avoided is generated (2108). This false sharing avoiding processing is described in detail referring to FIGS. 20A and 20B.

[0200] After that, task scheduling for determining a sequence of executing the respective tasks is executed (2109), and a cache manipulation instruction for handling the stale data is inserted (2110). With this operation, the parallel program with a coherency control function is generated. Processing for inserting the cache manipulation instruction is described in detail referring to FIG. 21.

[0201] FIGS. 20A and 20B are flowcharts of the false sharing avoiding processing according to the embodiments of this invention, which is called from Step 2108 of compiling processing (FIG. 19).

[0202] In the false sharing avoiding processing illustrated in FIGS. 20A and 20B, the false sharing information detected in Step 2107 is used as an input, and the following processing is performed for each case of the false sharing that occurs in the same array.

[0203] The false sharing avoiding processing is broadly classified into data layout conversion and restructuring. FIG. 20A illustrates data layout conversion processing, and FIG. 20B illustrates restructuring processing.

[0204] First, it is determined whether or not the array variable to be subjected to the processing can be converted (2121). For example, in a case where the array variable is closed within the program to be compiled, specifically, is declared within the program to be compiled and is not to be an argument of a function defined outside the program, there is no probability that the conversion of a data layout causes the program to perform an unexpected operation, and hence it is determined that the array variable can be converted.

[0205] As a result, when it is determined that the array cannot be converted, the conversion of the data layout such as the expansion or padding of the array is difficult, and hence the procedure advances to Step 2131 (FIG. 20B) to perform the restructuring.

[0206] On the other hand, when it is determined that the array can be converted, it is determined whether or not the false sharing occurs between the elements in a fastest changing dimension of the array (2122). Specifically, in an N-dimension array, the fastest changing dimension is defined as the first dimension, and a slowest changing dimension is defined as the N-th dimension. The fastest changing dimension represents a dimension of the array in which the subscript is continuously changed. For example, in a case where the N-dimension array is processed by the loop, the innermost loop becomes the fastest changing dimension, and an outermost loop becomes the slowest changing dimension. In other words, the data in the fastest changing dimension is placed in the continuous area on the memory.

[0207] As a result, when it is determined that the false sharing occurs between the elements in the fastest changing dimension, it is determined whether or not the array can be subjected to the expansion (2123). In Step 2123, it is determined whether or not deterioration of performance ascribable to deterioration of cache use efficiency is small even when the array is subjected to the expansion. For example, in a case where the array size is sufficiently small, the deterioration of the performance ascribable to the deterioration of the cache use efficiency is small even when the array is subjected to the expansion as illustrated in FIG. 6A, and hence it is determined that the array can be subjected to the expansion. Specifically, in a case where the following expression (1) is satisfied, the array size is sufficiently small, and hence it is determined that the array can be subjected to the expansion.

Sa1: declared size of the subject array in the first dimension

S: cache line size

N: number of processors to be used



[0208] When it is determined as a result that the array can be subjected to the expansion, by inserting the code illustrated in FIG. 6B into the program, the array is expanded as illustrated in FIG. 6A. On the other hand, when it is determined that it is difficult to subject the array to the expansion, the procedure advances to Step 2131 (FIG. 20B) to perform the restructuring.

[0209] On the other hand, in Step 2122, when it is determined that the false sharing occurs between the elements in a dimension other than the fastest changing dimension, it is determined whether or not the array can be subjected to the padding (2125). In Step 2125, it is determined whether or not the deterioration of the performance ascribable to the deterioration of the cache use efficiency is small even when the array is subjected to the padding. For example, in a case where the array size is sufficiently large, the deterioration of the performance ascribable to the deterioration of the cache use efficiency is small even when the array is subjected to the padding as illustrated in FIG. 13A, and hence it is determined that the array can be subjected to the padding. Specifically, in a case where the following expression (2) is satisfied, the array size is sufficiently small, and hence it is determined that the array can be subjected to the padding.

Sa2: partial array size at lower levels than the dimension in which false sharing occurs in the subject array variable

S: cache line size

N: number of processors to be used



[0210] In a case where it is determined as a result that the array can be subjected to the expansion, by inserting the code illustrated in FIG. 13B into the program, the array is subjected to the expansion as illustrated in FIG. 13A. On the other hand, when it is determined that it is difficult to subject the array to the expansion, the procedure advances to Step 2131 (FIG. 20B) to perform the restructuring.

[0211] In the restructuring processing illustrated in FIG. 20B, the following processing is performed on the false sharing that cannot be handled by the data layout conversion within the detected false sharing information.

[0212] First, it is determined whether or not the false sharing occurs only in the boundary area of the processing performed by the respective processors (2131). Specifically, it is determined whether or not access to the array to be subjected to the processing is continuous access. For example, in a case where the areas accessed by the respective processors after parallelization overlap each other (case where the PE0 has access as in i, i+2, i+4..., while the PE1 has access as in i+1, i+3, i+5...), the access to the array to be subjected to the processing is not the continuous access, and hence the false sharing occurs even outside the boundary area.

[0213] When it is determined as a result that the false sharing occurs even outside the boundary area, the procedure advances to Step 2139.

[0214] On the other hand, when it is determined that the false sharing occurs only in the boundary area, it is determined whether or not a location in which it is determined that the false sharing occurs is parallel processing using the loop (2132).

[0215] When it is determined as a result that the false sharing occurs outside the parallel processing using the loop, the procedure advances to Step 2139.

[0216] On the other hand, when it is determined that the false sharing occurs in the parallel processing using the loop, it is determined whether or not the loop division is possible in the boundary of the cache line (2133).

[0217] When it is determined as a result that the loop division is not possible in the boundary of the cache line, by inserting the code illustrated in FIG. 8B into the program, as illustrated in FIG. 8A, the buffer is used to perform communications between the processing elements (2138).

[0218] On the other hand, when it is determined that the loop division is possible in the boundary of the cache line, it is determined whether or not the deterioration of the performance due to an imbalance of load ascribable to the loop division is small (2134). For example, in a case where a loop rotation number is sufficiently large, it can be determined that the influence due to the imbalance of the load ascribable to the loop division is small. Specifically, in a case where the following expression (3) is satisfied, the loop rotation number is sufficiently large, and hence it can be determined that the influence due to the imbalance of the load ascribable to the loop division is small.

R: loop rotation number

S: cache line size

N: number of processors to be used



[0219] Further, in a case where the tasks are evenly divided for the respective processors, a difference between a maximum value and a minimum value of a data amount (access range) used by the divided tasks may be compared with the line size to determine that the influence due to the imbalance of the load is a small when the difference is smaller than the line size.

[0220] When it is determined as a result that the influence due to the imbalance of the load ascribable to the loop division is large, by inserting the code illustrated in FIG. 8B into the program, as illustrated in FIG. 8A, the buffer is used to perform communications between the processing elements (2138). It should be noted that the method illustrated in FIGS. 10A and 10B may be used, and in the case of the multi-dimensional array, the method illustrated in FIGS. 15A and 15B is used.

[0221] On the other hand, when the influence due to the imbalance of the load ascribable to the loop division is small, it is determined whether or not the loop division is possible only in the boundary of the cache line (2135). For example, in a case where the elements of the array variable a[i] and a[i+1] are accessed within the same loop, the loop division is not possible only in the boundary of the cache line.

[0222] When it is determined as a result that the loop division is possible only in the boundary of the cache line, by inserting the code illustrated in FIG. 7B into the program, as illustrated in FIG. 7A, the loop is divided in the boundary of the cache line (2136). It should be noted that, in the case of the multi-dimensional array, the method illustrated in FIGS. 15A and 15B is used.

[0223] On the other hand, in the case where the elements of the array variable a[i] and a[i+1] are accessed within the same loop, when the loop division is not possible only in the boundary of the cache line, the code illustrated in FIG. 7B is inserted into the program at the portion at which the loop division is possible in the boundary of the cache line (for example, portion at which a[i] is divided). In addition, by inserting the code illustrated in FIG. 8B into the program at the portion at which the loop division is not possible in the boundary of the cache line (for example, portion at which a[i+1] is divided), as illustrated in FIG. 8A, the buffer is used to perform communications between the processing elements (2137).

[0224] For example, a[i] is subjected to the loop division in the boundary of the cache line, and with regard to a[i+1], the buffer may be used to perform communications between the processing elements. In this case, an access count of a[i] and an access count of a[i+1] may be compared with each other, and with regard to the subscript of the element of the array variable exhibiting a large access count, the loop division may be performed in the boundary of the cache line to lower the overhead of the communications of the data stored in the buffer.

[0225] On the other hand, in Step 2139, it is determined whether or not the overhead of copy processing from a private variable used in the arithmetic processing by each of the processing elements to the global variable is low. Specifically, in a case where a processing amount of the calculation executed in the loop is sufficiently large, the overhead of the copy processing is small enough to be ignored. For example, in a case where the data on another variable is simply substituted (copied) into a, the processing amount of the calculation executed in the loop is small, while in a case where a calculation result from the four fundamental arithmetic processing or a function in the loop is substituted into a, the processing amount of the calculation executed in the loop becomes large.

[0226] When it is determined as a result that the overhead of the copy processing for the variable is low, by inserting the code illustrated in FIG. 11 (code illustrated in FIG. 16 in the case of the multi-dimensional array) into the program, the arithmetic processing is performed by using the private variable defined in each of the processing elements, and the result of the arithmetic processing is copied from the private variable to the global variable (2140).

[0227] On the other hand, when it is determined that the overhead of the copy processing for the variable is high, the results from the arithmetic processing performed by the respective processing elements are successively written to the centralized shared memory 160 (2141).

[0228] FIG. 21 is a flowchart of the processing for inserting the cache manipulation instruction according to the embodiments of this invention.

[0229] First, in a result of scheduling a task graph in a parallelization phase, the data dependence between the tasks assigned to the different processors is analyzed (2151).

[0230] It is determined whether or not the dependence relationship of the analyzed data is the flow dependence or the output dependence (2152). When it is determined as a result that the dependence relationship of the analyzed data is the flow dependence or the output dependence, the cache manipulation instruction is inserted (2153).

[0231] Specifically, in the same manner as described above with reference to FIG. 3B, the cache manipulation instruction that the processing element that produces the data write back, after updating the data, the updated data to the main memory (centralized shared memory 160) in accordance with the writeback command and the cache manipulation instruction that the processing element that consumes the data read, before consuming the data, the data from the main memory in accordance with the self-invalidate command are generated, and the generated cache manipulation instructions are inserted into the program. At this time, the processing element that consumes the data is controlled to be notified by the flag that the processing element that produces the data has finished updating the data, and the processing element that consumes the data is controlled to learn the update of the data from the updated flag and read the updated data from the main memory. The compiler generates the control command using the flag, and inserts the generated control command into the program.

[0232] On the other hand, when the dependence relationship of the analyzed data is not the flow dependence or the output dependence, the processing for inserting the cache manipulation instruction is brought to an end.

[0233] As described above, according to the embodiments of this invention, control performed by software allows hardware for the coherency control to be unnecessary, which can simplify the hardware. Therefore, it is possible to realize a low-cost and low-power-consumption multiprocessor system. Further, optimization of the compiler enables an improvement in scalable performance.


Claims

1. A method of managing a storage area of a shared memory when a multiprocessor system executes a program,
the multiprocessor system including a plurality of processing elements (100, 110, 120) and a shared memory which is any one or both of a centralized shared memory (160) and a distributed shared memory (103, 113, 123) that can be accessed from each of the plurality of processing elements,
the plurality of processing elements including a first (100) and a second processing element (110),
each of the plurality of processing elements including a processor (101, 111, 121) for performing arithmetic processing and a cache memory (102, 112, 122) for temporarily storing data used by the processor,
the method including the steps of:

temporarily storing, in the cache memory, by the each of the plurality of processing elements, the data read and transferred from the shared memory;

transferring the data whose use by the each of the plurality of processing elements has been finished from the cache memory and writing back the data to the shared memory,

the data transfer between the shared memory and the cache memory being performed in units of a management unit size of the cache memory,

characterized by:
in a case where a boundary (515) between the data used by respective tasks, included in the program and divided between the first and second processing elements, does not correspond to a boundary of the units of the management unit size of the cache memory:

providing a non-cacheable area (800) from which the data to be stored in a unit of the management unit size including the boundary between the data is not temporarily stored in the cache memory of the second processing element,

storing an arithmetic processing result, computed by said second processing element, in a unit of the management unit size including the boundary between the data in the non-cacheable area,

transferring the arithmetic processing result stored in the non-cacheable area to the cache memory of the first processing element.


 
2. The method according to claim 1, wherein:
the step of storing the arithmetic processing result in the non-cacheable area includes the steps of:

performing, by the first processing element, the arithmetic processing in the cache memory on the data stored in the unit of management unit size including the boundary between the data used by the respective tasks;

storing, by the second processing element, the arithmetic processing result stored in the unit of management unit size including the boundary between the data used by the respective tasks in the non-cacheable area.


 
3. The method according to claim 1, wherein:

the non-cacheable area is provided to each of the distributed shared memories included in each of the plurality of processing elements; and

the step of storing the arithmetic processing result in the non-cacheable area includes the steps of:

performing, by each of the plurality of processing elements, the arithmetic processing in the non-cacheable area of each of the plurality of processing elements on the data stored in the management unit including the boundary between the data used by the respective tasks; and

writing, by the first processing element, a result of performing the arithmetic processing in the non-cacheable area to a shared memory of the second processing element.


 
4. The method according to claim 1, further including the steps of:

writing back, by one of the plurality of processing elements that produces the data, in a case where there is a dependence relationship of data between the tasks executed by different ones of the plurality of processing elements, the data having the dependence relationship to the main memory; and

invalidating, by another one of the plurality of processing elements that consumes the data, the data exhibiting the dependence relationship.


 


Ansprüche

1. Verfahren zum Verwalten eines Speicherbereichs eines gemeinsam genutzten Arbeitsspeichers, wenn ein Multiprozessorsystem ein Programm ausführt,
wobei das Multiprozessorsystem eine Vielzahl von Prozessorelementen (100, 110, 120) und einen gemeinsam genutzten Arbeitsspeicher aufweist, der ein beliebiger aus einem zentralen gemeinsam genutzten Arbeitsspeicher (160) und einem verteilten gemeinsam genutzten Arbeitsspeicher (103, 113, 123) oder beides ist, auf den jedes aus der Vielzahl von Prozessorelementen zugreifen kann,
wobei die Vielzahl von Prozessorelementen ein erstes (100) und ein zweites (110) Prozessorelement umfasst,
wobei jedes aus der Vielzahl von Prozessorelementen einen Prozessor (101, 111, 121) zum Durchführen einer arithmetischen Verarbeitung und einen Cache-Arbeitsspeicher (102, 112, 122) zum vorübergehenden Speichern von durch den Prozessor verwendeten Daten umfasst,
wobei das Verfahren die folgenden Schritte umfasst:

vorübergehendes Speichern der Daten, die aus dem gemeinsam genutzten Arbeitsspeicher ausgelesen und übertragen wurden, durch jedes aus der Vielzahl von Prozessorelementen in dem Cache-Arbeitsspeicher;

Übertragen der Daten, deren Verwendung durch jedes aus der Vielzahl von Prozessorelementen abgeschlossen wurde, von dem Cache-Arbeitsspeicher und Zurückschreiben der Daten in den gemeinsam genutzten Arbeitsspeicher,

wobei die Datenübertragung zwischen dem gemeinsam genutzten Arbeitsspeicher und dem Cache-Arbeitsspeicher in Einheiten einer Verwaltungseinheitsgröße des Cache-Arbeitsspeichers durchgeführt wird,

gekennzeichnet durch:
in einem Fall, in dem eine Grenze (515) zwischen den durch verschiedene Arbeitsschritte verwendeten Daten, die in dem Programm enthalten und zwischen dem ersten und dem zweiten Prozessorelement aufgeteilt sind, keiner Grenze der Einheiten der Verwaltungseinheitsgröße des Cache-Arbeitsspeichers entspricht:

das Bereitstellen eines nicht zwischenspeicherbaren Bereichs (800), aus dem die Daten, die in einer Einheit der Verwaltungseinheitsgröße, einschließlich der Grenze zwischen den Daten, zu speichern sind, nicht vorübergehend in dem Cache-Arbeitsspeicher des zweiten Prozessorelements gespeichert werden,

das Speichern eines arithmetischen Verarbeitungsergebnisses, das durch das zweite Prozessorelement berechnet wurde, in einer Einheit der Verwaltungseinheitsgröße, einschließlich der Grenze zwischen den Daten in dem nichtzwischenspeicherbaren Bereich,

Übertragen des in dem nichtzwischenspeicherbaren Bereich gespeicherten arithmetischen Verarbeitungsergebnisses an den Cache-Arbeitsspeicher des ersten Verarbeitungselements.


 
2. Verfahren nach Anspruch 1, wobei:
der Schritt des Speicherns des arithmetischen Verarbeitungsergebnisses in dem nichtzwischenspeicherbaren Bereich die folgenden Schritte umfasst:

Durchführen der arithmetischen Verarbeitung in dem Cache-Arbeitsspeicher für die Daten, die in der Einheit der Verwaltungseinheitsgröße, einschließlich der Grenze zwischen den Daten, die von den entsprechenden Arbeitsschritten verwendet werden, gespeichert sind, durch das erste Prozessorelement;

Speichern des arithmetischen Verarbeitungsergebnisses, das in der Einheit der Verwaltungseinheitsgröße, einschließlich der Grenze zwischen den Daten, die von den entsprechenden Arbeitsschritten in dem nichtzwischenspeicherbaren Bereich verwendet werden, gespeichert ist, durch das zweite Prozessorelement.


 
3. Verfahren nach Anspruch 1, wobei:

der nichtzwischenspeicherbare Bereich für jeden der verteilten gemeinsam genutzten Arbeitsspeicher bereitgestellt ist, die in jedem aus der Vielzahl von Prozessorelementen enthalten sind; und

der Schritt des Speicherns des arithmetischen Verarbeitungsergebnisses in dem nichtzwischenspeicherbaren Bereich die folgenden Schritte umfasst:

Durchführen der arithmetischen Verarbeitung in dem nichtzwischenspeicherbaren Bereich jedes aus der Vielzahl von Prozessorelementen für die Daten, die in der Verwaltungseinheit, einschließlich der Grenze zwischen den Daten, die für die jeweiligen Arbeitsschritte verwendet werden, gespeichert sind, durch jedes aus der Vielzahl von Prozessorelementen; und

Schreiben eines Ergebnisses des Durchführens der arithmetischen Verarbeitung in dem nichtzwischenspeicherbaren Bereich in einen gemeinsam genutzten Arbeitsspeicher des zweiten Prozessorelements durch das erste Prozessorelement.


 
4. Verfahren nach Anspruch 1, das ferner die folgenden Schritte umfasst:

in einem Fall, in dem eine Abhängigkeitsbeziehung von Daten zwischen den Arbeitsschritten besteht, die von verschiedenen aus der Vielzahl von Prozessorelementen ausgeführt werden, wobei die Daten die Abhängigkeitsbeziehung zu dem Hauptarbeitsspeicher aufweisen, das Zurückschreiben durch eines aus der Vielzahl von Prozessorelementen, das die Daten generiert; und

das Invalidieren der Daten, die die Abhängigkeitsbeziehung aufweisen, durch ein weiteres aus der Vielzahl von Prozessorelementen, die die Daten verbrauchen.


 


Revendications

1. Procédé de gestion d'une zone de stockage d'une mémoire partagée lorsqu'un système multiprocesseur exécute un programme,
le système multiprocesseur comprenant une pluralité d'éléments de traitement (100, 110, 120) et une mémoire partagée qui est l'une quelconque ou les deux parmi une mémoire partagée centralisée (160) et une mémoire partagée distribuée (103, 113, 123) auxquelles peut avoir accès chacun de la pluralité d'éléments de traitement,
la pluralité d'éléments de traitement comprenant un premier (100) et un second élément de traitement (110),
chacun de la pluralité d'éléments de traitement comprenant un processeur (101, 111, 121) pour effectuer un traitement arithmétique et une mémoire cache (102, 112, 122) pour stocker temporairement des données utilisées par le processeur,
le procédé comprenant les étapes consistant à :

stocker temporairement, dans la mémoire cache, par chacun de la pluralité d'éléments de traitement, les données lues et transférées depuis la mémoire partagée ;

transférer les données dont l'utilisation par chacun de la pluralité d'éléments de traitement a été terminée depuis la mémoire cache et réécrire les données dans la mémoire partagée,

le transfert de données entre la mémoire partagée et la mémoire cache étant effectué en unités d'une taille d'unité de gestion de la mémoire cache,

caractérisé par :
dans le cas où une frontière (515) entre les données utilisées par des tâches respectives, incluses dans le programme et divisées entre les premier et second éléments de traitement, ne correspond pas à une frontière des unités de la taille d'unité de gestion de la mémoire cache :

fournir une zone ne pouvant pas être mise en cache (800) à partir de laquelle les données à stocker dans une unité de la taille d'unité de gestion incluant la frontière entre les données ne sont pas temporairement stockées dans la mémoire cache du second élément de traitement,

stocker un résultat de traitement arithmétique, calculé par ledit second élément de traitement, dans une unité de la taille d'unité de gestion incluant la frontière entre les données dans la zone ne pouvant pas être mise en cache,

transférer le résultat de traitement arithmétique stocké dans la zone ne pouvant pas être mise en cache vers la mémoire cache du premier élément de traitement.


 
2. Procédé selon la revendication 1, dans lequel :
l'étape de stockage du résultat de traitement arithmétique dans la zone ne pouvant pas être mise en cache comprend les étapes consistant à :

effectuer, par le premier élément de traitement, le traitement arithmétique dans la mémoire cache sur les données stockées dans l'unité de taille d'unité de gestion incluant la frontière entre les données utilisées par les tâches respectives ;

stocker, par le second élément de traitement, le résultat de traitement arithmétique stocké dans l'unité de taille d'unité de gestion incluant la frontière entre les données utilisées par les tâches respectives dans la zone ne pouvant pas être mise en cache.


 
3. Procédé selon la revendication 1, dans lequel :

la zone ne pouvant pas être mise en cache est fournie à chacune des mémoires partagées distribuées incluses dans chacun de la pluralité d'éléments de traitement ; et

l'étape de stockage du résultat de traitement arithmétique dans la zone ne pouvant pas être mise en cache comprend les étapes consistant à :

effectuer, par chacun de la pluralité d'éléments de traitement, le traitement arithmétique dans la zone ne pouvant pas être mise en cache de chacun de la pluralité d'éléments de traitement sur les données stockées dans l'unité de gestion incluant la frontière entre les données utilisées par les tâches respectives ; et

écrire, par le premier élément de traitement, un résultat de l'exécution du traitement arithmétique dans la zone ne pouvant pas être mise en cache dans une mémoire partagée du second élément de traitement.


 
4. Procédé selon la revendication 1, comprenant en outre les étapes consistant à :

réécrire, par l'un de la pluralité d'éléments de traitement qui produit les données, dans un cas où il existe une relation de dépendance de données entre les tâches exécutées par différents éléments de la pluralité d'éléments de traitement, les données ayant la relation de dépendance avec la mémoire principale; et

invalider, par un autre élément de la pluralité d'éléments de traitement qui consomme les données, les données présentant la relation de dépendance.


 




Drawing








































































































Cited references

REFERENCES CITED IN THE DESCRIPTION



This list of references cited by the applicant is for the reader's convenience only. It does not form part of the European patent document. Even though great care has been taken in compiling the references, errors or omissions cannot be excluded and the EPO disclaims all liability in this regard.

Patent documents cited in the description




Non-patent literature cited in the description