<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/54633>54633</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[NVPTX] bad binary since cuda-11.3
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ye-luo
</td>
</tr>
</table>
<pre>
My application fails with wrong numbers when using cuda >= 11.3 toolchain.
source and assembly code
[badcubin.zip](https://github.com/llvm/llvm-project/files/8376272/badcubin.zip)
```
psi_list_ptr[iw] = psi_local;
```
both sides are std::complex<double>. Bad binary caused the imaginary part of the left hand side has value 0.
`--save-temps` assembly files from CUDA 11.2 and 11.3, they differ only by
```
diff cuda11.3/MultiSlaterDetTableMethod-openmp-nvptx64-nvidia-cuda.s cuda11.2/
5c5
< .version 7.3
---
> .version 7.2
```
If I compile the whole application with CUDA 11.3 toolchain, test fails. Since my application is OpenMP offload, the nvptx pass invokes ptxas, If I use ptxas from CUDA 11.2 to generate cubin for the failing file and all the rest uses CUDA 11.3. my test passes.
So my guess is the nvptx backend and ptxas (>=7.3) have some incompatibility and caused bad binary. I just leave my analysis here, hopefully backend experts will have more ideas.
Q: Is there a way to force clang to generate assembly files with a different PTX version? In this way combined with `--ptxas-path`, I can use an alternative ptxas while the rest remains with the primary CUDA toolkit I need to use.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyVVMFu4zgM_RrnQthw7ThpDj60zRToobuz6OxgbwPZomNNZcmQ5KTZr19SdqbpoJcFnNgmLfLx8ZGNlef6-QxiHLVqRVDWQCeU9nBSoYeTs-YAZhoadGTq0cDkFZnaSQpIyi9JuYebm6yEYK1ue6FMluT7JL_zdnItgjAShPc4NPoMrZU4e5PqvhGynRr6_l81JtU-KW77EEaflHdJ8UjXgfJPTdbagV60Pl5u6ejsT2wDvXZKo6f7bbndFNuCnj4ELXZLsk2-XPF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