[Openmp-commits] [PATCH] D95752: [OpenMP][DeviceRTL] Extract shuffle idiom and port it to declare variant

Jon Chesterfield via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Mon Feb 1 12:11:21 PST 2021

JonChesterfield added a comment.

Not too keen on mixing code for different targets in the same file. Would prefer the prototype declared in a header and a nvptx.cpp, amdgcn.cpp, other.cpp implementing that interface, preferably via variant so that the whole thing compiles out for some arch.

If the 'fallback/default' works as I suspect, it makes a really nice way to implement generic versions. Ptx uses asm for an operation that amdgpu uses a shift for, would be nice to use the pure c++ one as the default and substitute in the specialised one for only the targets that use it.

Comment at: openmp/libomptarget/deviceRTLs/common/include/shuffle.h:105
+// only need to filter ptx42 as it is the last supported ptx version below 60.
+#pragma omp begin declare variant match(                                       \
+    device = {isa(ptx42)}, implementation = {extension(match_none)})
I like this a lot. Way better that CUDA_VERSION macros.

  rG LLVM Github Monorepo



More information about the Openmp-commits mailing list