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

Johannes Doerfert via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Mon Feb 1 14:03:25 PST 2021


jdoerfert added a comment.

In D95752#2534578 <https://reviews.llvm.org/D95752#2534578>, @JonChesterfield wrote:

> 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.

I'm hoping for a structure where we put a feature into a file, rather than an architecture per file. If we do both, we get 4 files per feature. This is not intrinsically bad but makes updates less convenient. At the end of the day, it doesn't matter much what we do since we perform LTO on this. I was hoping the approach with one header per feature and one cpp file for externally used functions would spur reuse. That is, helpers are defined only once, opportunities to share code are easier to spot during updates, etc.

> 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.

So this is what's happening, at least once we have a "fallback" target model for which we can define what a "shuffle" means.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95752/new/

https://reviews.llvm.org/D95752



More information about the Openmp-commits mailing list