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

    <tr>
        <th>Summary</th>
        <td>
            [SPIR-V] Handle vector types in HLSL RWBuffers
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            backend:SPIR-V
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
            s-perron
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          s-perron
      </td>
    </tr>
</table>

<pre>
    The representation of a RWBuffer in llvm-ir uses a `spirv.Image` target extension type. That target extension type corresponds exactly with the `OpTypeImage` instruction. The instruction has a sampled type, but it must be a scalar type. The difference between `RWBuffer` with a scalar template and one with a vector template is the result type on the load and the type of the object being stored in a store. See https://godbolt.org/z/b99G474TE for an example with a vector template.

We need to fix the type scavenging for the calls to `@lvm.spv.resource.getpointer`. They currently set the type of the pointer to the scalar type. It would look at the use to determine the type.

</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJx0U02P4zYM_TXyhRjDlj-SHHyY7TbdARZosRN0z5JF2-rKkiHSmUl_fSEnk5l-nWyJ5ON7T6QisqNH7ETzSUhJDwvGGLyQUjSfM7XyFGL3dpvpYC7daUKIuEQk9KzYBg9hAAXfvn9ahwEjWA_OnecHG2ElJFAg2oIWG8_506xGFG0BrOKIDPjK6ClB8GXBHE6T4v-OQR9iRFqCNwT4qnp2F3ixPAFPmBr8upwuC94bWE8c1z7RS7D48QImlViRmheHZoMX8ifQK4NlmFdi0JgSeuVUvFNDMDYJRN8jaOQXRJ86vwlPbTdG75U4L04xgvIGgse38Bl7Dh_CljYVEWl1fJWbZE8ILiizVafDNTBs_0H_gX3iaf0IxCGiScar638Oz4gwMS8kqkchj0Iex2B0cJyHOAp5_FPIoz4cfql39elnGEIE5ZOvyZL_oZmL4lEUj98RPCbbAgz29Z0Y9eqMfkx8Ely675VzlBJFW4i6cOc5p-WcR6Swxh7zEXkJ1vPm3WbxBfo1RvTpdQn5X7Jv6QkzHf_2Qk8ML2F1BlwIP0Bdi1fClGyQMc7W4x0xqclMV5lDdVAZduWu2h32-31bZ1MndWGaqmnrvTbYDn3bDEpXTdsOuqlLfchsJwvZFKXclXVdFnW-PzRS1_ud1iVWtVGiLnBW1uVpFZLnmSVasStl3TRl5pRGR7et06r_gd6I6vH5t6dvD7_fti922xrpdaRkniWmdzS27LatvZU0n-GL8sbh_dUuC1IaiS9fn7_el5OyNbruH4NheVp13odZyGNqcPs8LDGkIRPyuHEnIY83-udO_hUAAP__YtNw8w">