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

    <tr>
        <th>Summary</th>
        <td>
            [mlir][vector][spirv] Support lowering multi-dimensional vector.from_elements to SPIR-V
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            mlir
      </td>
    </tr>

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

    <tr>
      <th>Reporter</th>
      <td>
          yangtetris
      </td>
    </tr>
</table>

<pre>
    ### Background

https://github.com/llvm/llvm-project/pull/151175 supports lowering multi-dimensional `vector.from_elements` operations by first unrolling them to 1-D `from_elements` operations and then applying the 1-D `vector.from_elements` lowering pattern.
https://github.com/llvm/llvm-project/pull/142944 introduces a new canonicalization pattern that compresses a series of `vector.insert` operations into a single `vector.from_elements` operation.

### Issues

The above two PRs work well for the LLVM backend, but, as this [discussion](https://github.com/llvm/llvm-project/pull/142944#issuecomment-3200609238) said, we are uncertain whether `UnrollFromElements` work correctly for the SPIR-V backend. I attempted to verify this myself, but the lack of SPIR-V knowledge prevents me from making meaningful progress.

I would greatly appreciate if SPIR-V experts could help check whether the current implementation works correctly. If it doesn't work, please help implement the necessary SPIR-V lowering support. Thanks a lot.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJykVF2r4zYQ_TXKy3CNLUf29YMf7u1tILCFZXe7r0WWx7YaWRLSOGn664vsJHcp7dKyEFAw83HOmTMjY9SjRWyZeGXibScXmlxor9KOhBR03HWuv7aMl9sPXqU6jcEttmf5C8tfJiIfWfnC-IHxw6hpWrpMuZnxgzHn-_Pkg_sdFTF-8IsxjB8KURS1gLh47wJFMO6CQdsR5sWQfur1jDZqZ6UBVuVnVORCNgQ3_4YGZ7QUWZWD8xgkaWcjdFcYdIgEiw3OmFSKJpyBHBRPb6nI97Kl7VO4Bem9ud6S74n_1v2B2UsiDDb7ET32vNnvQVsKrl8URpBg8QJKWme1kkb_uUK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