This patch adds AMDGPUOpenMPToolChain for supporting OpenMP
offloading to AMD GPU's.
Originally authored by Greg Rodgers
pdhaliwal on Jan 19 2021, 3:45 AM.Authored by
This patch was written, roughly, by:
The idea is to move language-independent but amdgcn-specific code into ROCMToolChain. Some has already gone in, others (like computeMSVCVersion) will likely move too.
Regarding the rest of the end to end stack:
Regarding tests (which need the unimplemented bit filled in with the next patch):
It compiles and builds fine, however, I wasn't actually aware such sanity checking being present. It turns out
The idea for this patch was basically to introduce AMDGPUToolChain classes without much of the functionality in order
I have updated this patch to now include somewhat functional driver along with tests.
The deviceRTL is changing from cuda/hip to openmp at present. It would be good to be able to compile that as openmp for amdgpu, which needs a patch roughly like this and probably some follow up.
It's plausible that the contents of this file are only really of interest to AMD people, in which case we should probably land it in order to iterate in tree instead of downstream. It now has the cmake hook and a proof of concept test case.
Overall, looks reasonable. I'm not a fan of the way things are hooked up but that is also true for the NVPTX toolchain and for now unavoidable I guess. Some nits below.
This is loosely based on the nvptx and hip toolchain files, but looking at others in clang the style seems similar.
I believe this is 'safe', in the sense that it can't break anything other than AMDGPU's openmp implementation, which doesn't work yet anyway. The change to non-amd code is to OpenMPActionBuilder, and while parsing -march=gfx isn't pretty, it won't fire on nvptx. I'm not particularly confident it is correct, but it's hard to do comprehensive testing before there's an end to end spike. I'd like to iterate in tree, with an expectation that parts of this will need to change - @jdoerfert does the OpenMP patch look adequate for now?
Generally OK, the more I look at it the more things pop up. Other than my comments, I'm fine with this going in.
After addressing the review comments, I have internally verified changes on few simple test programs. They seem to be working fine.
Looks much simpler, thanks!