This is an archive of the discontinued LLVM Phabricator instance.

Add support for __nvvm_reflect changes in libdevice in CUDA-7.0
ClosedPublic

Authored by tra on Mar 17 2015, 3:04 PM.

Details

Summary

CUDA 7.0's libdevice uses slightly different IR to call nvvm_reflect
and that triggers an assertion in nvvm_reflect optimization pass. This
change allows nvvm_reflect pass to deal with both old and new ways to
pass an argument to
nvvm_reflect.

Diff Detail

Event Timeline

tra updated this revision to Diff 22135.Mar 17 2015, 3:04 PM
tra retitled this revision from to Add support for __nvvm_reflect changes in libdevice in CUDA-7.0.
tra updated this object.
tra edited the test plan for this revision. (Show Details)
tra added reviewers: eliben, echristo.
tra added a subscriber: Unknown Object (MLST).
eliben added inline comments.Mar 17 2015, 6:44 PM
lib/Target/NVPTX/NVVMReflect.cpp
182

Artem, it definitely makes sense to document this change. For lack of a better place, a detailed comment somewhere here would do. Please describe the difference between the two formats and how it's handled here.

tra updated this revision to Diff 22207.Mar 18 2015, 1:35 PM

Added details on the differences in IR used to call __nvvm_reflect in different CUDA versions.
Updated IR in the test case to work with recent LLVM.

eliben added inline comments.Mar 18 2015, 4:52 PM
lib/Target/NVPTX/NVVMReflect.cpp
182

It may be more idiomatic to use dyn_cast here and then get your Operand*, removing the following cast<>s
It's done a bunch all over llvm

test/CodeGen/NVPTX/nvvm-reflect.ll
52

Mention that this is the CUDA 7 version

tra updated this revision to Diff 22233.Mar 18 2015, 5:20 PM

Addressed eliben@'s comments.

eliben accepted this revision.Mar 18 2015, 5:28 PM
eliben edited edge metadata.

LGTM

This revision is now accepted and ready to land.Mar 18 2015, 5:28 PM
This revision was automatically updated to reflect the committed changes.
echristo edited edge metadata.Mar 19 2015, 10:14 AM

Comment looks good (heinous, but good).

LGTM.

-eric