<div dir="ltr"><div class="gmail_quote"><div>Elided the discussion starting:</div><div>> Are there any plans to support OpenMP</div><div>> offload to the integrated GPU in Apple Silicon processors?</div><div> <br></div><div>Replying from Johannes' sketch:</div><div> Given that description one would need two things:</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
1) A Metal API plugin for libomptarget (next to the CUDA and AMDGCN <br>
plugin). That is actually pretty easy if<br>
    their API is somewhat sane.<br>
2) A backend that can produce device code. I don't think they upstreamed <br>
their Metal backend *but* one can<br>
    probably use their clang as "backend" given that it can consume LLVM-IR.<br></blockquote><div><br></div><div>I think this is in the realm of difficult but tractable. One scheme would be to add a target to LLVM which approximates the GPU - pointer sizes etc - then a heuristically derived pass that mangles the whole-program IR (post device lib splice) into IR that the closed source toolchain tolerates. Could alternatively use an existing target that looks vaguely similar and do more work in the heuristic pass.</div><div><br></div><div>An alternative would be to revive a C backend for LLVM and use that as the common IR. Essentially need 'something' that exists after the openmp-specific rewrites and preferably after the device runtime that can be fed to 'something' that creates binaries that the GPU can run.</div><div><br></div><div>There's some independent interest in passing IR through to the API plugin layer and if Intel's GPU compiler stays out of tree we might end up with machinery for feeding an IR to a third party toolchain to 'finalize' it.</div><div><br></div><div>Interesting problem, not immediately obvious who would have the motivation to make it happen. Could be a side project for an Apple GPU enthusiast. Whole thing would be much easier if the backend was added to LLVM trunk, presumably by Apple.</div><div><br></div><div>Thanks for the interesting question!</div><div><br></div><div>Jon</div><div><br></div><div><br></div></div></div>