<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body dir="auto">
I still don’t understand why do we need kind but -offload-kind=kind looks much better to me. 
<div>As to archs, I think the arch can be included in triple <span style="-webkit-text-size-adjust: auto; caret-color: rgb(51, 51, 51); color: rgb(51, 51, 51); font-family: "DejaVu Sans", Arial, Helvetica, sans-serif; font-size: 24px; background-color: rgb(255, 255, 255);"> </span><code class="docutils literal notranslate" style="-webkit-text-size-adjust: auto; background-color: rgb(226, 226, 226); font-size: 1em; caret-color: rgb(51, 51, 51); color: rgb(51, 51, 51);"><span class="pre" style="-webkit-hyphens: none;"><arch><sub>-<vendor>-<sys>-<abi></span></code></div>
<div><br>
<div dir="ltr">You can specify sub target `amdgcngfx906-amd-amdhsa` but you need to add subarchs for triple class. How about this?</div>
<div id="AppleMailSignature" dir="ltr"><br>
</div>
<div id="AppleMailSignature" dir="ltr"><a href="https://clang.llvm.org/docs/CrossCompilation.html">https://clang.llvm.org/docs/CrossCompilation.html</a></div>
<div id="AppleMailSignature" dir="ltr"><br>
</div>
<div dir="ltr">Best regards,
<div>Alexey Bataev</div>
</div>
<div dir="ltr"><br>
<blockquote type="cite">12 дек. 2020 г., в 10:51, Liu, Yaxun (Sam) <Yaxun.Liu@amd.com> написал(а):<br>
<br>
</blockquote>
</div>
<blockquote type="cite">
<div dir="ltr"><span>[AMD Public Use]</span><br>
<span></span><br>
<span>The offload kind is intended for situations where offload kind cannot be inferred from input file type, e.g. bundled LLVM bitcode or bundled assembly file. If it is redundant to specify it multiple times, we may consider a separate -offload-kind= option.
 I understand OpenMP can use -fopenmp to indicate OpenMP offload kind, but HIP may need an -offload-kind=hip option since it currently does not have one.</span><br>
<span></span><br>
<span>`-offload=target1,target2,... -offload-target1=“-march xxx -opt1” -offload-target2=“-march yyy -opt2 -opt3” does not well work for CUDA/HIP since CUDA/HIP can have multiple device archs for the same target.</span><br>
<span></span><br>
<span>How about -offload=target1,arch1,opt1a,opt1b -offload=target2,arch2,opt2a,opt2b ?</span><br>
<span></span><br>
<span>Thanks.</span><br>
<span></span><br>
<span>Sam</span><br>
<span></span><br>
<span>-----Original Message-----</span><br>
<span>From: Alexey Bataev <a.bataev@hotmail.com> </span><br>
<span>Sent: Saturday, December 12, 2020 9:40 AM</span><br>
<span>To: Liu, Yaxun (Sam) <Yaxun.Liu@amd.com></span><br>
<span>Cc: cfe-dev (cfe-dev@lists.llvm.org) <cfe-dev@lists.llvm.org>; Lieberman, Ron <Ron.Lieberman@amd.com>; georgakoudis1@llnl.gov; jdoerfert@anl.gov; Artem Belevich <tra@google.com>; Searles, Mark <Mark.Searles@amd.com>; Chan, SiuChi <siuchi.chan@amd.com></span><br>
<span>Subject: Re: [RFC] Unified offloading option for CUDA/HIP/OpenMP</span><br>
<span></span><br>
<span>[CAUTION: External Email]</span><br>
<span></span><br>
<span>Why do we need “kind” here? We know the kind already, if -fopenmp is used - kind is omp, if .hip is compiled - kind is hip.</span><br>
<span>Adding arch also does not look good. We may need to pass some extra params. Better to have something like `-offload=target1,target2,... -offload-target1=“-march xxx -opt1” -offload-target2=“-march yyy -opt2 -opt3” ...`.</span><br>
<span></span><br>
<span>Best regards,</span><br>
<span>Alexey Bataev</span><br>
<span></span><br>
<blockquote type="cite"><span>12 дек. 2020 г., в 09:11, Liu, Yaxun (Sam) <Yaxun.Liu@amd.com> написал(а):</span><br>
</blockquote>
<blockquote type="cite"><span></span><br>
</blockquote>
<blockquote type="cite"><span>[AMD Public Use]</span><br>
</blockquote>
<blockquote type="cite"><span></span><br>
</blockquote>
<blockquote type="cite"><span>Currently CUDA/HIP and OpenMP has different offloading options, e.g.</span><br>
</blockquote>
<blockquote type="cite"><span></span><br>
</blockquote>
<blockquote type="cite"><span>clang++  -fopenmp -fopenmp-targets=amdgcn-amd-amdhsa -Xopenmp-target=amdgcn-amd-amdhsa -march=gfx900 test.cpp</span><br>
</blockquote>
<blockquote type="cite"><span></span><br>
</blockquote>
<blockquote type="cite"><span>clang++ -offload-arch=gfx906 test.hip</span><br>
</blockquote>
<blockquote type="cite"><span></span><br>
</blockquote>
<blockquote type="cite"><span>Our users request to have a concise way to specify offloading options for OpenMP. Ideally, one option to convey offloading kind, offloading triple, and offloading device arch.</span><br>
</blockquote>
<blockquote type="cite"><span></span><br>
</blockquote>
<blockquote type="cite"><span>On the other hand, there are some limitations of the current offloading option for CUDA/HIP:</span><br>
</blockquote>
<blockquote type="cite"><span></span><br>
</blockquote>
<blockquote type="cite"><span>1. It does not specify offloading kind whereas relies on file type to infer offloading kind. If input file is not CUDA/HIP source code (e.g. bundled LLVM bit code), there needs a way to specify offloading kind.</span><br>
</blockquote>
<blockquote type="cite"><span></span><br>
</blockquote>
<blockquote type="cite"><span>2. It does not specify offloading target triple whereas relies on device arch to infer target triple. As HIP is ported to different targets, there needs a way to specify offloading target triple.</span><br>
</blockquote>
<blockquote type="cite"><span></span><br>
</blockquote>
<blockquote type="cite"><span>In summary, a unified offloading option is preferred, which conveys offloading kind, offloading target triple and offloading device arch.</span><br>
</blockquote>
<blockquote type="cite"><span></span><br>
</blockquote>
<blockquote type="cite"><span>I would like to propose to either have a new option or extend the existing -offload-arch option for that, in the format kind-triple-arch, e.g.</span><br>
</blockquote>
<blockquote type="cite"><span></span><br>
</blockquote>
<blockquote type="cite"><span>-offload=omp-amd-gfx900</span><br>
</blockquote>
<blockquote type="cite"><span></span><br>
</blockquote>
<blockquote type="cite"><span>-offload=hip-amd-gfx906</span><br>
</blockquote>
<blockquote type="cite"><span></span><br>
</blockquote>
<blockquote type="cite"><span>Whereas kind and triple can be abbreviations for conciseness, e.g. omp expands to openmp, amd expands to amdgcn-amd-amdhsa. Arch can be omitted, in which case clang will use the default arch for the triple.</span><br>
</blockquote>
<blockquote type="cite"><span></span><br>
</blockquote>
<blockquote type="cite"><span>Your feedbacks are welcome.</span><br>
</blockquote>
<blockquote type="cite"><span></span><br>
</blockquote>
<blockquote type="cite"><span>Thanks.</span><br>
</blockquote>
<blockquote type="cite"><span></span><br>
</blockquote>
<blockquote type="cite"><span>Sam</span><br>
</blockquote>
<blockquote type="cite"><span></span><br>
</blockquote>
</div>
</blockquote>
</div>
</body>
</html>