Page MenuHomePhabricator

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

Authored by tra on Thu, Sep 24, 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.Thu, Sep 24, 11:08 AM
Herald added a project: Restricted Project. · View Herald TranscriptThu, Sep 24, 11:08 AM
tra requested review of this revision.Thu, Sep 24, 11:08 AM
jlebar accepted this revision.Thu, Sep 24, 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.Thu, Sep 24, 11:14 AM
tra updated this revision to Diff 294125.Thu, Sep 24, 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.Thu, Sep 24, 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.Thu, Sep 24, 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.Thu, Sep 24, 2:33 PM
This revision was automatically updated to reflect the committed changes.