<div dir="ltr"><div><div><div>What about this?<br><br><a href="https://github.com/RadeonOpenCompute/HCC-Native-GCN-ISA/wiki">https://github.com/RadeonOpenCompute/HCC-Native-GCN-ISA/wiki</a><br><br></div><div>What is the different between this and the methods you pointed to?<br><br></div>I have access to a R9 Nano (same chip as the Fury X).<br><br><br></div>Thanks,<br></div>Ricardo<br><div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-05-18 23:11 GMT+01:00 Tom Stellard <span dir="ltr"><<a href="mailto:tom@stellard.net" target="_blank">tom@stellard.net</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Tue, Apr 26, 2016 at 08:59:40PM +0100, Ricardo Nobre via Libclc-dev wrote:<br>
> I compiled and installed the latest 'libclc' from the repository and I<br>
> successfully generated AMD GCN ASM from the GEMM kernel of the<br>
> polybench-gpu benchmark (<br>
> <a href="http://web.cse.ohio-state.edu/~pouchet/software/polybench/GPU/" rel="noreferrer" target="_blank">http://web.cse.ohio-state.edu/~pouchet/software/polybench/GPU/</a>) executing<br>
> the following commands:<br>
><br>
> /opt/clang+llvm-3.7.1-x86_64-linux-gnu-ubuntu-15.10/bin/clang<br>
> -Dcl_clang_storage_class_specifiers -isystem /opt/libclc/include -include<br>
> clc/clc.h -target amdgcn -S -emit-llvm -xcl -o gemm.ll <a href="http://gemm.cl" rel="noreferrer" target="_blank">gemm.cl</a><br>
><br>
> /opt/clang-3.9/bin/llvm-link gemm.ll /opt/libclc/lib/clc/verde-amdgcn--.bc<br>
> -o gemm.linked.bc<br>
><br>
> /opt/clang-3.9/bin/clang -target amdgcn gemm.linked.bc -S -o gemm.verde.s<br>
><br>
> Now what should I do with the assembly file (i.e., 'gemm.verde.s')?<br>
> Can I use an assembler such as GCNASM (<a href="https://github.com/balidani/gcnasm" rel="noreferrer" target="_blank">https://github.com/balidani/gcnasm</a>)<br>
> or CLRadeonExtender (<a href="http://clrx.nativeboinc.org/" rel="noreferrer" target="_blank">http://clrx.nativeboinc.org/</a>) to generate a binary<br>
> compatible with AMD Catalyst?<br>
> I tried using both assemblers and they both complained with many of the<br>
> instructing generated by Clang.<br>
><br>
> Can you give me some pointers on how to progress?<br>
><br>
><br>
<br>
</span>Hi,<br>
<br>
clang uses an integrated assembler for the amdgcn target so you can<br>
compile directly to binary with clang.<br>
<br>
These binaries are not compatible with catalyst.<br>
<br>
If you have one of the GPU/CPU/Motherboard combinations supported by the<br>
Radeon Open Compute (ROC) driver (which can be found here:<br>
<a href="http://gpuopen.com/compute-product/rocm/" rel="noreferrer" target="_blank">http://gpuopen.com/compute-product/rocm/</a>), then you can use the<br>
ROC apis to upload an execute code.<br>
<br>
You can find driver installation instructions for ROC here:<br>
<a href="https://github.com/RadeonOpenCompute/ROCm" rel="noreferrer" target="_blank">https://github.com/RadeonOpenCompute/ROCm</a><br>
<br>
There are a few examples here that demonstrate how to use the API<br>
to upload code:<br>
<a href="https://github.com/RadeonOpenCompute/LLVM-AMDGPU-Assembler-Extra" rel="noreferrer" target="_blank">https://github.com/RadeonOpenCompute/LLVM-AMDGPU-Assembler-Extra</a><br>
<br>
You can actually combine all the commands you used into a single<br>
invocation, like this:<br>
<br>
${CLANG} -x cl -Dcl_clang_storage_class_specifiers -target<br>
amdgcn--amdhsa -mcpu=fiji -B -Xclang -mlink-bitcode-file -Xclang<br>
$BITCODE_LIBRARY -include $BITCODE_LIBARY_HEADER -o ${f}.co<br>
${CMAKE_CURRENT_SOURCE_DIR}/${f}.cl<br>
<br>
<br>
Since you are using a tonga, which isn't officially supported by ROC,<br>
the only way you can execute the code is by using the Open Source<br>
OpenCL implementation known as clover, which is part of Mesa.<br>
For more details see here: <a href="https://dri.freedesktop.org/wiki/GalliumCompute/" rel="noreferrer" target="_blank">https://dri.freedesktop.org/wiki/GalliumCompute/</a><br>
Also, if you want to compile code using clang for clover, you<br>
need to use the amdgcn-- triple instead of amdgcn--amdhsa.<br>
<br>
<br>
However, the binary format accepted by this implementation is<br>
a container which includes the code output by clang in addition<br>
to some other information.  If you do want to use clover, it will<br>
be easier to just to use the OpenCL APIs to compile the kernel<br>
for you.<br>
<br>
Note that clover is not a complete implementation, so there may be<br>
things that don't work if you try it.<br>
<br>
Let me know if you have any other questions.<br>
<br>
-Tom<br>
<br>
<br>
<br>
<br>
<br>
<br>
> Ricardo<br>
<br>
> _______________________________________________<br>
> Libclc-dev mailing list<br>
> <a href="mailto:Libclc-dev@lists.llvm.org">Libclc-dev@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/libclc-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/libclc-dev</a><br>
<br>
</blockquote></div><br></div>