[PATCH] D17561: [CUDA] Add conversion operators for threadIdx, blockIdx, gridDim, and blockDim to uint3 and dim3.

Justin Lebar via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 23 22:50:54 PST 2016


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

This lets you write, e.g.

  uint3 a = threadIdx;
  uint3 b = blockIdx;
  dim3 c = gridDim;
  dim3 d = blockDim;

which is legal in nvcc, but was not legal in clang.

The fact that e.g. the type of threadIdx is not actually uint3 is still
observable, but now you have to try to observe it.

http://reviews.llvm.org/D17561

Files:
  lib/Headers/__clang_cuda_runtime_wrapper.h
  lib/Headers/cuda_builtin_vars.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17561.48884.patch
Type: text/x-patch
Size: 3606 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160224/0e8b24c2/attachment.bin>


More information about the cfe-commits mailing list