<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/75147>75147</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
The cuda object file compiled by clang cannot be recognized by nvprune.
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
zq1997
</td>
</tr>
</table>
<pre>
As the title says, when compiling CUDA source file with Clang, its object file cannot be recognized by nvprune, and the error is: `nvprune fatal : Unexpected fatbin data`.
```cu
// foo.cu
#include <cstdio>
__global__ void foo() {
printf("CUDA kernel runs successfully.\n");
}
int main() {
foo<<<1, 1>>>();
cudaDeviceSynchronize();
return 0;
}
```
with nvcc (everything is normal)
```sh
nvcc -gencode=arch=compute_70,code=sm_70 -gencode=arch=compute_80,code=sm_80 -c foo.cu
cuobjdump foo.o
nvprune -arch sm_80 foo.o -o foo.stripped.o
cuobjdump foo.stripped.o
```
with Clang(everything is normal)
```sh
clang --cuda-gpu-arch=sm_70 --cuda-gpu-arch=sm_80 -c foo.cu
cuobjdump foo.o # also OK
nvprune -arch sm_80 foo.o -o foo.stripped.o # nvprune fatal : Unexpected fatbin data
```
Operating system: Linux (tried both Centos and Ubuntu)
Software version: CUDA version or Clang version doesn't matter, this is almost always reproducible.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVEtv2zgQ_jXUZSBBomI9Djqk9vqyC_TQzdmgyJHELkVq-XDq_voFJSWNi3SLAIQf8_iG_GbmY87JUSN25PCJHE4JC34ytvv-b9G2ddIbceseHfgJwUuvEBy7OUKP8DyhBm7mRSqpRzg-nR7BmWA5wiAVwrP0ExwV02OMlt6B6b8i95uXM62Nhx7BIjejlt9RQH8DfV1s0BhTmBZrWbTWWJCOlI9AqnyPgIF5pgAgmp80fluQexTR3EsNgnlGqjwj-Ynkj_tnlW-Hh91Az4SeYTAm-2EqpeYqCARSHrnzQhpS_vEW5nIZlemZulzgaqSI6YQ2hLZA6k9bCADAYqX2w-qhKzn_oNWowAbtwAXO0bkhKHXLyOGoCaWEtqTcAUh9eltSag8zk_q9OrF8edxOEXkr4n23s4a_ggIPgp3wKjl-uWk-WRNp_zkIACz6YDXk71znhcK3t1s7ra-cA6ENXtHe_BRHQjrQxs5MRfz7dDdthjUrHVFzI5CUJ2b5RMpTHKvg8VLnhB53l5svdf4_sc19bJNDyu9ay4Ppv4owL6vVvFxgm6Y0osGWt7ohNesP561cFhQvCfcoP3t_zc--CR_kh8csSNPYuXRcQro_eifjPftvHw5AaAlMOQOf__wwC1v2B5bw17x8XtAyH5lwN-dxjiB_SR2-xTnyVkZFMJE61N64VQ-e-qB9eOXrixn8M7MIV7ROGh0R1l3b_4OxG_GvBmHQaULruE_eo40L4yfpYjOYmo3zwNQzuzmwuFgjApe9wiwRXSnasmUJdkWd07JqyqJNpo4LNvCHgdKDqGmP-YAPB9E3tKkrWrOqSmRHc1oWtKB5kx-KNsOqZi2tD70om7KpOHnIcWZSZUpd58zYMZHOBezqQ_FQJ4r1qNyqzZTybYZolGnbxfi0D6MjD7mSzrsfCKtSd39PuK78vfCuir2J7TZdv5HiLAlWdZP3S1TgTTJH6afQZ9zMhJ5j1f0rXayJpQg9r49whJ7Xd_wXAAD__9rn-7U">