setting the speed for the future of games programming |
||
PREFETCHPrefetching is a technique introduced in recent processors to speed up memory access. On the Intel Pentium III and AMD K6-2 and above, you can use prefetching to tell the processor to move data from main memory into the caches while the processor is doing other work. The main difference between using prefetch and just reading the data in early is that prefetch will not cause exceptions when accessing illegal memory or hardware memory. Therefore, it is not necessary to worry about whether the memory prefetched will actually be used. Also, fewer processor resources (e.g. registers) are used when prefetching compared with executing a read instruction.Prefetches are a hint to the processor and may be removed by the optimizer if registers are not available, or too many prefetches in the same place or to the same area of memory, or if the processor does not support them. Prefetches are not guaranteed to speed up your program. You may even get a small slow-down. There are 4 ways to generate prefetch instructions in VectorC:-
This option is easy, but not very precise. This is done by putting '__hint__((prefetch))' at the start of a variable declaration. This is done by putting '__hint__((prefetch))' before the '*' in the pointer declaration. |
||