This is an archive of the discontinued LLVM Phabricator instance.

[NVPTX] Handle __nvvm_reflect("__CUDA_ARCH").
ClosedPublic

Authored by tra on Aug 2 2018, 5:00 PM.

Details

Summary

libdevice in recent CUDA versions relies on __nvvm_reflect() to select
GPU-specific bitcode. This patch addresses the requirement.

Diff Detail

Repository
rL LLVM

Event Timeline

tra created this revision.Aug 2 2018, 5:00 PM
jlebar accepted this revision.Aug 2 2018, 5:08 PM

Just to check, the notion is that it's OK if I report a sm version less than what I end up running on?

llvm/lib/Target/NVPTX/NVVMReflect.cpp
55 ↗(On Diff #158866)

explicit

This revision is now accepted and ready to land.Aug 2 2018, 5:08 PM
tra added a comment.Aug 2 2018, 5:13 PM

Just to check, the notion is that it's OK if I report a sm version less than what I end up running on?

Yes. We may lose some performance, but not correctness as we are expected to be forward-compatible.
Until now reflect was being replaced with 0, so we were picking the variant suitable for the oldest GPU.

tra updated this revision to Diff 158869.Aug 2 2018, 5:15 PM

Added 'explicit' keyword to contructor.

This revision was automatically updated to reflect the committed changes.