The prefetch instruction

后端 未结 3 773
心在旅途
心在旅途 2020-12-14 02:14

It appears the general logic for prefetch usage is that prefetch can be added, provided the code is busy in processing until the prefetch instruction completes its operation

3条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-14 02:47

    Sure, you have to experimate a bit, but not that you need to fetch somme houndred cycles (100-300) before the data is needed. The L2 cache is big enougth that the prefetched data can stay there a while.

    This prefetching is very efficient in front of a a loop (a few houndred cycles of course), especialy if it is the inner loop and the loop is started thousand and more times per secound.

    Also for ur ow fast LL implementation or a Tree-implementation could prefetching gain an measurable advantage because the CPU don't know jet that the data is needed soon.

    But remember that the prefetching instruction eat some decoder/queue bandwidth so overusing them hurts performance because of that reason.

提交回复
热议问题