IP Library Granted Patent US 8,078,847
Granted Patent B2
US 8,078,847 · App. 12/172,173 · Granted Dec 13, 2011

Detecting memory-hazard conflicts during vector processing

Assignee: Apple Inc.
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 8,078,847
App. No.
12/172,173
Granted
Dec 13, 2011
Kind
B2
Abstract

A method for performing parallel operations in a computer system when one or more memory hazards may be present, which may be implemented by a processor, is described. During operation, the processor receives instructions for detecting conflict between memory addresses in vectors when memory operations are performed in parallel using at least a portion of the vectors, and tracking positions in at least one of the vectors of any detected conflict between the memory addresses. Next, the processor executes the instructions for detecting the conflict between the memory addresses and tracking the positions.

Claims (47)

1. A method for performing parallel operations in a computer system when one or more memory hazards may be present, comprising:

receiving instructions for detecting conflict between memory addresses in vectors when memory operations are performed in parallel using at least a portion of the vectors, and tracking positions in at least one of the vectors of any detected conflict between the memory addresses, wherein the instructions are inserted in program code prior to runtime, and wherein the conflict between memory addresses includes a conflict that is data-dependent and therefore cannot be detected until after the memory addresses have been resolved at runtime; and

executing the instructions for detecting the conflict between the memory addresses and tracking the positions, wherein executing the instructions causes a processor to detect the conflict between the memory addresses and to track the positions, and wherein while executing the instructions, the processor generates one or more stop indicators based on the tracked positions in the at least one of the vectors, wherein the one or more stop indicators indicate positions to break the at least one of the vectors into sub-vectors to ensure correct program behavior when the memory operations are performed in parallel.

2. The method of claim 1 , wherein conflict between the memory addresses includes overlap of the memory addresses.

3. The method of claim 1 , wherein conflict between the memory addresses in the vectors is associated with at least one memory hazard.

4. The method of claim 1 , wherein detecting the conflict involves determining matches between the memory addresses.

5. The method of claim 1 , further comprising generating a vector of the tracked positions.

6. The method of claim 1 , wherein detecting the conflict involves at least one of determining and identifying one or more memory hazards that lead to different results when the memory addresses are accessed in parallel than when the memory addresses are accessed in program order.

7. The method of claim 1 , further comprising generating one or more predicate values based on memory addresses associated with conflict, wherein the one or more predicate values specify elements for which the memory operations may safely be performed in parallel for a set of consecutive elements in at least one of the vectors.

8. The method of claim 1 , wherein the vectors include a first vector and a second vector;

wherein detecting involves comparing memory addresses in the first vector with memory addresses in the second vector; and

wherein a memory address associated with a given position in the second vector is compared to one or more memory addresses in the first vector associated with positions that correspond to loop iterations that are after the iteration corresponding to the given position.

9. The method of claim 1 , wherein the vectors include a first vector and a second vector;

wherein the detecting involves comparing memory addresses in the first vector with memory addresses in the second vector; and

wherein a memory address associated with a given position in the second vector is compared to one or more memory addresses in the first vector associated with positions that correspond to loop iterations that are before the iteration corresponding to the given position.

10. The method of claim 1 , wherein the parallel processing is to be performed by multiple processors.

11. The method of claim 1 , wherein the parallel processing is to be performed by multiple threads that are to be executed by multiple cores.

12. The method of claim 1 , wherein a register file for the processor holds the stop indicators and predicate vectors.

13. A compiler configured to generate instructions based on a feature set of a processor, wherein the processor is configured to:

receive instructions for detecting conflict between memory addresses in vectors when memory operations are performed in parallel using at least a portion of the vectors, and tracking positions in at least one of the vectors of any detected conflict between the memory addresses, wherein the instructions are inserted in program code prior to runtime, and wherein the conflict between memory addresses includes a conflict that is data-dependent and therefore cannot be detected until after the memory addresses have been resolved at runtime; and

execute the instructions for detecting the conflict between the memory addresses and tracking the positions, wherein executing the instructions causes a processor to detect the conflict between the memory addresses and to track the positions, and wherein while executing the instructions, the processor generates one or more stop indicators based on the tracked positions in the at least one of the vectors, wherein the one or more stop indicators indicate positions to break the at least one of the vectors into sub-vectors to ensure correct program behavior when the memory operations are performed in parallel.

14. The compiler of claim 13 , wherein conflict between the memory addresses includes overlap of the memory addresses.

15. The compiler of claim 13 , wherein the vectors include a first vector and a second vector;

wherein detecting involves comparing memory addresses in the first vector with memory addresses in the second vector; and

wherein a memory address associated with a given position in the second vector is compared to one or more memory addresses in the first vector associated with positions that correspond to loop iterations that are after the iteration corresponding to the given position.

16. The compiler of claim 13 , wherein the vectors include a first vector and a second vector;

wherein the detecting involves comparing memory addresses in the first vector with memory addresses in the second vector; and

wherein a memory address associated with a given position in the second vector is compared to one or more memory addresses in the first vector associated with positions that correspond to loop iterations that are before the iteration corresponding to the given position.

17. The compiler of claim 13 , wherein detecting the conflict involves determining matches between the memory addresses.

18. The compiler of claim 13 , wherein the processor is further configured to generate one or more predicate values based on memory addresses associated with conflict, wherein the one or more predicate values specify elements for which the memory operations may safely be performed in parallel for a set of consecutive elements in at least one of the vectors.

19. The compiler of claim 13 , wherein detecting the conflict involves at least one of determining and identifying one or more memory hazards that lead to different results when the memory addresses are accessed in parallel than when the memory addresses are accessed in program order.

20. A computer system configured to execute instructions to avoid one or more memory hazards while performing parallel operations, comprising:

a processor;

a memory;

an instruction fetch unit within the processor configured to fetch:

instructions for detecting conflict between memory addresses in vectors when memory operations are performed in parallel using at least a portion of the vectors, and tracking positions in at least one of the vectors of any detected conflict between the memory addresses, wherein the instructions are inserted in program code prior to runtime, and wherein the conflict between memory addresses includes a conflict that is data-dependent and therefore cannot be detected until after the memory addresses have been resolved at runtime; and

instructions for executing the instructions for detecting the conflict between the memory addresses and tracking the positions, wherein executing the instructions causes a processor to detect the conflict between the memory addresses and to track the positions, and wherein while executing the instructions, the processor generates one or more stop indicators based on the tracked positions in the at least one of the vectors, wherein the one or more stop indicators indicate positions to break the at least one of the vectors into sub-vectors to ensure correct program behavior when the memory operations are performed in parallel.

21. The computer system of claim 20 , wherein conflict between the memory addresses includes overlap of the memory addresses.

22. The computer system of claim 20 , wherein detecting the conflict involves determining matches between the memory addresses.

23. The computer system of claim 20 , wherein the instruction fetch unit is further configured to fetch instructions for generating one or more predicate values based on memory addresses associated with conflict, wherein the one or more predicate values specify elements for which the memory operations may safely be performed in parallel for a set of consecutive elements in at least one of the vectors.

24. The computer system of claim 20 , wherein detecting the conflict involves at least one of determining and identifying one or more memory hazards that lead to different results when the memory addresses are accessed in parallel than when the memory addresses are accessed in program order.

25. The computer system of claim 20 , wherein the vectors include a first vector and a second vector;

wherein detecting involves comparing memory addresses in the first vector with memory addresses in the second vector; and

wherein a memory address associated with a given position in the second vector is compared to one or more memory addresses in the first vector associated with positions that correspond to loop iterations that are after the iteration corresponding to the given position.

26. The computer system of claim 20 , wherein the vectors include a first vector and a second vector;

wherein the detecting involves comparing memory addresses in the first vector with memory addresses in the second vector; and

wherein a memory address associated with a given position in the second vector is compared to one or more memory addresses in the first vector associated with positions that correspond to loop iterations that are before the iteration corresponding to the given position.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jul 29, 2008
From: GONION, JEFFRY E.; DIEFENDORFF, KEITH E.
To: APPLE INC.
Reel/Frame 021309/0300 →
Continuity (2)
Continuation In Part 11803576 · May 14, 2007
Related Publication 20080288744A1 · Nov 20, 2008