Efficient generation of SIMD code in presence of multi-threading and other false sharing conditions and in machines having memory protection support
First Claim
1. A computer implemented method for automatically generating SIMD code, comprising:
- analyzing, by a processing unit, data to be accessed by a targeted loop, the targeted loop comprising at least one statement, each at least one statement having at least one memory reference, to determine whether memory accesses are both memory protection system safe and false sharing safe;
responsive to a determination that memory accesses are both memory protection system safe and false sharing safe, simdizing the targeted loop;
responsive to a determination that memory accesses are not both memory protection system safe and false sharing safe, determining whether a scheme can be applied in which safety does not need to be guaranteed;
responsive to a determination that a scheme in which safety does not need to be guaranteed can be applied, applying the scheme and simdizing the targeted loop according to the applied scheme;
responsive to a determination that a scheme in which safety does not need to be guaranteed cannot be applied, determining whether padding is appropriate;
responsive to a determination that padding is appropriate, padding the data and simdizing the targeted loop; and
responsive to a determination that padding is not appropriate, generating non-simdized code based on the targeted loop for handling boundary conditions, simdizing the targeted loop, and combining the simdized targeted loop with the non-simdized code.
2 Assignments
0 Petitions
Accused Products
Abstract
A computer implemented method, system and computer program product for automatically generating SIMD code. The method begins by analyzing data to be accessed by a targeted loop including at least one statement, where each statement has at least one memory reference, to determine if memory accesses are safe. If memory accesses are safe, the targeted loop is simdized. If not safe, it is determined if a scheme can be applied in which safety need not be guaranteed. If such a scheme can be applied, the targeted loop is simdized according to the scheme. If such a scheme cannot be applied, it is determined if padding is appropriate. If padding is appropriate, the data is padded and the targeted loop is simdized. If padding is not appropriate, non-simdized code is generated based on the targeted loop for handling boundary conditions, the targeted loop is simdized and combined with the non-simdized code.
33 Citations
21 Claims
-
1. A computer implemented method for automatically generating SIMD code, comprising:
-
analyzing, by a processing unit, data to be accessed by a targeted loop, the targeted loop comprising at least one statement, each at least one statement having at least one memory reference, to determine whether memory accesses are both memory protection system safe and false sharing safe; responsive to a determination that memory accesses are both memory protection system safe and false sharing safe, simdizing the targeted loop; responsive to a determination that memory accesses are not both memory protection system safe and false sharing safe, determining whether a scheme can be applied in which safety does not need to be guaranteed; responsive to a determination that a scheme in which safety does not need to be guaranteed can be applied, applying the scheme and simdizing the targeted loop according to the applied scheme; responsive to a determination that a scheme in which safety does not need to be guaranteed cannot be applied, determining whether padding is appropriate; responsive to a determination that padding is appropriate, padding the data and simdizing the targeted loop; and responsive to a determination that padding is not appropriate, generating non-simdized code based on the targeted loop for handling boundary conditions, simdizing the targeted loop, and combining the simdized targeted loop with the non-simdized code. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10)
-
-
11. A computer program product, comprising:
-
a computer readable storage medium storing computer usable program code configured for automatically generating SIMD code, the computer usable program code comprising; computer usable program code configured for analyzing data to be accessed by a targeted loop, the targeted loop comprising at least one statement, each at least one statement having at least one memory reference, to determine whether memory accesses are both memory protection system safe and false sharing safe; computer usable program code configured for simdizing the targeted loop in response to a determination that memory accesses are both memory protection system safe and false sharing safe; computer usable program code configured for determining whether a scheme can be applied in which safety does not need to be guaranteed in response to a determination that memory accesses are not both memory protection system safe and false sharing safe; computer usable program code configured for applying the scheme and simdizing the targeted loop according to the applied scheme in response to a determination that a scheme in which safety does not need to be guaranteed can be applied; computer usable program code configured for determining whether padding is appropriate in response to a determination that a scheme in which safety does not need to be guaranteed cannot be applied; computer usable program code configured for padding the data and simdizing the targeted loop in response to a determination that padding is appropriate; and computer usable program code configured for generating non-simdized code based on the targeted loop for handling boundary conditions, simdizing the targeted loop, and combining the simdized targeted loop with the non-simdized code, in response to a determination that padding is not appropriate. - View Dependent Claims (12, 13, 14, 15, 16, 17, 18, 19, 20)
-
-
21. A system for automatically generating SIMD code, comprising:
-
a processing unit for analyzing data to be accessed by a targeted loop comprising at least one statement, each at least one statement having at least one memory reference; a simdizer for simdizing the targeted loop, wherein the simdizer simdizes the target loop in response to a determination by the processing unit that memory accesses are both memory protection system safe and false sharing safe; wherein, responsive to a determination by processing unit that memory accesses are not both memory protection system safe and false sharing safe, the processing unit determines whether a scheme can be applied in which safety does not need to be guaranteed; wherein, responsive to a determination by the processing unit that a scheme in which safety does not need to be guaranteed can be applied, the simdizer simdizes the targeted loop according to the scheme; wherein, responsive to a determination by the processing unit that a scheme in which safety does not need to be guaranteed cannot be applied, the processing unit determines whether padding is appropriate; a padding mechanism, responsive to a determination by the processing unit that padding is appropriate, for padding the data, wherein the simdizer simdizes the targeted loop in response to application of padding; a code generator, wherein responsive to a determination by the processing unit that padding is not appropriate, the code generator generates non-simdized code based on the targeted loop for handling boundary conditions, and wherein the simdizer simdizes the targeted loop; and a combining mechanism for combining the simdized targeted loop with the non-simdized code in response to generation of the non-simdized code and to the simdizer simdizing the targeted loop.
-
Specification