[PATCH] D30011: [NVPTX] Unify vectorization of load/stores of aggregate arguments and return values.

Artem Belevich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 15 15:12:51 PST 2017


tra created this revision.

Original code only used vector loads/stores for explicit vector arguments.
It could also do more loads/stores than necessary (e.g v5f32 would
touch 8 f32 values). Aggregate types were loaded one element at a time,
even the vectors contained within.

This change attempts to generalize (and simplify) parameter space
loads/stores so that vector loads/stores can be used more broadly.
Functionality of the patch has been verified by compiling thrust
test suite and manually checking the differences between PTX 
generated by llvm with and without the patch.

General algorithm:

- ComputePTXValueVTs() flattens input/output argument into a flat list of scalars to load/store and returns their types and offsets.
- VectorizePTXValueVTs() uses that data to create vectorization plan which returns an array of flags marking boundaries of vectorized load/stores. Scalars are represented as 1-element vectors.
- Code that generates loads/stores implements a simple state machine that constructs a vector according to the plan.

NOTE: the tests for this patch have found a problem with the way we load/store 
unaligned fields. This will be addressed separately.


https://reviews.llvm.org/D30011

Files:
  lib/Target/NVPTX/NVPTXISelLowering.cpp
  test/CodeGen/NVPTX/aggregate-return.ll
  test/CodeGen/NVPTX/f16-instructions.ll
  test/CodeGen/NVPTX/ldparam-v4.ll
  test/CodeGen/NVPTX/lower-aggr-copies.ll
  test/CodeGen/NVPTX/param-load-store.ll
  test/CodeGen/NVPTX/vec-param-load.ll
  test/CodeGen/NVPTX/vec8.ll
  test/CodeGen/NVPTX/vector-call.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30011.88607.patch
Type: text/x-patch
Size: 105950 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170215/58a15436/attachment.bin>


More information about the llvm-commits mailing list