[PATCH] D22879: [CUDA] Align kernel launch args correctly when the LLVM type's alignment is different from the clang type's alignment.

Justin Lebar via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 27 10:46:50 PDT 2016


jlebar created this revision.
jlebar added a reviewer: rnk.
jlebar added subscribers: tra, cfe-commits.

Before this patch, we computed the offsets in memory of args passed to
GPU kernel functions by throwing all of the args into an LLVM struct.

clang emits packed llvm structs basically whenever it feels like it, and
packed structs have alignment 1.  So we cannot rely on the llvm type's
alignment matching the C++ type's alignment.

This patch fixes our codegen so we always respect the clang types'
alignments.

https://reviews.llvm.org/D22879

Files:
  lib/CodeGen/CGCUDABuiltin.cpp
  lib/CodeGen/CGCUDANV.cpp
  test/CodeGenCUDA/kernel-args-alignment.cu

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22879.65771.patch
Type: text/x-patch
Size: 4987 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160727/c7d7d5bf/attachment.bin>


More information about the cfe-commits mailing list