<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/127241>127241</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [AMDGPU] error running program when compiled with asan
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          zyx-billy
      </td>
    </tr>
</table>

<pre>
    I'm working on adding asan when emitting for amd gpus using the upstream llvm backend. Right now I'm doing these things:
- Add +xnack to target features
- Enable AddressSanitizerPass in the llvm pipeline

And when running the program, I explicitly link the asan libraries, and enable xnack:
```
LD_PRELOAD=/opt/rocm/lib/llvm/lib/clang/18/lib/linux/libclang_rt.asan-x86_64.so:/opt/rocm/lib/asan/libamdhip64.so
ASAN_OPTIONS=detect_leaks=0
HSA_XNACK=1
```
But I run into this error when trying to invoke a kernel:
```
hipErrorNoBinaryForGpu (no kernel image is available for execution on the device)
```
Removing the asan llvm pass makes the program run fine (but of course, it won't detect any errors), indicating that everything else seems to work. I also tried linking asanrtl.bc, ocml.bc, & ockl.bc into the IR before running llvm passes (following the impl [here](https://github.com/triton-lang/triton/pull/5127/files)), but got the same error.

My questions are:
- Are there any other configs that should be set when compiling?
- Is there any way to tell what exactly is incompatible when running? That'll help narrow down what to do.

Happy to provide more context. Thank you!
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJx8VUFv4zgP_TXKhWhgy3GSHnJwJ81M8M20RTsfsLdAtmibG1nySnISz69fSE7aYnaxQFFYNkU-vvfICOeo0Ygblj-wfDsTg2-N3fwaL3clKTXOSiPHzZ7xVQdnY4-kGzAahJThSTih4dyiBuzI-_CqNhZEJ6HpBweDC698izD0zlsUHSh16qAU1RG1nMMrNa0Hbc4wlZDmesEh-JZ041hWsKS4g0JKYPzhokV1BG_AC9ughxqFHyy6GPOoRakwhFp07k1o8vQL7Ytw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