A method for implementing shadow versioning to improve data dependence analysis for instruction scheduling in compiling code, and to identify loops within the code to be compiled, for each loop initializing a dependence a matrix, for each loop shadow identifying symbols that are accessed by the loop, examining dependencies, storing, comparing and classifying the dependence vectors, generating new shadow symbols, replacing the old shadow symbols with the new shadow symbols, generating alias relationships between the newly created shadow symbols, scheduling instructions and compiling the code.
Legal claims defining the scope of protection, as filed with the USPTO.
1. A method for implementing shadow versioning to improve data dependence analysis for instruction scheduling in compiling code, the method comprising: in a processor: identifying a plurality of loops within the code; for each loop of the plurality of loops: identifying an original shadow symbol accessed in the loop; initializing a dependence matrix having N rows and N columns for N accesses to the original shadow symbol in the loop, wherein an ith row vector represents a dependence relationship between the ith access to the shadow symbol and all the accesses to the same shadow in the loop; for each original shadow symbol accessed in the loop, performing: examining dependencies between an access pair X, Y to the original shadow symbol; storing dependence vectors for a given access in the dependence matrix as N row vectors, wherein the dependence matrix has two possible values, no-dependence and dependence, and wherein all diagonal matrix elements have the dependence value, and wherein each N row vectors is a dependence vector for access; comparing the dependence vectors; classifying the dependence vectors into an X-set and a Y-set based on the access pairs X, Y, wherein accesses in a common set includes common dependence vectors; generating a new shadow symbol for each set; replacing the original shadow symbol with the new shadow symbol for a corresponding access in the code, by examining dependencies of the corresponding access in the code, wherein the corresponding access is an element of an N×N dependence matrix and replacing the original shadow symbol with the new shadow symbol that shares a common dependency vector from the dependence matrix; generating alias relationships between the newly created shadow symbols; performing instruction scheduling for the code; and compiling the code.
2. The method as claimed in claim 1 further comprising: in the processor: assigning a no-dependence value to a dependence vector having an absence of a dependence between the access pairs X, Y; and assigning a dependence value to a dependence vector having a dependence between the access pairs X, Y.
3. The method as claimed in claim 2 , wherein generating alias relationships between the newly created shadow symbols, comprises: in the processor: aliasing two new shadow symbols based on an original dependence of corresponding original symbols in the X-set and the Y-set, wherein a pair of newly created shadow symbols does not alias each other in response to an absence of a dependence relationship between original symbols in the X-set and the Y-set; and marking the pair of newly created shadow symbols having the absence of the dependence relationship between original symbols in the X-set and the Y-set, as not aliased.
4. The method as claimed in claim 3 further comprising: in the processor: recovering the dependence information to check the alias relationship between the new shadow symbols; and reordering a set of instructions associated with the new shadow symbols marked as not-aliased.
5. A system for implementing shadow versioning to improve data dependence analysis for instruction scheduling in compiling code, the system comprising: a processor coupled to a memory; a process residing in the memory having instructions for: identifying a plurality of loops within the code; for each loop of the plurality of loops: identifying an original shadow symbol accessed in the loop; initializing a dependence matrix having N rows and N columns for N accesses to the original shadow symbol in the loop, wherein an ith row vector represents a dependence relationship between the ith access to the shadow symbol and all the accesses to the same shadow in the loop; for each original shadow symbol accessed in the loop, performing: examining dependencies between an access pair X, Y to the original shadow symbol; assigning a no-dependence value to a dependence vector having an absence of a dependence between the access pairs X, Y; assigning a dependence value to a dependence vector having a dependence between the access pairs X, Y; storing dependence vectors for a given access in the dependence matrix as N row vectors, wherein the dependence matrix has two possible values, no-dependence and dependence, and wherein all diagonal matrix elements have the dependence value, and wherein each N row vectors is a dependence vector for access; comparing the dependence vectors; classifying the dependence vectors into an X-set and a Y-set based on the access pairs X, Y, wherein accesses in a common set includes common dependence vectors; generating a new shadow symbol for each set; replacing the original shadow symbol with the new shadow symbol for a corresponding access in the code, by examining dependencies of the corresponding access in the code, wherein the corresponding access is an element of an N×N dependence matrix and replacing the original shadow symbol with the new shadow symbol that shares a common dependency vector from the dependence matrix; aliasing two new shadow symbols based on an original dependence of corresponding original symbols in the X-set and the Y-set, wherein a pair of newly created shadow symbols does not alias each other in response to an absence of a dependence relationship between original symbols in the X-set and the Y-set; marking the pair of newly created shadow symbols having the absence of the dependence relationship between original symbols in the X-set and the Y-set, as not aliased; recovering the dependence information by checking the alias relationship between the new shadow symbols; reordering a set of instructions associated with the new shadow symbols marked as not-aliased; and performing instruction scheduling for the code.
Cooperative Patent Classification codes for this invention. Click any code to explore related patents in that topic.
August 29, 2007
January 3, 2012
Browse 5M+ US patents with plain-English claim translations and AI-generated analysis.