This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP][NVPTX] Rewrite CUDA intrinsics with NVVM intrinsics
ClosedPublic

Authored by tianshilei1992 on Jan 24 2021, 7:01 PM.

Details

Summary

This patch makes prep for dropping CUDA when compiling deviceRTLs.
CUDA intrinsics are replaced by NVVM intrinsics which refers to code in
__clang_cuda_intrinsics.h. We don't want to directly include it because in the
near future we're going to switch to OpenMP and by then the header cannot be
used anymore.

Diff Detail

Event Timeline

tianshilei1992 created this revision.Jan 24 2021, 7:01 PM
tianshilei1992 requested review of this revision.Jan 24 2021, 7:01 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 24 2021, 7:01 PM
JonChesterfield accepted this revision.Jan 25 2021, 2:33 AM

The cuda_intrisics header would need to be substantially refactored to support including from openmp. Doesn't presently seem worthwhile for four straightforward functions.

openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.cu
83

The expression ((WARPSIZE - Width) << 8) | 0x1f) occurs on both branches, maybe assign it to a local variable before the #if

This revision is now accepted and ready to land.Jan 25 2021, 2:33 AM

Fixed the comment