This is an archive of the discontinued LLVM Phabricator instance.

[CUDA] Added dim3/uint3 conversion functions to builtin vars.
ClosedPublic

Authored by tra on Sep 24 2020, 11:08 AM.

Details

Summary

This is needed to compile some headers in CUDA-11 that assume that threadIdx is
implicitly convertible to dim3. With NVCC, threadIdx is uint3 and there's
dim3(uint3) constructor, so that works. Clang uses a special type for the threadIdx,
so dim3 can't be constructed from it. Instead, this patch adds conversion function to the
builtin variable classes.

Diff Detail

Event Timeline

tra created this revision.Sep 24 2020, 11:08 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 24 2020, 11:08 AM
tra requested review of this revision.Sep 24 2020, 11:08 AM
jlebar accepted this revision.Sep 24 2020, 11:14 AM

I know it comes in a separate change, but can we add a check to the test-suite?

clang/lib/Headers/__clang_cuda_runtime_wrapper.h
381

This is a C++11-ism (right?). Do we support compiling without C++11?

This revision is now accepted and ready to land.Sep 24 2020, 11:14 AM
tra updated this revision to Diff 294125.Sep 24 2020, 11:52 AM
tra edited the summary of this revision. (Show Details)

Fixed compatibility with pre-c++11

tra marked an inline comment as done.Sep 24 2020, 11:55 AM

I know it comes in a separate change, but can we add a check to the test-suite?

Will do.

clang/lib/Headers/__clang_cuda_runtime_wrapper.h
381

Fixed.

tra marked an inline comment as done.Sep 24 2020, 12:20 PM
In D88250#2293346, @tra wrote:

I know it comes in a separate change, but can we add a check to the test-suite?

Will do.

https://reviews.llvm.org/D88255

This revision was landed with ongoing or failed builds.Sep 24 2020, 2:33 PM
This revision was automatically updated to reflect the committed changes.