<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Dec 15, 2020 at 10:23 AM Ben Boeckel <<a href="mailto:ben.boeckel@kitware.com">ben.boeckel@kitware.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Mon, Dec 14, 2020 at 14:04:43 -0800, Artem Belevich via cfe-dev wrote:<br>
> It all may be an utter overkill, too. WDYT?<br>
<br>
Note that tools such as ccache and sccache generally need to be able to<br>
understand what's going on (I believe distcc and other distributed<br>
compilation tools also generally need to know too), so making it<br>
sensible enough for interpretation based on just the flags to be<br>
possible should be considered.<br></blockquote><div><br></div><div><div class="gmail_default" style="font-family:verdana,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif">I think this is somewhat orthogonal to how we specify per-target options. Such a tool almost never knows about all possible compiler options and has to pass through the unknown options as-is.  </span><span style="font-family:Arial,Helvetica,sans-serif">However, any form of 'nested' options specified on the command line will have a chance to confuse such </span>tool<span style="font-family:Arial,Helvetica,sans-serif">. E.g. </span>if I<span style="font-family:Arial,Helvetica,sans-serif"> want to pass '-E' to some sub-tool for a particular offload-target, ccache, not being aware that it's not a top-level compilation option, may interpret it as an attempt to preprocess the TU.</span></div><div class="gmail_default" style="font-family:verdana,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif"><br></span></div><div class="gmail_default" style="">I wonder if it would make sense to just move all this per-target option complexity into an external response file. As far as existing tools are concerned, it would look like `--offload-options=target-opts.file` without affecting tool's general idea what this compilation is about to do, and the external file would allow us to be as flexible as we need to be to specify per-target options. It could be just a flat list of pairs `-Xarch_... optA`.  Or we could use YAML. </div><div class="gmail_default" style=""><br></div><div class="gmail_default" style="">That approach, however, has its own issues and would still need to be optional. If it's the only way to specify offload options, that will complicate other use cases as now they would have to deal with temporary files.</div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div></div><div class="gmail_default" style="font-family:verdana,sans-serif">Maybe a slightly modified variant of jdoefert@'s idea would work better:<br></div><div class="gmail_default" style="font-family:verdana,sans-serif"><span style="color:rgb(80,0,80);font-family:Arial,Helvetica,sans-serif">> >>    -offload="amd -march=gfx906 -fno-vectorize" -fopenmp</span><br></div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">Implement it in a way similar to -Wl,optA,optB,optC and extend it to match an offload scope glob/regex.</div><div class="gmail_default" style="font-family:verdana,sans-serif">E.g. `-offload=<offload-pattern>,optA,optB,optC`. </div><div class="gmail_default" style="font-family:verdana,sans-serif">As far as the external tools are concerned, it's just one option to pass though. At the same time it should be flexible enough to apply the options to subset of offload targets in a human-manageable way.</div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div>-- <br></div></div><div dir="ltr" class="gmail_signature"><div dir="ltr">--Artem Belevich</div></div></div>