This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP] Fix nvptx CUDA_VERSION conversion
ClosedPublic

Authored by jdenny on Feb 18 2021, 5:15 PM.

Details

Summary

As mentioned in PR#49250, without this patch, ptxas for CUDA 9.1 fails
in the following two tests:

  • openmp/libomptarget/test/mapping/lambda_mapping.cpp
  • openmp/libomptarget/test/offloading/bug49021.cpp

The error looks like:

ptxas /tmp/lambda_mapping-081ea9.s, line 828; error   : Not a name of any known instruction: 'activemask'

The problem is that our cmake script converts CUDA version strings
incorrectly: 9.1 becomes 9100, but it should be 9010, as shown in
getCudaVersion in clang/lib/Driver/ToolChains/Cuda.cpp. Thus,
openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.cu
inadvertently enables activemask because it apparently becomes
available in 9.2. This patch fixes the conversion.

This patch does not fix the other two tests in PR#49250.

Diff Detail

Event Timeline

jdenny created this revision.Feb 18 2021, 5:15 PM
jdenny requested review of this revision.Feb 18 2021, 5:15 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 18 2021, 5:15 PM
Herald added a subscriber: sstefan1. · View Herald Transcript
tianshilei1992 accepted this revision.Feb 18 2021, 5:38 PM

LGTM with one nit. Thanks for the fix!

openmp/libomptarget/deviceRTLs/nvptx/CMakeLists.txt
179

You can use libomptarget_error_say("Unrecognized CUDA version format: ${cuda_version}") instead.

This revision is now accepted and ready to land.Feb 18 2021, 5:38 PM
jdenny updated this revision to Diff 324961.Feb 19 2021, 5:57 AM

Address @tianshilei1992's review.

Thanks!

jdenny marked an inline comment as done.Feb 19 2021, 5:58 AM
This revision was automatically updated to reflect the committed changes.