[PATCH] D70228: [LoopDataPrefetch + SystemZ] Let target decide on prefetching on a per loop basis

Jonas Paulsson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 14 03:16:56 PST 2019


jonpa created this revision.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.

This patch adds

- New arguments to getMinPrefetchStride() to let the target decide on a per-loop basis if software prefetching should be done even with a stride within the limit of the hw prefetcher.
- New TTI hook enableWritePrefetching() to let a target do write prefetching by default (defaults to false).

LoopDataPrefetch:

- A search through the whole loop to gather information before emitting any prefetches. This way the target can get information via new arguments to getMinPrefetchStride() and emit prefetches more selectively. Collected information includes: Does the loop have a call, how many memory accesses, how many of them are strided, how many prefetches will cover them. This is NFC to before as long as the target does not change its definition of getMinPrefetchStride().

- If a previous access to the same exact address was 'read', and the current one is 'write', make it a 'write' prefetch.

- If two accesses that are covered by the same prefetch do not dominate each other, put the prefetch in a block that dominates both of them.

- If a ConstantMaxTripCount is less than ItersAhead, then skip the loop.

SystemZ:

- increase the distance of prefetching (to meet the hot lbm loop with prefetching 9 iterations ahead).
- enable write prefetching by default.
- emit sw prefetching for any stride according to new heuristics in getMinPrefetchStride(), which includes lbm.
- Do we need a test to test getMinPrefetchStride()?


https://reviews.llvm.org/D70228

Files:
  llvm/include/llvm/Analysis/TargetTransformInfo.h
  llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
  llvm/include/llvm/CodeGen/BasicTTIImpl.h
  llvm/include/llvm/MC/MCSubtargetInfo.h
  llvm/lib/Analysis/TargetTransformInfo.cpp
  llvm/lib/MC/MCSubtargetInfo.cpp
  llvm/lib/Target/AArch64/AArch64Subtarget.h
  llvm/lib/Target/SystemZ/SystemZTargetTransformInfo.cpp
  llvm/lib/Target/SystemZ/SystemZTargetTransformInfo.h
  llvm/lib/Transforms/Scalar/LoopDataPrefetch.cpp
  llvm/test/CodeGen/SystemZ/prefetch-02.ll
  llvm/test/CodeGen/SystemZ/prefetch-03.ll
  llvm/test/CodeGen/SystemZ/prefetch-04.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70228.229257.patch
Type: text/x-patch
Size: 28802 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191114/ddf2234a/attachment.bin>


More information about the llvm-commits mailing list