Creating multiple versions for interior pointers and alignment of an array
AssigneeAdvanced Micro Devices, Inc.
InventorsTim J. Wilkens, Michael C. Berg
Life of this patent
Estimating the term…
Abstract
A device identifies array accesses of variables in a program code that includes multiple arrays, and identifies array access patterns for one of the array accesses. The device also determines an order of the array access patterns identified for the array accesses, and calculates, based on the order, distances between the array access patterns. The device further shares address calculations amongst the array accesses associated with array access patterns with one or more of the distances that are equivalent.
Claims20
A method, comprising:
- identifying, by a device, array accesses of a plurality of variables in a program code,
- the program code including a plurality of arrays,
- each variable, of the plurality of variables, being included in a different array of the plurality of arrays;
- identifying, by the device and based on the array accesses, array access patterns for each variable of the plurality of variables;
- determining, by the device, an order of the array access patterns identified for each variable of the plurality of variables;
- calculating, by the device and based on the order, a plurality of distances between the array access patterns identified for each variable of the plurality of variables;
- identifying, by the device and for each variable of the plurality of variables, one or more distances, of the plurality of distances, that are equivalent;
- and
- sharing, by the device and for each array of the plurality of arrays, address calculations for one or more of the array accesses associated with the one or more distances that are equivalent.
A compiler of a device, the compiler comprising:
- processing logic, implemented at least partially in hardware, to:
- identify array accesses of a plurality of variables in a program code,
- the program code including a plurality of arrays,
- each variable, of the plurality of variables, being included in a different array of the plurality of arrays,
- identify, based on the array accesses, array access patterns for each variable of the plurality of variables;
- determine an order of the array access patterns identified for each variable of the plurality of variables;
- calculate, based on the order, a plurality of distances between the array access patterns identified for each variable of the plurality of variables;
- share, for each array of the plurality of arrays, address calculations for one or more of the array accesses associated with one or more distances, of the plurality distances, that are equivalent, and
- create a compiled version of the program code that includes the shared address calculations.
A method, comprising:
- identifying, by a device, array access patterns in a program code that includes multiple arrays;
- grouping, by the device, the array access patterns for a set of variables of the multiple arrays to obtain a plurality of groups of array access patterns;
- testing, by the device, an alignment for each group of array access patterns of the plurality of groups of array access patterns;
- determining, by the device and based on testing the alignment for each group of array access patterns of the plurality of groups of array access patterns, that a particular group of array access patterns, of the plurality of groups of array access patterns, includes a shared alignment;
- determining, by the device, whether the particular group of array access patterns includes a fully aligned portion of the program code after determining that the particular group of array access patterns includes the shared alignment;
- removing, by the device, a single iteration from a partially aligned portion of the program code to produce another fully aligned portion of the program code when the particular group of array access patterns includes the partially aligned portion of the program code;
- and
- selectively executing, by the device, the program code with the fully aligned portion of the program code or executing the program code with the other fully aligned portion of the program code.
A compiler of a device, the compiler comprising:
- processing logic, implemented at least partially in hardware, to:
- identify array access patterns in a program code that includes multiple arrays,
- group the array access patterns for a set of variables of the multiple arrays,
- test an alignment for each group of the array access patterns,
- determine, based on testing the alignment for each group of the array access patterns, whether a particular group of the array access patterns includes a shared alignment or an unshared alignment,
- determine whether the particular group of the array access patterns includes a fully aligned portion of the program code when the particular group of the array access patterns includes the shared alignment, and
- selectively:
- execute the program code, with an unaligned portion of the program code associated with the particular group of the array access patterns, to create a first compiled version of the program code, when the particular group of the array access patterns includes the unshared alignment, or
- execute the program code, with the fully aligned portion of the program code, to create a second compiled version of the program code, when the particular group of the array access patterns includes the fully aligned portion of the program code.
Dependencies are inferred from the claim text.