GPGPU: Do not assume arrays start at 0
authorTobias Grosser <tobias@grosser.es>
Thu, 15 Sep 2016 14:05:58 +0000 (14:05 +0000)
committerTobias Grosser <tobias@grosser.es>
Thu, 15 Sep 2016 14:05:58 +0000 (14:05 +0000)
commitaaabbbf8863827cb9e286e1e04cc41f088f9383f
treeec5c4ccb9685e196e83f55e7edb6e30a3357f7f7
parent9edf96ec9b64f91a0d6b992a92f6762f87e3c67d
GPGPU: Do not assume arrays start at 0

Our alias checks precisely check that the minimal and maximal accessed elements
do not overlap in a kernel. Hence, we must ensure that our host <-> device
transfers do not touch additional memory locations that are not covered in
the alias check. To ensure this, we make sure that the data we copy for a
given array is only the data from the smallest element accessed to the largest
element accessed.

We also adjust the size of the array according to the offset at which the array
is actually accessed.

An interesting result of this is: In case array are accessed with negative
subscripts ,e.g., A[-100], we automatically allocate and transfer _more_ data to
cover the full array. This is important as such code indeed exists in the wild.

llvm-svn: 281611
polly/lib/CodeGen/PPCGCodeGeneration.cpp
polly/test/GPGPU/non-zero-array-offset.ll [new file with mode: 0644]
polly/test/GPGPU/phi-nodes-in-kernel.ll