]> granicus.if.org Git - clang/commit
[CUDA] Add conversion operators for threadIdx, blockIdx, gridDim, and blockDim to...
authorJustin Lebar <jlebar@google.com>
Wed, 24 Feb 2016 21:49:33 +0000 (21:49 +0000)
committerJustin Lebar <jlebar@google.com>
Wed, 24 Feb 2016 21:49:33 +0000 (21:49 +0000)
commit93b27f5e1a63d7b3c0a33a1b0fbd9cbec86ebee5
tree3750cdebe38d65bae154fb71d99f4bbeafdb4e9b
parent5a68fbd86b5d46737cb456194701fb25474ee87d
[CUDA] Add conversion operators for threadIdx, blockIdx, gridDim, and blockDim to uint3 and dim3.

Summary:
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.

Reviewers: tra

Subscribers: echristo, cfe-commits

Differential Revision: http://reviews.llvm.org/D17561

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@261777 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Headers/__clang_cuda_runtime_wrapper.h
lib/Headers/cuda_builtin_vars.h