CPC G06F 9/30087 (2013.01) [G06F 8/433 (2013.01); G06F 9/3838 (2013.01)] | 19 Claims |
1. A synchronization instruction insertion method, comprising:
obtaining a first program block comprising one or more statements, wherein each of the one or more statements comprises one or more function instructions;
determining a first function instruction and a second function instruction between which data dependency exists in the first program block;
inserting a synchronization instruction pair between a first statement comprising the first function instruction and a second statement comprising the second function instruction;
indicating, by using a first synchronization path graph, a directed dependency relationship between synchronized function instructions;
determining a third function instruction and a fourth function instruction between which data dependency exists in the first program block;
determining that a synchronization path from a node corresponding to the third function instruction to a node corresponding to the fourth function instruction is unreachable in the first synchronization path graph; and
in response to determining that the synchronization path from the node corresponding to the third function instruction to the node corresponding to the fourth function instruction is unreachable in the first synchronization path graph, inserting a synchronization instruction pair between a third statement comprising the third function instruction and a fourth statement comprising the fourth function instruction.
|