This is an archive of the discontinued LLVM Phabricator instance.

[libomptarget][nfc] Wrap cuda min() in target_impl
ClosedPublic

Authored by JonChesterfield on Dec 16 2019, 4:08 PM.

Details

Summary

[libomptarget][nfc] Wrap cuda min() in target_impl

nvptx forwards to cuda min, amdgcn implements directly.
Sufficient to build parallel.cu for amdgcn, added to CMakeLists.

All call sites are homogenous except one that passes a uint32_t and an
int32_t. This could be smoothed over by taking two type parameters
and some care over the return type, but overall I think the inline
<uint32_t> calling attention to what was an implicit sign conversion
is cleaner.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptDec 16 2019, 4:08 PM
JonChesterfield marked an inline comment as done.Dec 16 2019, 4:12 PM
JonChesterfield added inline comments.
openmp/libomptarget/deviceRTLs/nvptx/src/reduction.cu
483

Here, NumTeams is a uint32_t and num_of_records is an int32_t. I quite like the <> sigil calling attention to this, but am open to alternatives.

jdoerfert accepted this revision.Dec 16 2019, 4:37 PM

LGTM. I proposed an alternative spelling for the one special case but I don't care much which you choose.

openmp/libomptarget/deviceRTLs/nvptx/src/reduction.cu
483

This is fine, __kmpc_impl_min(NumTeams, uint32_t(num_of_records)); would be an alternative to make clear what is casted.

This revision is now accepted and ready to land.Dec 16 2019, 4:37 PM
  • More explicit cast
JonChesterfield marked 2 inline comments as done.Dec 16 2019, 5:28 PM
JonChesterfield added inline comments.
openmp/libomptarget/deviceRTLs/nvptx/src/reduction.cu
483

I like that more, thanks

This revision was automatically updated to reflect the committed changes.
JonChesterfield marked an inline comment as done.