Legal claims defining the scope of protection, as filed with the USPTO.
1. A method for detecting false sharing, the method comprising: running code on a plurality of cores, wherein the code comprises a first instrumentation, and wherein running the code on the plurality of cores comprises: fetching, by a first core of the plurality of cores from a main memory, a first cache line; storing the first cache line in a first cache of a plurality of cache lines; fetching, by a second core of the plurality of cores from the main memory, a second cache line; and storing the second cache line in a second cache of the plurality of cache lines; tracking cache invalidations in the code while running the code to produce tracked invalidations in accordance with the first instrumentation, wherein tracking the cache invalidations comprises: tracking a number of write accesses to the plurality of cache lines; determining whether to track cache accesses to the plurality of cache lines in accordance with the number of write accesses; and tracking cache accesses to the plurality of cache lines by a plurality of tasks in response to determining to track cache accesses; and reporting false sharing in accordance with the tracked invalidations to produce a false sharing report.
2. The method of claim 1 , further comprising inserting a second instrumentation into the code.
3. The method of claim 1 , wherein reporting the false sharing comprises reporting a name of a global variable, an address of the global variable, and a size of the global variable.
4. The method of claim 1 , wherein reporting the false sharing comprises reporting a callsite stack for an allocation of a heap object, an address of the heap object, and a size of the heap object.
5. The method of claim 1 , wherein reporting the false sharing comprises reporting a plurality of words of a cache line of the plurality of cache lines, a first task of the plurality of tasks, and a second task of the plurality of tasks, wherein the first task accesses a first word of the cache line and the second task accesses a second word of the cache line.
6. The method of claim 1 , further comprising diagnosing the false sharing in accordance with the false sharing report.
7. The method of claim 1 , wherein reporting the false sharing comprises determining whether an invalidation of the tracked invalidations indicates false or true sharing.
8. The method of claim 1 , wherein reporting the false sharing comprises examining metadata corresponding to a cache line of the plurality of cache lines.
9. The method of claim 1 , determining whether to track cache accesses to the plurality of cache lines comprises: comparing the number of write accesses to a threshold; and determining to track cache accesses to the plurality of cache lines in response to determining that the number of write accesses is greater than the threshold.
10. The method of claim 1 , wherein tracking the cache invalidations comprises sampling cache accesses.
11. The method of claim 1 , wherein tracking the cache invalidations comprises: performing an access having an access thread identification number (ID) to a word of a cache line of the plurality of cache lines; determining whether the access is a read access or a write access; determining whether the access thread ID is the same as a table thread ID of a table; and recording an invalidation when the access is a write access and the access thread ID is not the same as the table thread ID.
12. The method of claim 11 , further comprising: determining whether the table is full; and recording the access when the access is a write access or is a read access, the table is not full, and the table thread ID is not the same as the table thread ID.
13. The method of claim 12 , wherein recording the access comprises: recording whether the access is a read access or a write access; and recording the access thread ID.
14. The method of claim 11 , further comprising cleaning up the table when the access is a write access and the table is full, or when the access thread ID is the same as the table thread ID.
15. The method of claim 1 , further comprising: performing a plurality of optimization passes on source code; receiving selection criteria; and adding a second instrumentation to the source code after performing the plurality of optimization passes to produce an instrumented code, wherein the second instrumentation is configured to track memory access addresses and access types of global variables and heap variables in accordance with the selection criteria.
16. The method of claim 15 , wherein adding the second instrumentation into the source code comprises inserting the second instrumentation for read accesses and write accesses.
17. The method of claim 15 , wherein adding the second instrumentation into the source code comprises inserting the second instrumentation for write accesses and not inserting the second instrumentation for read accesses.
18. The method of claim 15 , wherein the selection criteria comprises a black list of items not to be instrumented.
19. The method of claim 15 , wherein the selection criteria comprises a red list of items to be instrumented.
20. A computer comprising: a main memory; a first cache; a first processor coupled to the main memory and to the first cache; a second cache; a second processor coupled to the main memory and to the second cache; and a non-transitory computer readable storage medium storing programming for execution by the first processor and the second processor, wherein the programming comprises instrumentation, the programming including instructions to: fetch, by the first processor from the main memory, a first cache line of a plurality of cache lines, store the first cache line in the first cache of the plurality of cache lines, fetch, by the second processor from the main memory, a second cache line of the plurality of cache lines, store the second cache line in the second cache, track cache invalidations in the programming while running the programming to produce tracked invalidations in accordance with the instrumentation, wherein the instructions to track the cache invalidations comprises instructions to: track a number of write accesses to the plurality of cache lines, determine whether to track cache accesses to a plurality of cache lines in accordance with the number of write accesses, and track cache accesses to the plurality of cache lines by a plurality of tasks in response to determining to track cache accesses, and report false sharing in accordance with the tracked invalidations to produce a false sharing report.
Unknown
June 13, 2017
Browse 5M+ US patents with plain-English claim translations and AI-generated analysis.