WO2013105158A1 - データ依存解析支援装置、データ依存解析支援プログラム、及びデータ依存解析支援方法 - Google Patents
データ依存解析支援装置、データ依存解析支援プログラム、及びデータ依存解析支援方法 Download PDFInfo
- Publication number
- WO2013105158A1 WO2013105158A1 PCT/JP2012/006223 JP2012006223W WO2013105158A1 WO 2013105158 A1 WO2013105158 A1 WO 2013105158A1 JP 2012006223 W JP2012006223 W JP 2012006223W WO 2013105158 A1 WO2013105158 A1 WO 2013105158A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- analysis
- information
- data
- dependence
- pointer
- Prior art date
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/41—Compilation
- G06F8/43—Checking; Contextual analysis
- G06F8/433—Dependency analysis; Data or control flow analysis
- G06F8/434—Pointers; Aliasing
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/41—Compilation
- G06F8/45—Exploiting coarse grain parallelism in compilation, i.e. parallelism between groups of instructions
- G06F8/456—Parallelism detection
Definitions
- the present invention relates to a program development technique for realizing a parallel processing system, and more particularly to a technique for data-dependent analysis of a source program.
- a processor capable of executing threads in parallel by a multiprocessor configuration and a processor capable of executing a plurality of threads in parallel by a single processor have been installed in consumer embedded devices.
- Patent Document 1 discloses a program processing apparatus.
- the program processing apparatus of Patent Literature 1 accepts a sequential program source code in which a threading area is specified using an indicator THREAD as a parallel processing program. And the program processing apparatus of patent document 1 analyzes the dependence relationship between threading areas, and after thread-parallelizing the inter-thread communication code for performing data transmission / reception with respect to variables in which data transmission / reception is performed between threads Thread parallelization is performed by inserting each thread.
- An object of the present invention is to provide a data dependence analysis support device that completes data dependence analysis between threaded areas with high accuracy and in a short time.
- a data dependency analysis support device is a data dependency analysis support device that performs context sensitive data dependency analysis on a source program, and is all used in the source program. Context-sensitive pointer analysis is performed on each pointer, and a pointer information generation unit that generates pointer information and a data dependency that is part of the source program and exists between two or more threaded areas are analyzed.
- a data flow information generation unit that generates data flow information, About data dependency existing between the two or more threaded regions
- the original threaded region, a threaded region of the dependency target characterized in that it comprises a and a region between the dependency information generation unit for generating a region between dependency information indicating a variable which is responsible for the dependent.
- the data dependence analysis support device can shorten the analysis time by performing the data flow analysis, which is a part of the data dependence analysis, only on the analysis target area, not the entire source program.
- Context sensitive analysis of pointer analysis and data flow analysis which are part of the data dependency analysis, enables highly accurate dependency information between threaded areas, and high accuracy analysis and reduction of analysis time Can be achieved.
- FIG. The figure which shows the example of the thread
- the context-sensitive analysis is to analyze the function including the call destination function for each function call. For this reason, the time required for the analysis is longer than that of a non-context sensitive analysis in which one function is analyzed only once. In particular, a very long analysis time is required to perform a context sensitive analysis on the entire program.
- the data dependency analysis procedure includes pointer analysis for analyzing which variable the pointer points to, and how the variable is defined / referenced. And data flow analysis that analyzes which statement defines the value at the time of reference.
- Pointer analysis must be performed on the entire source program. This is because, if there is a pointer whose variable is unknown, it cannot be determined which variable is defined or used by the indirect reference of the pointer, and accurate data dependence analysis cannot be performed.
- the inventors obtained knowledge that data flow analysis only needs to be performed on a part of the source program subject to data dependency analysis if pointer analysis is performed on the entire source program. It was. This is because the area of interest (the entire control structure if the area is a part of a control structure such as repetition or branching) and the called area (hereinafter referred to as a set of statements called from the area). This is because all the information necessary to analyze the data dependence in the area is included in the analysis target area). This is because of the relationship between the pointer and the variable. That is, if it is clear which variable the pointer points to, data dependence analysis can be performed by performing data flow analysis on the analysis target area.
- the analysis time of context sensitive pointer analysis depends on the total number of pointers
- the analysis time of context sensitive data flow analysis depends on the number of sentences to be analyzed.
- the number of statements in a program is very large compared to the total number of pointers, and when analyzing the entire area of the same source program, the analysis time of context-sensitive data flow analysis is approximately the same as that of context-sensitive pointer analysis. About 10 times is required.
- context sensitive pointer analysis needs to be performed over the entire source program, while context sensitive data flow analysis is performed only on the analysis target area including all threaded areas.
- context sensitive data flow analysis is performed only on the analysis target area including all threaded areas.
- the analysis device performs a pointer analysis that analyzes which variable the pointer points to.
- the analysis device performs data flow analysis for analyzing which statement holds the value of the variable and what value the statement holds.
- the “statement” is a basic unit of the procedure structure of the program, and in C language or C ++ language, is an element unit delimited by semicolons.
- the value held by the variable is referred to as “the value of the variable”
- “update of the value held by the variable” is referred to as “the definition of the variable”
- “the value held by the variable” Is referred to as "use of variables”.
- “update” includes assigning a new value to a variable whose value is undefined.
- Data dependence refers to a relationship in which, when there is a variable x, the variable x is defined in one sentence and the variable x is used in another sentence.
- the analysis device performs a data dependency analysis between the areas that specify variables for which data is exchanged between the threaded areas. Then, the analysis device inserts a communication code into the thread in order to pass a value held by a variable that receives and transfers data between threaded areas between the areas.
- context sensitive analysis will be described as a method of data dependence analysis.
- the context-sensitive analysis is to perform analysis according to the state of each function call even if the same function is called as in Chapter 12 of Non-Patent Document 1.
- pointer analysis, data flow analysis, and inter-sentence data dependency analysis are analyzed for each function call, that is, even for the same function call, each call to the function includes the call destination function. . Therefore, not only analysis is performed over the entire area of interest, but also when the same function is called at a plurality of locations in the area, the same function is repeatedly analyzed for each call. Similarly, when the function to be called further calls a function, the analysis is performed for each function call including the call destination function.
- FIG. 3 shows an example of a source program written in the C / C ++ language that is the target of thread parallelization.
- FIG. 3A shows the file name rei. c
- FIG. 3B shows the file name proc. c
- FIG. 3 (c) shows the file name cmn.
- Each of the contents of the file c is represented, and the head number is a line number.
- “sentence + number” in the figure represents an identifier of the sentence, and uniquely identifies the sentence with a number.
- FIG. c has a function main that is executed at the beginning of the program. Furthermore, the function main calls the function sub, and further, the function sub is stored in the file proc. The function proc, function proc2, and function proc3 in c are called. Further, as shown in FIG. 3B, the function proc is a file cmd. The function fun and function gun in c are called.
- the region R1 from the line number 8 to the line number 19 (not shown) in the for loop of the line number 7 of the function proc of FIG. 3B to be threaded similarly, the line number 20 to the line number 29 A region R2 to be threaded (not shown) and a region R3 to be threaded from line number 30 to line number 39 (not shown).
- FIG. 3B there are two calls of the function “fun” in the sentence 57 and the sentence 66.
- the address of the variable “e” is passed to the pointer “p” as the dummy argument of the function “fun”.
- the address of the variable “f” is passed to the pointer “p” as the dummy argument of the function “fun”. Yes.
- description will be made using the call of the function “fun” in the sentence 57.
- Non-context sensitive pointer analysis and data flow analysis searches for a statement that calls the function “fun” in the program, and collects a value passed to the pointer “p” that is a dummy argument.
- the analysis device collects the addresses of the variable e and the variable f from the sentence 57 and the sentence 66 as values passed to the pointer p.
- the analysis apparatus analyzes that the pointer p in the statement 101 of the function fun indicates both the variable e and the variable f.
- the analysis device performs non-context sensitive data flow analysis using the result of the non-context sensitive pointer analysis.
- the analysis device analyzes that the variable e is used in the sentence 61, and analyzes that the variable f is used in the sentence 65. Further, the analysis device analyzes that the variable e is used in the sentence 56 from the loop of the line numbers 7 to 40.
- the pointer p points to both the variable e and the variable f, so that the analysis apparatus uses both the variable e and the variable f in the statement 101 and defines them. To analyze.
- the analysis apparatus analyzes when both the variable e and the variable f are defined in the call of the function “fun” in the sentence 57, which is the caller of the sentence 101.
- the analysis device performs data dependency analysis using the result of data flow analysis that is not context sensitive. Since the analysis device analyzes when the variable f is defined in the sentence 57 and analyzes when the variable f is used in the sentence 65, the analysis apparatus analyzes that there is a data dependency from the sentence 57 to the sentence 65. .
- the analysis device analyzes that there is data dependence from the sentence 57 to the sentence 61 and the sentence 56 due to the variable e.
- Context Sensitive Pointer Analysis and Data Flow Analysis In context sensitive analysis, the analysis device distinguishes between calling the function fun from the statement 57 and calling the function fun from the statement 66.
- the analysis device analyzes that the pointer “p” that is a dummy argument of the function “fun” is the address of the variable “e” that is the argument of the function “fun” of the statement 57. Thereby, the analysis device analyzes that the value held by the pointer p of the statement 101 of the function fun called from the statement 57 is the address of the variable e.
- the analysis device performs context sensitive data flow analysis using the result of the context sensitive pointer analysis.
- the analysis device analyzes when the variable e is defined in the statement 101.
- the analysis device analyzes when the variable e defined in the sentence 101 is used in the sentence 61. Similarly, the analysis device analyzes that the variable e defined in the sentence 101 is used in the sentence 56 by a loop of line numbers 7 to 40.
- the analysis device performs data dependence analysis using the result of context sensitive data flow analysis. Since the analysis apparatus analyzes that the variable e defined in the sentence 101 is used in the sentence 56 and the sentence 61, there is data dependence from the sentence 101 to the sentence 56 and the sentence 61 due to the variable e. Analyzes that it exists.
- the analysis apparatus changes from the sentence 57 (the sentence 101 called from the sentence 57) to the sentences 56 and 61. Analyzes that there is data dependence due to the variable e.
- the analysis apparatus analyzes that there is data dependence caused by the variable f from the sentence 57 to the sentence 65 in addition to the above analysis result.
- the value passed to the pointer p in the statement 57 is the address of the variable e
- the value of the variable f is not defined in the statement 101 of the function fun to be called, and the variable f is caused from the statement 57 to the statement 65.
- the analysis that is not content-sensitive there is a case where an erroneous analysis result that data dependence exists even though there is actually no dependence relation may be obtained.
- Context-sensitive call graph (hereinafter simply referred to as a call graph) generates a node for each function call, and directs the call from the function node to the function node to be called. It is the graph which subtracted.
- Each node has a node identifier, a call function name, and a statement identifier of a function call statement.
- FIG. 4 is a call graph for FIG.
- a node with a node identifier of 2 is a node generated corresponding to the function call statement 25 of line number 25 in FIG.
- the node identifier is a number uniquely assigned to the node. Therefore, when attention is paid to a certain node, the sequence of node identifiers from the node of the program start function to the focused node is the only function call sequence. Conversely, a node identifier means that it represents a unique sequence of function calls. For example, in the node identifier 6 of FIG. 4, the function sub is called from the statement 11 of FIG. 3A in the node identifier 1, and then the function proc is called from the statement 25 of FIG. Next, the node identifier 6 represents a unique function call sequence in which the function “fun” is called from the sentence 57 in FIG.
- a function call sequence is referred to as a context
- a node identifier is also referred to as context or context information.
- Subcall graph When a particular node is focused on in the call graph, a graph below the focused node (the direction in which the directed side faces) is called a subcall graph. Also, the node of interest is called the vertex node of the subgraph. For example, in FIG. 4, a subcall graph having a node with a node identifier of 2 as a vertex node has a node identifier of 2, 6, 7, and 8 and directed edges that connect the nodes below it.
- any sub-call graph that uses nodes with the same call function name as the vertex node has the same number of nodes and the same number of directed edges and the same direction (hereinafter referred to as isomorphic). It is self-explanatory.
- nodes other than the vertex node have the same calling function name and sentence identifier.
- the call function names of the node identifiers 2 and 4 are both proc, and the subgraph having the identifier 2 as the vertex node and the subgraph having the identifier 4 as the vertex node have the same shape.
- node identifiers 6, 7, 8 and the node identifiers 9, 10, 11 except the node identifiers 2 and 4 which are vertex nodes correspond to each other, and the calling function name and the sentence identifier are the same.
- -A sentence with context information A sentence with context information expresses that when the same function is called from a plurality of locations, it is a different sentence for each call.
- a sentence with context information enables analysis of context-sensitive data flow. For example, in FIG. 3A, the function proc is called from two places, a sentence 25 and a sentence 27, and each call corresponds to the node identifiers 2 and 4 in the call graph of FIG. That is, in FIG. 3A, the context of the call statement 25 of the function proc is 2, and the context of the statement 27 is 4.
- a sentence with context information is expressed by “sentence identification ⁇ context>”.
- the sentence 51 in the function proc of FIG. 3B is expressed as 51 ⁇ 2> and 51 ⁇ 4> as sentences with context information, and is called when called from the call sentence 25 of the function proc, respectively. It is possible to distinguish between the statement 51 and the statement 51 when called from the call statement 27 of the function proc.
- FIG. 1 is a block diagram showing a configuration of a data dependence analysis support apparatus 100 according to the embodiment.
- the data dependence analysis support device 100 is realized by a personal computer, for example.
- the data dependence analysis support device 100 includes an intermediate program generation unit 200, an intermediate program storage unit 201, a call graph generation unit 202, a call graph storage unit 203, a pointer analysis unit 204, a pointer information storage unit 205, data Flow analysis unit 206, data flow information storage unit 207, inter-sentence dependency analysis unit 208, inter-sentence dependency information storage unit 209, inter-region dependency generation unit 210, inter-region dependency information storage unit 211, and inter-region
- the dependency display unit 212, the external storage unit 10, the input unit 40, and the output unit 50 are provided.
- the external storage unit 10 is realized by a hard disk, for example, and holds the source program 11.
- the input unit 40 is realized by, for example, a keyboard and a mouse, and receives input of user input information 41 including information for specifying an analysis target area and information for specifying a threaded area.
- the intermediate program generation unit 200 reads the source program 11 stored in the external storage unit 10 using the general compiler syntax analysis technique described in Non-Patent Document 1, generates an intermediate program, and generates the intermediate program The intermediate program is stored in the intermediate program storage unit 201.
- the intermediate program storage unit 201 holds the intermediate program generated by the intermediate program generation unit 200.
- the intermediate program generated by the intermediate program generation unit 200 includes file information, function information, sentence information, and line number information in the source program file in which the function / sentence is described. Further, the intermediate program generated by the intermediate program generation unit 200 may include other features of the intermediate program described in Chapter 6 of Non-Patent Document 1.
- the call graph generation unit 202 reads the intermediate program stored in the intermediate program storage unit 201, extracts all function calls, generates a context-sensitive call graph, and stores it in the call graph storage unit 203.
- the call graph storage unit 203 holds the call graph generated by the call graph generation unit 202.
- the pointer analysis unit 204 reads the intermediate program stored in the intermediate program storage unit 201 and the call graph stored in the call graph storage unit 203, and performs context-sensitive pointer analysis over the entire intermediate program.
- the analysis result is stored in the pointer information storage unit 205.
- the pointer information storage unit 205 holds the result of the context sensitive pointer analysis analyzed by the pointer analysis unit 204.
- the pointer information is a set of a statement (with context information) in which a pointer is described, a pointer, and a set of pointer variables pointed to by the pointer (hereinafter referred to as a pointer variable collection). is there.
- the pointer information storage unit 205 holds pointer information for all pointers used in the source program 11.
- the data flow analysis unit 206 includes an intermediate program stored in the intermediate program storage unit 201, context sensitive pointer information stored in the pointer information storage unit 205, and a call graph stored in the call graph storage unit 203. And user input information 41 input from the input unit 40 is read. Then, the data flow analysis unit 206 performs context sensitive data flow analysis on the analysis target region obtained from the analysis target region information included in the user input information 41 and stores the analysis result in the data flow information storage unit 207. To do.
- the data flow information storage unit 207 holds the result of the context sensitive data flow analysis analyzed by the data flow analysis unit 206.
- the inter-sentence dependency analysis unit 208 includes an intermediate program stored in the intermediate program storage unit 201, a call graph stored in the call graph storage unit 203, and a context sensitive stored in the data flow information storage unit 207. Data flow information is read, context sensitive sentence-dependent data dependence analysis is performed, and the analysis result is stored in the sentence dependence information storage unit 209.
- the inter-sentence dependency information storage unit 209 holds the analysis result of the context-sensitive inter-sentence dependency information analyzed by the inter-sentence dependency analysis unit 208.
- inter-sentence dependency information is a set of a dependency source statement (with context information), a dependency destination statement (with context information), and a variable causing the dependency (hereinafter referred to as a cause variable). All sentence dependency information is held in the sentence dependency information storage unit 209.
- the inter-region dependency generation unit 210 includes an intermediate program stored in the intermediate program storage unit 201, a call graph stored in the call graph storage unit 203, and a context sensitive information stored in the inter-sentence dependency information storage unit 209.
- the inter-sentence dependency information and the user input information 41 input from the input unit 40 are read.
- the inter-region dependency generation unit 210 obtains a threaded region from the region designation information included in the user input information 41, extracts inter-state dependency information existing between the threaded regions, and inter-region dependency information storage unit 211. To store.
- the inter-region dependency information storage unit 211 holds a result of inter-region dependency information generated by the inter-region dependency generation unit 210.
- the threaded area is specified by area specifying information that is a part of the user input information 41.
- Each threaded area is a part of the analysis target area, and the same sentence does not belong to a plurality of different threaded areas.
- This threaded area is designated by inputting a line number in text format from the keyboard or by directly selecting a specific range in the source program 11 with a pointing device such as a mouse.
- the area specification information consists of the file name, area start line number, and area end line number.
- the sentence included in the area is a sentence that meets any of the following sentence A, sentence B, and sentence C.
- a sentence A existing within the range of the end line number of the area from the file name of the area designation information and the start line number in the area.
- the statement A is a function call statement of the function F
- the statement B existing in the function F.
- the statement C existing in all functions that can be called by the function F call.
- a function that may be called by calling the function F refers to a function that is called by the function F and a function that is further called from such a function.
- the “called function” includes not only a function that is always called, but also a function that has one or more called paths, such as being called when a specific condition is satisfied.
- inter-region dependency information is a set of a dependency source region, a dependency source statement (with context information), a dependency destination region, a dependency destination statement (with context information), and a cause variable. Yes, all inter-region dependency information is held in the inter-region dependency information storage unit 211.
- the inter-region dependency display unit 212 includes a source program 11 stored in the external storage unit 10, an intermediate program stored in the intermediate program storage unit 201, a call graph stored in the call graph storage unit 203, The inter-region dependency information stored in the inter-region dependency information storage unit 211 is read, and the inter-region dependency information is output to the output unit 50.
- the output unit 50 is realized by a display, for example, and displays dependency information between regions.
- FIG. 2 is a block diagram showing the configuration of the data flow analysis unit 206 and the data flow information storage unit 207 of FIG.
- the data flow analysis unit 206 includes a pointer information combination unit 220, a definition information generation unit 222, a usage information generation unit 224, and an arrival definition information generation unit 226.
- the data flow information storage unit 207 includes a combined pointer information storage unit 221, a definition information storage unit 223, a usage information storage unit 225, and a reaching definition information storage unit 227.
- the pointer information combining unit 220 includes an intermediate program stored in the intermediate program storage unit 201, a context sensitive call graph stored in the call graph storage unit 203, and a context sensitive stored in the pointer information storage unit 205. Read pointer information and user input information 41 input from the input unit 40. The pointer information combining unit 220 combines pointer information related to the subcall tree based on the subcall tree whose vertex node is a function including all areas obtained from the analysis target area information included in the user input information 41. The combined result is stored in the combined pointer information storage unit 221.
- the combined pointer information storage unit 221 holds the pointer information combined by the pointer information combining unit 220.
- the definition information generation unit 222 includes an intermediate program stored in the intermediate program storage unit 201, a context-sensitive call graph stored in the call graph storage unit 203, and a combination stored in the combination pointer information storage unit 221. Pointer information is read, context sensitive definition information indicating what variable is defined in each statement under what function call is generated, and the generation result is stored in the definition information storage unit 223.
- the definition information storage unit 223 holds the context sensitive definition information generated by the definition information generation unit 222.
- the usage information generation unit 224 includes an intermediate program stored in the intermediate program storage unit 201, a context sensitive call graph stored in the call graph storage unit 203, and a combination stored in the combination pointer information storage unit 221. Pointer information is read, context-sensitive usage information indicating what variable is used in each statement under what function call is generated, and the generation result is stored in the usage information storage unit 225.
- the usage information storage unit 225 holds the context sensitive usage information generated by the usage information generation unit 224.
- the arrival definition information generation unit 226 includes an intermediate program stored in the intermediate program storage unit 201, a context-sensitive call graph stored in the call graph storage unit 203, and a context stored in the definition information storage unit 223. Sense sensitive definition information is read, context sensitive arrival definition information indicating what statements can reach each sentence under what function call is generated, and the generation result is stored in the arrival definition information storage unit 227 To do.
- the arrival definition information storage unit 227 holds the context sensitive arrival definition information generated by the arrival definition information generation unit 226.
- a reachable statement is a plurality of execution paths from a statement A to a certain statement B, where x is a variable defined in the certain statement A.
- x is a variable defined in the certain statement A.
- 5 to 7 are flowcharts showing the operation of the data dependence analysis support process by the data dependence analysis support apparatus 100.
- the data dependence analysis support device 100 activates the intermediate program generation unit 200.
- the intermediate program generation unit 200 reads the source program 11 from the external storage unit 10, generates an intermediate program, and stores it in the intermediate program storage unit 201 (S10).
- the call graph generation unit 202 reads the intermediate program stored in the intermediate program storage unit 201, extracts all function calls from the intermediate program, generates a context sensitive call graph, and stores the generated call graph in the call graph
- the data is stored in the unit 203 (S20).
- the data dependence analysis support device 100 activates the pointer analysis unit 204.
- the pointer analysis unit 204 reads the intermediate program stored in the intermediate program storage unit 201, performs context-sensitive pointer analysis over the entire intermediate program, and stores the generated pointer information in the pointer information storage unit 205 ( S30).
- the data dependence analysis support device 100 reads the user input information 41 input from the input unit 40, and terminates the system if the user input information 41 includes a system termination instruction; otherwise, the user input information 41 Reference is made to the analysis target area information included in the information 41 (S40).
- the data dependence analysis support device 100 proceeds to S60 if the analysis target region information has been newly obtained or updated, and proceeds to S80 if it has not been updated since the previous analysis execution (S50). .
- the data dependence analysis support device 100 activates the data flow analysis unit 206, the intermediate program stored in the intermediate program storage unit 201, and context sensitive pointer information stored in the pointer information storage unit 205.
- the user input information 41 input from the input unit 40 is read, the analysis target area obtained from the analysis target area information included in the user input information 41, and all of the possibilities that can be called when the analysis target area is executed Context sensitive data flow analysis is performed over the sentence (S60).
- the data dependence analysis support device 100 is activated in the order of the pointer information combining unit 220, the definition information generating unit 222, the usage information generating unit 224, and the arrival definition information generating unit 226.
- FIG. 6 is a flowchart showing the operation of the pointer information combining unit 220.
- the pointer information combining unit 220 reads the function name F of the function including the entire analysis target area from the analysis target area information included in the user input information 41 (S61).
- the pointer information combining unit 220 extracts a node whose call function name is F in the call graph node (S62).
- the pointer information combining unit 220 extracts a subcall graph having the node extracted in S62 as a vertex node (S63). As described above, when there are a plurality of subcall graphs extracted here, all of the subcall graphs have the same shape.
- the pointer information combining unit 220 extracts pointer information in which the node identifier (context) of the vertex node of the subcall graph extracted in S63 is the same as the context information added to the statement of pointer information (S64). .
- the pointer information combining unit 220 combines pointer information having the same sentence and variable from the pointer information extracted in S64 (S65).
- join pointer information means to join context information added to a sentence and a set of pointer target variables.
- the pointer information combining unit 220 extracts a node having the same function call statement of the node for nodes other than the vertex node of the subcall graph extracted in S63, and extracts the identifier of the node (S66).
- the pointer information combining unit 220 extracts pointer information in which the node identifier (context) extracted in S66 is the same as the context information added to the pointer information sentence (S67).
- the pointer information combining unit 220 combines pointer information having the same statement and pointer among the pointer information extracted in S67 (S68).
- pointer information related to a plurality of subcall graphs of the same shape extracted in S63 is reconstructed as pointer information related to one subcall graph. This is because only the analysis target area is the target of the data flow analysis, and therefore, in the data flow analysis, the identifiers of the extracted vertex nodes of the subcall graph may be regarded as the same.
- the definition information generation unit 222, the usage information generation unit 224, and the arrival definition information generation unit 226 perform context-sensitive intermediate program analysis using the sentence with context information, and which variable is the sentence. Definition information indicating whether the statement is defined, usage information indicating which statement the variable is used in, and arrival definition information indicating whether the statement is reachable are generated.
- the data dependence analysis support device 100 activates the inter-sentence dependence analysis unit 208, defines the intermediate program stored in the intermediate program storage unit 201, the call graph stored in the call graph storage unit 203, and the definition Context sensitive sentence units by reading definition information stored in the information storage unit 223, use information stored in the use information storage unit 225, and arrival definition information stored in the arrival definition information storage unit 227 Data dependency analysis is performed (S70).
- the data dependence analysis support device 100 proceeds to S90.
- the data dependence analysis support device 100 reads the user input information 41 input from the input unit 40, and the user input information If the area designation information included in 41 is updated, the process proceeds to S90, and if not updated, the process proceeds to S40 (S80).
- the data dependence analysis support device 100 activates the inter-area dependence generation unit 210 and stores the context-sensitive sentence space stored in the inter-text dependence information storage section 209.
- the dependency information and the user input information 41 input from the input unit 40 are read, and inter-region dependency information existing between the regions is generated for the region obtained from the region designation information included in the user input information 41 ( S90).
- FIG. 7 is a flowchart showing the operation of the inter-region dependency generation unit 210.
- the inter-region dependency generation unit 210 reads the region information from the region designation information included in the user input information 41 (S91).
- the inter-region dependency generation unit 210 extracts a sentence included in the region acquired in S91 (S92).
- the inter-region dependency generation unit 210 extracts inter-state dependency information in which the sentence extracted in S92 is a dependency source sentence and a dependency destination sentence (S93). Since the dependence source sentence and the dependence destination sentence may be the sentences extracted in S92, the dependence source sentence and the dependence destination sentence may be the same sentence or different sentences.
- the inter-region dependency generation unit 210 includes the dependency source sentence of the inter-state dependency information including the sentence extracted in S93 included in a certain region 1 and included in the region 2 including the dependency destination statement. Then, inter-region dependency information from region 1 to region 2 is generated (S94). At this time, the region 1 and the region 2 are different regions. When the dependence source sentence and the dependence destination sentence are included in the same region, the inter-sentence dependency information is not added to the inter-region dependency information.
- the inter-region dependency display unit 212 includes a source program 11 stored in the external storage unit 10, an intermediate program stored in the intermediate program storage unit 201, a call graph stored in the call graph storage unit 203, The inter-region dependency information stored in the inter-region dependency information storage unit 211 is read, and the inter-region dependency information is displayed on the output device 50 (S100).
- the data dependence analysis support device 100 proceeds to S40 after completing S100.
- the data dependence analysis support device 100 activates the intermediate program generation unit 200, and the intermediate program generation unit 200 reads the source program 11 from the external storage unit 10, converts it into an intermediate program, and stores it in the intermediate program storage unit 201 ( S10).
- FIG. 8 shows information related to the sentence included in the intermediate program for the source program 11 in FIG.
- FIG. 8 shows information on a sentence identifier, a file name of a file in which a sentence exists, and a line number in the file.
- the line of L100 indicates a function call of the function sub of the sentence 11 in FIG. 3, the sentence identifier is 11, and the file name of the file is rei. It is present at line number 10 of c.
- the data dependence analysis support device 100 activates the call graph generation unit 202, and the call graph generation unit 202 generates a context sensitive call graph (S20).
- the call graph shown in FIG. 4 is generated for the source program 11 shown in FIG.
- the data dependence analysis support device 100 activates the pointer analysis unit 204, and the pointer analysis unit 204 reads the intermediate program stored in the intermediate program storage unit 201, and performs context sensitive over the entire intermediate program. Pointer analysis is performed (S30).
- FIG. 9 shows pointer information for the source program 11 shown in FIG.
- the pointer information includes a sentence with context information and information on a pointer and a set of pointer target variables.
- the line L203 in FIG. 9 indicates that the variable indicated by the pointer r is y in the sentence 51 in FIG.
- the data dependence analysis support device 100 reads the user input information 41 input from the input unit 40, and determines whether or not the system termination information included in the user input information 41 is an input requesting termination of the system (S40). ).
- the system termination information is shown in FIG.
- the data dependence analysis support device 100 terminates the system when the system termination information is END, and continues to execute the system when the system termination information is CONTINUE.
- the system termination information is CONTINUE, the execution of the system is continued.
- the data dependence analysis support apparatus 100 refers to the analysis target area information included in the user input information 41. If the analysis target area information is newly acquired or updated, the process proceeds to S60. If not updated, the process proceeds to S80. (S50)
- the analysis target area information is shown in FIG. Here, the file name proc. The entire function name proc function existing at line number 1 of the file c is designated as the analysis target area.
- the data dependence analysis support apparatus 100 activates the data flow analysis unit 206, and the function proc that is the analysis target area obtained from the analysis target area information included in the user input information 41 and the function proc are executed.
- Context sensitive data flow analysis is performed over all statements that may be called (S60).
- the data dependence analysis support apparatus 100 activates the pointer information combination unit 220 in the data flow analysis unit 206, and the pointer information combination unit 220 reads the function name of the function including the entire analysis target region from the analysis target region information (S61). .
- the analysis target region is the entire function proc
- the function including the entire analysis target region is naturally the function proc.
- the pointer information combining unit 220 takes out the nodes having the node identifiers 2 and 4 whose call function name is the function proc in the call graph (S62).
- the pointer information combining unit 220 extracts a subcall graph having the node identifiers 2 and 4 extracted in step S62 as vertex nodes (S63).
- the pointer information combining unit 220 extracts pointer information in which the node identifier (context) of the vertex node of the subcall graph extracted in S63 is the same as the context information added to the statement of pointer information (S64). .
- the lines L200 and L201 of the pointer analysis information in FIG. 9 are extracted from the node identifier 2 of the vertex node in the call graph shown in FIG. Similarly, the rows L202 and L203 in FIG. 9 are extracted from the node identifier 4.
- the pointer information combining unit 220 combines pointer information having the same sentence and variable from the pointer information extracted in S64 (S65).
- the combined pointer analysis information is shown in FIG.
- the L300 line is a combination of the L200 line and L202 line extracted from FIG. 9, and the L301 line is a combination of the L201 line and L203 line extracted from FIG.
- the pointer information combining unit 220 extracts nodes having the same function call statement of the nodes, and extracts the identifiers of the nodes (S66).
- node identifiers 6, 7, and 8 are extracted from the subcall graph having the node identifier 2 as the vertex node, and the node identifiers 9, 10, 11 are extracted from the subcall graph having the node identifier 4 as the vertex node. Is taken out.
- the pointer information combining unit 220 extracts pointer information in which the node identifier (context) extracted in step S66 is the same as the context information added to the pointer information sentence (S67).
- the lines L204, L205, and L206 of the pointer analysis information in FIG. 9 are extracted.
- the rows L207, L208, and L209 in FIG. 9 are extracted from the node identifier 7
- the rows L210, L211, and L212 in FIG. 9 are extracted from the node identifier 9
- the rows L214 and L215 are fetched.
- node identifiers 8 and 11 there is no use of a pointer in the sentence 70 of FIG. 3B, so there is no sentence information with contexts 8 and 11 in FIG.
- the pointer information combining unit 220 combines pointer information having the same sentence and pointer among the pointer information extracted in step S67 (S68).
- the combined pointer analysis information is shown in FIG.
- the row of L302 is a combination of the row of L204 extracted from FIG. 9 and the row of L210
- the row of L303 is a combination of the row of L205 and the row of L211 extracted from FIG.
- the row is a combination of the L206 row and the L212 row taken out from FIG.
- the L305 row is a combination of the L207 row and the L213 row taken out from FIG. 9
- the L306 row is a combination of the L208 row and the L214 row taken out from FIG.
- the L307 line is a combination of the L209 line and the L215 line extracted from FIG.
- the data dependence analysis support device 100 activates the definition information generation unit 222, the usage information generation unit 224, and the arrival definition information generation unit 226 in order in the data flow analysis unit 206, and is included in the user input information 41. Context sensitive data flow analysis is performed on the analysis target area.
- FIG. 11 shows the definition information.
- the line L400 indicates that the variable e is defined in the contexts 2 and 4 by the sentence 51 in FIG.
- FIG. 12 shows usage information.
- the L500 line indicates that the variables x and y are used in the context 51 and the sentence 51 in FIG.
- FIG. 13 shows the arrival definition information.
- the line of L601 includes the sentence 51 in FIG. 3B in the contexts 2 and 4 among the sentences that can reach the sentence 56 in FIG. 3 and the sentence 52 in the contexts 6 and 9 and the sentence 101 in FIG.
- the sentences that can reach the sentence 56 include the sentence 101 in FIG. 3C in the contexts 6 and 9 for the following reason.
- the address of the variable e is transferred to the pointer p of the statement 100 in FIG. 3C, and the pointer p in the statement 101 in FIG.
- the variable e is defined by indirect reference.
- the control proceeds to the line number 7 in FIG. 3B, but between the line number 11 (not shown) and the line number 40 (not shown) in FIG. There is no statement that defines the variable e.
- the value of the variable e defined in the sentence 101 in FIG. 3C is held in the variable e in the sentence 56 in FIG.
- the data dependency analysis support device 100 activates the inter-sentence dependency analyzing unit 207, and the inter-sentence dependency analyzing unit 207 performs context-sensitive sentence-by-sentence data dependency analysis (S70).
- the line of L711 is obtained as follows. First, the sentence 101 in FIG. 3C in the contexts 6 and 9 is taken out from the line L603 in FIG. 13 as a sentence that can reach the sentence 61 in the contexts 2 and 4 in FIG. In the line L408 of the definition information, the variable e is found to be a variable defined by the sentence 101 in the contexts 6 and 9. Next, in the line L503 of the usage information in FIG. Find that there is a variable e. As a result, the dependency is obtained from the sentence 101 in the contexts 6 and 9 with the variable e as the cause variable, to the sentence 61 in the contexts 2 and 4. This is because the variable x is defined in (1) statement 1, (2) the variable x is used in statement 2, and (3) statement 1 can reach statement 2 For example, there is a dependency from the sentence 1 to the sentence 2 with the variable x as a cause variable.
- the area designation information is shown in FIG. In FIG. 16C, the area name indicates the area name, the file name indicates the name of the file in which the area is specified, and the range indicates the area range by line number.
- L901 has an area name R1 and a file name proc. c, indicating that the range is from line number 8 to line number 19. The same applies to the other L902 and L903.
- FIG. 17A shows an example in which text is input, where R1, R2, and R3 are region names, proc. c indicates a file name, and range indicates a range.
- FIG. 17B shows an example in which three regions R1, R2, and R3 are designated directly on the source program 11 by a mouse drag operation when designated by the mouse.
- the data dependence analysis support device 100 activates the inter-region dependency generation unit 210, and the inter-region dependency generation unit 210 performs inter-region comparison with the region obtained from the region designation information included in the user input information 41. Existing inter-region dependency information is generated (S90).
- inter-region dependency generation unit 210 the operation of the inter-region dependency generation unit 210 will be described in more detail.
- the inter-region dependency generation unit 210 reads the region information from the region designation information included in the user input information 41 (S91). As described above, FIG. 16C shows the area information.
- the inter-region dependency generation unit 210 extracts a sentence included in the region acquired in S91 (S92).
- the region R1 of L901 in FIG. 16 (c) is as follows. File proc.
- the sentences included in line number 8 to line number 19 of c are sentences 56 and 57 in FIG.
- the statements 100, 101, and 102 in FIG. 3C are also included in the region R1.
- the sentences included in the region R2 of L902 in FIG. 16C are the sentences 61, 65, and 66 in FIG. 3B and the sentences 100, 101, and 102 in FIG.
- the sentences included in the region R3 of L903 in FIG. 16C are the sentence 70 in FIG. 3B and the sentence 201 in FIG.
- the inter-region dependency generation unit 210 extracts inter-state dependency information in which the sentence extracted in S92 is a dependency source sentence and a dependency destination sentence (S93).
- the line of L704 in FIG. 14 has the dependency source as the sentence 57 and the dependency destination as the sentence 61, both of which are included in the sentence extracted in S92.
- the rows L705, L706, L707, L710, L711, L712, L713, and L714 in FIG. 14 are fetched.
- the inter-region dependency generation unit 210 includes, when the dependency source sentence of the inter-state dependency information including the sentence extracted in S93 is included in the region 1, and the dependency destination statement is included in the region 2, Inter-region dependency information from 1 to region 2 is generated (S94).
- FIG. 15 shows inter-region dependency information.
- the line L801 is generated from the line L704 in FIG. That is, the dependency source sentence of the line of L704 in FIG. 14 is the sentence 57 and is included in the area R1, and the dependency destination sentence is the sentence 61 and is included in the area R2.
- the inter-region dependency information obtained by extracting and further adding the region information is generated.
- the rows L802, L803, L804, and L805 are respectively generated from L705, L711, L707, and L709 in FIG.
- the line L706 in FIG. 14 is not extracted as inter-region dependency information because the sentence 61 that is the dependency source sentence and the sentence 66 that is the dependency destination sentence are both included in the same region R2.
- the data dependence analysis support device 100 activates the inter-region dependency display unit 212, and the inter-region dependency display unit 212 displays inter-region dependency information on the output device 50 (S100).
- FIG. 18 shows an example of the inter-region dependency display.
- FIG. 18A is a display example of inter-region dependency information in text.
- “From: R1, proc.c, 10-> To: R2, proc.c, 21: Cv: s” is the file proc. c from the line number 10 of the file proc. It is shown that the line number 21 of c has dependency due to the variable s.
- This information is obtained from the inter-region dependency information in FIG. 15 and the sentence information in FIG.
- the dependency source sentence is the sentence 57, and from the line L109 in FIG. 8, the file proc. c, the information of the line number 10 in FIG. 15c is extracted.
- the dependency destination sentence of L801 in FIG. 15 is read from the sentence 61, and the file proc. It is displayed by extracting the information of line number 21 of c.
- FIGS. 18B and 18C are examples of displaying inter-region dependency information on the source program 11.
- FIGS. 18B and 18C show examples of inter-region dependency display in the row of L803 in FIG.
- the dependency source sentence is the sentence 101.
- the dependency source file cmn A window displaying c is opened and the line number 10 is emphasized (FIG. 18B).
- a window displaying c is opened, and line number 21 is emphasized (FIG. 18C).
- the dependency source and the dependency destination files are the same, the line numbers of the dependency source and the dependency destination may be emphasized in the same window.
- the data dependence analysis support device 100 repeatedly executes S40 to S100 while there is no system termination request in the user input information 41 in S40.
- the data dependence analysis support apparatus 100 When the analysis target area is changed in S50, the data dependence analysis support apparatus 100 performs data flow analysis on the new analysis target area and calculates inter-area dependency information. At this time, since the pointer information generated in S30 is reused, the analysis time can be saved.
- the data dependence analysis support apparatus 100 proceeds to S80, and if the area is updated in S80, that is, for the same analysis target area, for different areas.
- the data flow information and the inter-sentence dependency information calculated in S60 and S70 are reused, so that the analysis time can be saved. That is, inter-region dependency information can be quickly displayed for various regions designated by the user.
- FIG. 19 shows an example in which the program of FIG. 3 is threaded in the OpenMP description format. As shown in FIG. 19A, three areas can be threaded by describing “#pragma omp section” in ST1, ST2, and ST3 in the program.
- buffer_x (x is s, e, or a) of ST4 in FIG. 19A is data provided for data exchange between threads for each cause variable x.
- buffer_s is data provided corresponding to the cause variable s in the rows of L801 and L802 in FIG.
- buffer_s_send (s) in the thread 1 of ST5 in FIG. 19A is to transmit the value of the variable s to buffer_s
- the operation of “buffer_s_receive (s)” in the thread 2 of ST6 is to receive a value from buffer_s to variable s. That is, buffer_s_send (s) and buffer_s_receive (s) are communication codes inserted between areas.
- variable s is declared as a variable local to each thread.
- the variable s is prepared for each thread, when executing the threads in parallel, a write contention from a plurality of threads to the variable s, or an illegal value reference by writing to the variable s from another thread. It is guaranteed that there is no.
- the other inter-region dependency information is also used for threading.
- Buffer. Of FIG. 19 (b). h is an example of a detailed program of the Buffer class that is a communication code. The user can use the buffer. h may be included as a header file, and a different header file is prepared for each source program 11 or the communication code “buffer_x_send (x)” or “buffer_x_receive (x)” (where x is a variable name) is inserted. There is no need to add code to the source program 11.
- the user can easily create a thread parallelized program based on the inter-region dependency information.
- the analysis target region information and the region designation information are extracted from the user input information 41 input from the input unit 40, but the present invention is not necessarily limited to this case. For example, it may be extracted from information such as annotations described in the source program 11, predetermined keywords, or specific symbols.
- FIG. 20 is an example in which the analysis target area information and the area designation information are described by “pragma” with respect to the source program 11 of FIG. ST11 in FIG. 20 is an example of analysis target area information.
- the entire function proc is an analysis target area.
- ST12, ST13, and ST14 in FIG. 20 are used to designate areas, and “#pragma region area name ⁇ . . . ⁇ Indicates that this is a threaded area having “area name”.
- the analysis target region is the entire function proc including all of the regions R1, R2, and R3 has been described, but the present invention is not necessarily limited to this case.
- the source program 11 and the regions R1, R2, and R3 in FIG. 3 “all the regions and all the control structures such as repetitions related to the regions” are included.
- the user may designate “row” as the analysis target area. By doing in this way, it is possible to prevent a sentence unrelated to the analysis of inter-region dependency information from being included in the analysis target area.
- the context of the sentence included in the analysis target area is 2 or 4, and the sentence of context 1 that is the caller of context 2 or 4 is not included in the analysis target area. It can be obtained that the identifiers of the vertex nodes of the subcall graph to be extracted are 2 and 4.
- the inter-sentence dependency information generation unit 210 generates all the dependency information in the analysis target region as inter-sentence dependency information, and the inter-region dependency information generation unit 212 calculates the inter-region dependency information
- the dependency information according to the above is generated as inter-region dependency information
- the present invention is not necessarily limited to this case.
- inter-sentence dependency information generation unit 210 there is no inter-sentence dependency information generation unit 210 and inter-sentence dependency information storage unit 211, and the inter-region dependency information generation unit 212 receives variable definition information from the definition information storage unit 223, and uses variable information from the use information storage unit 225, It is also possible to obtain the arrival definition information from the arrival definition information storage unit 227 and the area designation information included in the user input information 41 from the input device 40, and directly generate the inter-area dependency information.
- the inter-region dependency information includes a dependency source statement, a region where the dependency source statement exists, a dependency destination statement, a region where the dependency destination statement exists, and a cause variable.
- the present invention is not necessarily limited to this case.
- the inter-region dependency information may include only an area where a dependency source sentence exists, an area where a dependency destination sentence exists, and a cause variable. By doing so, it is possible to obtain information necessary and sufficient to generate a communication code for thread parallelizing the area.
- the pointer information combining unit 220 combines the pointer information held by the pointer information storage unit 205 and stores the combined pointer information in the combined pointer information storage unit 221 is described. It is not limited to the case.
- the pointer information combining unit 220 and the combined pointer information storage unit 221 are not provided, and the definition information generation unit 222, the usage information generation unit 224, and the arrival definition information generation unit 226 may obtain pointer information directly from the pointer information storage unit 205. Good.
- variables may be combined when generating definition information, storage information, and arrival definition information, or variables may be combined when generating inter-state dependency information or inter-region dependency information.
- a data dependency analysis support device is a data dependency analysis support device that performs context sensitive data dependency analysis on a source program, and performs all pointers used in the source program. , Specified to analyze the dependency of data that exists between two or more threaded areas that are part of the source program and a pointer information generator that performs context sensitive pointer analysis and generates pointer information
- a data flow information generation unit that performs context sensitive data flow analysis using the pointer information and generates data flow information, and the two or more threads using the data flow information.
- the data dependency analysis support program is a data dependency analysis support program that causes a computer to execute context sensitive data dependency analysis for a source program, and the context sensitive data dependency analysis is performed by the source program.
- Context sensitive pointer analysis is performed for all pointers used, and pointer information generation step for generating pointer information and a part of the source program, which exists between two or more threaded areas
- a data flow information generation step for generating data flow information by performing a context sensitive data flow analysis on the analysis target area designated for analyzing data dependence using the pointer information, and the data flow information
- the inter-area dependence information indicating the threading area of the dependence source, the threading area of the dependence destination, and the variable causing the dependence is obtained.
- An inter-region dependency information generation step to generate.
- the data dependency analysis support method is a data dependency analysis support method for performing context sensitive data dependency analysis for a source program, and for all pointers used in the source program,
- a pointer information generation step for performing pointer-sensitive pointer analysis, which is a correspondence information between a pointer and a variable indicated by the pointer, and a part of the source program between two or more threaded areas
- a data flow information generation step for generating data flow information by performing context sensitive data flow analysis on the analysis target area specified for analyzing existing data dependence using the pointer information, and the data Using flow information, the two or more threads
- An inter-region dependency information generation step for generating inter-region dependency information indicating a dependency source threading region, a dependency destination threading region, and a variable that is a cause of the dependence on the data dependency existing between the conversion regions; It is characterized by including.
- the data dependence analysis support device can shorten the analysis time by performing data flow analysis, which is a part of the data dependence analysis, only on the analysis target area, not the entire source program.
- data flow analysis which is a part of the data dependence analysis
- context sensitive analysis is performed for pointer analysis and data flow analysis, which are part of the data dependency analysis
- dependency information between threaded areas can be obtained with high accuracy, and high accuracy analysis and analysis time can be obtained. Both shortening becomes possible.
- the analysis target area includes all of the two or more threaded areas, and a single function and the single function It may be a set with a function called by.
- the data dependence analysis support device can prevent the analysis target area for obtaining the dependence information between the threaded areas from being insufficient for analyzing the threaded area, and the analysis. Since the target area can be specified by the function name, the analysis target area can be easily specified.
- the data flow information generation unit includes a single function including the analysis target area and a function called by the function.
- combined pointer information may be generated by combining the pointer information using the single function as one context.
- the data dependency analysis support device when the data dependence analysis support device performs the data flow analysis on the analysis target region, the data dependency analysis support device can call the function included in the analysis target region from outside the analysis target region.
- the data dependence analysis support device of (1) may further include an analysis target area specifying unit that receives input of information for specifying the analysis target area.
- the data dependence analysis support device does not need to acquire the source program again when the analysis target area is specified, and continuously performs the data dependence analysis on the same source program with a simple operation. Can do.
- the data dependence analysis support device of (1) may further include an area specifying unit that receives input of information for specifying the threaded area.
- the data dependence analysis support device can easily acquire only information related to the threaded area, and data dependence on the same analysis target area of the same source program with a simple operation. Analysis can be performed.
- the data dependence analysis support device of (1) may further include an inter-region dependence information output unit that outputs the inter-region dependence information.
- the data dependence analysis support device can present the result of the data dependence analysis to the user in a suitable method, and succeeds in supporting the parallelization of the source program.
- the data flow information generation unit is configured such that the pointer information generation unit holds pointer information for the same source program.
- the data flow information may be generated using the held pointer information.
- the inter-region dependence information generation unit holds data flow information for the same analysis target region by the data flow analysis unit. If there is, inter-region dependency information may be generated using the retained data flow information.
- the data dependency analysis support apparatus refers to context sensitive inter-region dependency information, performs parallelization of source programs at the region level, or refers to context sensitive data flow information to obtain a source program. Or can be used to implement improvements.
- data dependency analysis support device 10 external storage unit 11 source program 40 input unit 41 user input information 50 output unit 200 intermediate program generation unit 201 intermediate program storage unit 202 call graph generation unit 203 call graph storage unit 204 pointer analysis unit 205 pointer information Storage unit 206 Data flow analysis unit 207 Data flow information storage unit 208 Inter-sentence dependency analysis unit 209 Inter-sentence dependency information storage unit 210 Inter-region dependency generation unit 211 Inter-region dependency information storage unit 212 Inter-region dependency display unit 220 Pointer information combination unit 221 combined pointer information storage unit 222 definition information generation unit 223 definition information storage unit 224 use information generation unit 225 use information storage unit 226 arrival definition information generation unit 227 arrival definition information storage unit
Landscapes
- Engineering & Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
- Devices For Executing Special Programs (AREA)
Abstract
Description
シーケンシャルプログラムをソースプログラムとしてスレッド並列化プログラムを開発するためには、シーケンシャルプログラムにおいてスレッド並列化を行おうとする領域のデータ依存解析を行う必要がある。特に、データ依存をスレッド間の通信コードによって解決する並列化(パイプライン化)を行うにあたって、不必要な通信コードを挿入しないために、精度の高いデータ依存解析を行うことが望ましい。
ここで、シーケンシャルプログラムのデータ依存解析およびスレッド並列化の、一般的な手順について説明する。シーケンシャルプログラムがC言語やC++言語で記述されている場合、スレッド化領域間のデータ依存解析を行う解析装置は、次の手順で解析を行う。
コンテキストセンシティブな解析とは、非特許文献1の第12章にあるような、同じ関数の呼び出しであっても、各々の関数呼び出しの状況に応じた解析を行うことである。つまり、ポインタ解析、データフロー解析および文間のデータ依存解析を各々の関数呼び出し毎に、すなわち、同一の関数の呼び出しでも個々の関数呼び出し毎に、呼び出し先の関数まで含めて解析することである。したがって、着目している領域の全体に渡って解析を行うだけでなく、当該領域内で同一関数が複数個所で呼び出されている場合は、呼び出し毎に何度も同一の関数に関して解析を行う。なお、呼び出される関数がさらに関数を呼び出している場合についても同様に、個々の関数の呼び出し毎に、呼び出し先の関数まで含めて解析する。
まず、コンテキストセンシティブでないポインタ解析について説明する。解析装置は、プログラム中の関数funを呼び出している文を検索し、仮引数であるポインタpに引き渡される値を収集する。解析装置は、文57と文66から、ポインタpに引き渡される値として、変数eおよび変数fのアドレスを収集する。
コンテキストセンシティブな解析においては、解析装置は、文57からの関数funの呼び出しと、文66からの関数funの呼び出しを区別する。
上記解析手順によって得られた結果を基に、コンテキストセンシティブな解析とコンテキストセンシティブでない解析とを比較する。
以下、本発明の実施の形態について、図面を使用しながら説明する。まず、本発明の実施の形態の説明にあたり、理解の容易のため、用語について説明する。
・コンテキストセンシティブなコールグラフ
コンテキストセンシティブなコールグラフ(以下、単純にコールグラフと言う)とは、各々の関数呼び出し毎にノードが生成され、呼び出す関数のノードから、呼び出される関数のノードへ有向辺を引いたグラフである。ノードは、ノード識別子と、呼び出し関数名と、関数呼び出し文の文識別子とを持つ。
・サブコールグラフ
コールグラフにおいて、あるノードに着目した時、着目しているノード以下(有向辺の向く方向)のグラフをサブコールグラフと言う。また、着目しているノードをサブグラフの頂点ノードと言う。例えば、図4では、ノード識別子が2のノードを頂点ノードとするサブコールグラフは、ノード識別子が2、6、7、8と、それ以下のノードとそれを結ぶ有向辺となる。
・コンテキスト情報付き文
コンテキスト情報付き文とは、同一の関数が複数の箇所から呼び出されるとき、呼出し毎に異なる文であることを表現するものである。コンテキスト情報付き文により、コンテキストセンシティブなデータフローの解析が可能となる。例えば、図3(a)において、関数procは文25および文27の2ヶ所から呼ばれており、それぞれの呼び出しは図4のコールグラフではノードの識別子2と4に対応している。つまり、図3(a)において、関数procの呼び出し文25のコンテキストは2、文27のコンテキストは4となる。
図1は、実施の形態に係るデータ依存解析支援装置100の構成を示すブロック図である。
(1)領域指定情報のファイル名と領域内の開始行番号から領域の終了行番号の範囲内に存在する文A。
(2)文Aが関数Fの関数呼び出し文である場合は、関数F中に存在する文B。
(3)文Aが関数Fの関数呼び出し文である場合は、関数Fの呼び出しによって呼び出される可能性のある全ての関数の中に存在する文C。
以下では、データ依存解析支援装置100の動作を説明する。
以下では、図1のソースプログラム11が図3に示すプログラムである場合のデータ依存解析支援装置100の動作を、図5から図7に示すフローチャートを用いて説明する。
解析対象領域情報を図16(b)に示す。ここでは、ファイル名proc.cのファイルの行番号1に存在する関数名proc関数全体を解析対象領域として指定している。
前述したように、データ依存解析支援装置100により、図3のソースプログラム11に対して、図17に示した領域を設定した場合は、図18の示した領域間依存情報が得られる。以下では、得られた領域間依存情報の有用性を示すために、図3のソースプログラム11のスレッド化の例について説明する。
以上、本発明に係るデータ依存解析支援装置を、実施の形態に基づいて説明したが、本発明は上述した実施の形態のみに限定されないことは勿論である。
<まとめ>
以下に、実施の形態に係るデータ依存解析支援装置とデータ依存解析支援プログラム、およびデータ依存解析支援方法の構成および効果について説明する。
10 外部記憶部
11 ソースプログラム
40 入力部
41 ユーザ入力情報
50 出力部
200 中間プログラム生成部
201 中間プログラム記憶部
202 コールグラフ生成部
203 コールグラフ記憶部
204 ポインタ解析部
205 ポインタ情報記憶部
206 データフロー解析部
207 データフロー情報記憶部
208 文間依存解析部
209 文間依存情報記憶部
210 領域間依存生成部
211 領域間依存情報記憶部
212 領域間依存表示部
220 ポインタ情報結合部
221 結合ポインタ情報記憶部
222 定義情報生成部
223 定義情報記憶部
224 使用情報生成部
225 使用情報記憶部
226 到達定義情報生成部
227 到達定義情報記憶部
Claims (10)
- ソースプログラムに対してコンテキストセンシティブなデータ依存解析を行うデータ依存解析支援装置であって、
前記ソースプログラムで使用される全てのポインタに対して、コンテキストセンシティブなポインタ解析を行い、ポインタ情報を生成するポインタ情報生成部と、
前記ソースプログラムの一部であって、2以上のスレッド化領域の間に存在するデータ依存を解析するために指定される解析対象領域に対して、前記ポインタ情報を用いて、コンテキストセンシティブなデータフロー解析を行い、データフロー情報を生成するデータフロー情報生成部と、
前記データフロー情報を用いて、前記2以上のスレッド化領域の間に存在するデータ依存について、依存元のスレッド化領域と、依存先のスレッド化領域と、依存の原因である変数とを示す領域間依存情報を生成する領域間依存情報生成部と
を備えることを特徴とするデータ依存解析支援装置。 - 前記解析対象領域は、前記2以上のスレッド化領域の全てを含む、単一の関数と前記単一の関数により呼び出される関数との集合である
ことを特徴とする請求項1記載のデータ依存解析支援装置。 - 前記データフロー情報生成部は、
前記解析対象領域を含む単一の関数と、前記関数より呼び出される関数とで使用されるポインタについて、前記単一の関数を1つのコンテキストとして前記ポインタ情報を結合し結合ポインタ情報を生成する
ことを特徴とする請求項1記載のデータ依存解析支援装置。 - 前記解析対象領域を指定するための情報の入力を受け付ける解析対象領域指定部
をさらに備えることを特徴とする請求項1記載のデータ依存解析支援装置。 - 前記スレッド化領域を指定するための情報の入力を受け付ける領域指定部
をさらに備えることを特徴とする請求項1記載のデータ依存解析支援装置。 - 前記領域間依存情報を出力する領域間依存情報出力部
をさらに備えることを特徴とする請求項1記載のデータ依存解析支援装置。 - 前記データフロー情報生成部は、
前記ポインタ情報生成部が同一のソースプログラムに対するポインタ情報を保持している場合に、前記保持されているポインタ情報を用いてデータフロー情報を生成する
ことを特徴とする請求項1記載のデータ依存解析支援装置。 - 前記領域間依存情報生成部は、
前記データフロー解析部が同一の解析対象領域に対するデータフロー情報を保持している場合に、前記保持されているデータフロー情報を用いて領域間依存情報を生成する
ことを特徴とする請求項1記載のデータ依存解析支援装置。 - ソースプログラムに対するコンテキストセンシティブなデータ依存解析をコンピュータに実行させるデータ依存解析支援プログラムであって、
前記コンテキストセンシティブなデータ依存解析は、
前記ソースプログラムで使用される全てのポインタに対して、コンテキストセンシティブなポインタ解析を行い、ポインタ情報を生成するポインタ情報生成ステップと、
前記ソースプログラムの一部であって、2以上のスレッド化領域の間に存在するデータ依存を解析するために指定される解析対象領域に対して、前記ポインタ情報を用いて、コンテキストセンシティブなデータフロー解析を行い、データフロー情報を生成するデータフロー情報生成ステップと、
前記データフロー情報を用いて、前記2以上のスレッド化領域の間に存在するデータ依存について、依存元のスレッド化領域と、依存先のスレッド化領域と、依存の原因である変数とを示す領域間依存情報を生成する領域間依存情報生成ステップと
を含むことを特徴とするデータ依存解析支援プログラム。 - ソースプログラムに対してコンテキストセンシティブなデータ依存解析を行うデータ依存解析支援方法であって、
前記ソースプログラムで使用される全てのポインタに対して、コンテキストセンシティブなポインタ解析を行い、ポインタとポインタが指し示す変数との対応情報であるポインタ情報を生成するポインタ情報生成ステップと、
前記ソースプログラムの一部であって、2以上のスレッド化領域の間に存在するデータ依存を解析するために指定される解析対象領域に対して、前記ポインタ情報を用いて、コンテキストセンシティブなデータフロー解析を行い、データフロー情報を生成するデータフロー情報生成ステップと、
前記データフロー情報を用いて、前記2以上のスレッド化領域の間に存在するデータ依存について、依存元のスレッド化領域と、依存先のスレッド化領域と、依存の原因である変数とを示す領域間依存情報を生成する領域間依存情報生成ステップと
を含むことを特徴とするデータ依存解析支援方法。
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2012800026049A CN103314360A (zh) | 2012-01-13 | 2012-09-28 | 数据依赖解析辅助装置、数据依赖解析辅助程序以及数据依赖解析辅助方法 |
US13/813,836 US20140096117A1 (en) | 2012-01-13 | 2012-09-28 | Data dependence analysis support device, data dependence analysis support program, and data dependence analysis support method |
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2012-005449 | 2012-01-13 | ||
JP2012005449 | 2012-01-13 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2013105158A1 true WO2013105158A1 (ja) | 2013-07-18 |
Family
ID=48781137
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/JP2012/006223 WO2013105158A1 (ja) | 2012-01-13 | 2012-09-28 | データ依存解析支援装置、データ依存解析支援プログラム、及びデータ依存解析支援方法 |
Country Status (4)
Country | Link |
---|---|
US (1) | US20140096117A1 (ja) |
JP (1) | JPWO2013105158A1 (ja) |
CN (1) | CN103314360A (ja) |
WO (1) | WO2013105158A1 (ja) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2017107448A (ja) * | 2015-12-10 | 2017-06-15 | 株式会社デンソー | 並列化方法、並列化ツール、車載装置 |
JP2017536612A (ja) * | 2014-10-17 | 2017-12-07 | クアルコム,インコーポレイテッド | ハードウェアフロー制御のためのコードポインタ認証 |
Families Citing this family (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US10061591B2 (en) * | 2014-06-27 | 2018-08-28 | Samsung Electronics Company, Ltd. | Redundancy elimination in single instruction multiple data/thread (SIMD/T) execution processing |
CN105335230A (zh) * | 2014-07-30 | 2016-02-17 | 阿里巴巴集团控股有限公司 | 一种服务处理方法及装置 |
US9367425B1 (en) | 2015-09-30 | 2016-06-14 | Semmle Limited | Disjoint-or trees for caching aggregated dependencies |
US10671361B2 (en) * | 2016-10-25 | 2020-06-02 | Paypal, Inc. | Automatically determining data dependencies to facilitate code execution |
CN109358846B (zh) * | 2018-09-19 | 2019-09-27 | 深圳大学 | 一种基于c语言的语法扩展方法、装置及终端设备 |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2003036170A (ja) * | 2001-07-25 | 2003-02-07 | Toshiba Corp | クロスリファレンス構築装置、クロスリファレンス構築方法及びクロスリファレンス構築用プログラム |
JP2007193423A (ja) * | 2006-01-17 | 2007-08-02 | Tokyo Institute Of Technology | プログラム処理装置、並列処理プログラム、プログラム処理方法、並列処理コンパイラおよび並列処理コンパイラを格納した記録媒体 |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20020010911A1 (en) * | 2000-02-16 | 2002-01-24 | Ben-Chung Cheng | Compile time pointer analysis algorithm statement of government interest |
JP4923240B2 (ja) * | 2006-01-17 | 2012-04-25 | 国立大学法人東京工業大学 | プログラム処理装置、並列処理プログラム、プログラム処理方法、並列処理コンパイラ、並列処理コンパイラを格納した記録媒体およびマルチプロセッサシステム |
US8539450B2 (en) * | 2009-03-11 | 2013-09-17 | Nec Laboratories America, Inc. | Fast and accurate data race detection for concurrent programs with asynchronous calls |
US8473927B2 (en) * | 2011-05-26 | 2013-06-25 | Oracle International Corporation | Points-to analysis using value flow |
-
2012
- 2012-09-28 US US13/813,836 patent/US20140096117A1/en not_active Abandoned
- 2012-09-28 JP JP2013502941A patent/JPWO2013105158A1/ja active Pending
- 2012-09-28 CN CN2012800026049A patent/CN103314360A/zh active Pending
- 2012-09-28 WO PCT/JP2012/006223 patent/WO2013105158A1/ja active Application Filing
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2003036170A (ja) * | 2001-07-25 | 2003-02-07 | Toshiba Corp | クロスリファレンス構築装置、クロスリファレンス構築方法及びクロスリファレンス構築用プログラム |
JP2007193423A (ja) * | 2006-01-17 | 2007-08-02 | Tokyo Institute Of Technology | プログラム処理装置、並列処理プログラム、プログラム処理方法、並列処理コンパイラおよび並列処理コンパイラを格納した記録媒体 |
Non-Patent Citations (1)
Title |
---|
A.V. EIHO ET AL., COMPILER [2ND EDITION] GENRI.GIHO.TOOL, SAIENSU-SHA CO., LTD., 25 May 2009 (2009-05-25), pages 974 * |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2017536612A (ja) * | 2014-10-17 | 2017-12-07 | クアルコム,インコーポレイテッド | ハードウェアフロー制御のためのコードポインタ認証 |
JP2017107448A (ja) * | 2015-12-10 | 2017-06-15 | 株式会社デンソー | 並列化方法、並列化ツール、車載装置 |
Also Published As
Publication number | Publication date |
---|---|
CN103314360A (zh) | 2013-09-18 |
US20140096117A1 (en) | 2014-04-03 |
JPWO2013105158A1 (ja) | 2015-05-11 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2013105158A1 (ja) | データ依存解析支援装置、データ依存解析支援プログラム、及びデータ依存解析支援方法 | |
US9122539B2 (en) | Methods and systems for forming an adjusted perform range | |
JP4339907B2 (ja) | マルチプロセッサ向け最適コード生成方法及びコンパイル装置 | |
US7882498B2 (en) | Method, system, and program of a compiler to parallelize source code | |
EP3066560B1 (en) | A data processing apparatus and method for scheduling sets of threads on parallel processing lanes | |
JP5148674B2 (ja) | プログラム並列化装置およびプログラム | |
JP2010039536A (ja) | プログラム変換装置、プログラム変換方法およびプログラム変換プログラム | |
US20190079805A1 (en) | Execution node selection method and information processing apparatus | |
US10802806B1 (en) | Generating vectorized control flow using reconverging control flow graphs | |
TW201232405A (en) | Speculative compilation to generate advice messages | |
JP2009524866A (ja) | プログラムの並列実行のためのシステム及び方法 | |
JP2014513372A (ja) | 高度並行処理タスクの登録及び実行 | |
KR20130137652A (ko) | 확장 가능한 데이터 병렬 시맨틱스 | |
JP5178852B2 (ja) | 情報処理装置およびプログラム | |
CN112346730B (zh) | 一种中间表示的生成方法、计算机设备及存储介质 | |
JP2015094960A (ja) | 情報処理装置、コンパイル方法およびコンパイラプログラム | |
US11455153B2 (en) | Dynamic instances semantics | |
JP4830108B2 (ja) | プログラム処理装置、プログラム処理方法、並列処理プログラム用コンパイラおよび並列処理プログラム用コンパイラを格納した記録媒体 | |
US10089088B2 (en) | Computer that performs compiling, compiler program, and link program | |
US11262989B2 (en) | Automatic generation of efficient vector code with low overhead in a time-efficient manner independent of vector width | |
US11226798B2 (en) | Information processing device and information processing method | |
Fritsche et al. | A Look-Ahead Strategy for Rule-Based Model Transformations. | |
CN108920149B (zh) | 编译方法和编译装置 | |
JP2016012343A (ja) | 自動抽象化を有するシンボリック実行 | |
KR101632027B1 (ko) | 주석기반의 의사코드를 이용한 프로그램 변환 방법 및 그 방법을 구현하기 위한 프로그램이 기록된 컴퓨터 판독 가능한 기록매체 |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
ENP | Entry into the national phase |
Ref document number: 2013502941 Country of ref document: JP Kind code of ref document: A |
|
WWE | Wipo information: entry into national phase |
Ref document number: 13813836 Country of ref document: US |
|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 12864807 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 12864807 Country of ref document: EP Kind code of ref document: A1 |