Abstract A method is provided for optimizing a program by inserting memory prefetch operations in the program executing in a computer system. The computer system includes a processor and a memory. Latencies of instructions of the program are measured by hardware while the instructions are processed by a pipeline of the processor. Memory prefetch instructions are automatically inserted in the program based on the measured latencies to optimize execution of the program. The latencies measure the time from when a load instructions issues a request for data to the memory until the data are available in the processor. A program optimizer uses the measured latencies to estimate the number of cycles that elapse before data of a memory operation are available.
A method for inserting memory prefetch operations in a program executing in a computer system including a processor and a memory, comprising the steps of: measuring latencies of instructions of the program; and automatically inserting memory prefetch instructions in the program based on the measured latencies to optimize execution of the program.
Claim 2
Independent Claim
52 words
A method for inserting memory prefetch operations in a program executing in a computer system including a processor and a memory, comprising the steps of: measuring latencies of instructions of the program; and automatically inserting memory prefetch instructions in the program based on the measured latencies to optimize execution of the program.
Claim 3
Dependent Claim
32 words
The method of claim 1 wherein the latencies measure the time from when a load instruction issues a request for data to the memory until the data are available in the processor.
Claim 4
Dependent Claim
29 words
The method of claim 1 wherein a program optimizer uses the measured latencies to estimate the number of cycles that elapse before data of a memory operation are available.
Claim 5
Dependent Claim
20 words
The method of claim 2 wherein the program optimizer inserts memory prefetch instructions in the program for selected memory operations.
Claim 6
Dependent Claim
19 words
The method of claim 1 wherein states of the processor are randomly sampled by hardware to measure the latencies.
Claim 7
Dependent Claim
18 words
The method of claim 1 wherein pairs of selected instructions are sampled by hardware to measure the latencies.
Claim 8
Dependent Claim
29 words
The method of claim 6 wherein pairs of selected instructions include a related memory fetch instruction, and an instruction that uses data fetched by the related memory fetch instruction.