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

    <tr>
        <th>Summary</th>
        <td>
            Improve sparse reshaping
        </td>
    </tr>

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

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

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

<pre>
    We have functional reshaping support for sparse tensors now, i.e.

(1) when source or dest is dense, rely on the cheap "view" change of the dense operand, and convert the sparse source or dest
(2) when both source and dest are sparse, perform the reshape with data shuffling.

Although this gives the right semantics, and using time proportional to nnz for sparse parts, we could do better. Both the reshuffling itself could be improved or, even better, perhaps we can introduce a "view" into a sparse storage scheme and avoid the data movement altogether.

Relevant revisions:
https://reviews.llvm.org/D129416 [mlir][sparse] implement sparse2sparse reshaping (expand/collapse)
https://reviews.llvm.org/D129031 [mlir][sparse] implement simple reshaping (expand/collapse)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyVU8GOmzAQ_Rq4jIrAJGFz4JBttFKvvfRsYAC3xkYeQ7r9-o4N2d300lZCGI89b957MzS2e62_IYxyRegX03pljdTgkEY5KzMALfNsnYfeOqBZOkLwaMg6AmNvifgMKsMsya9Jftnf4qlIxBluIxogu7gWgZM7JA-KeDWEIc-hfgVrwI8I7YhyhkSIVSGDCg5IM3BeH49jDtgZnTRdyOUFWmtWZGbhws7ssdobHfFGp7F-vN8KGJGUdHeAAM1FWOsUYTcbEG6K0zrpJdC49L1mYx4kX7Qf7TKMnMQKB7UibflqGD0QTtJ41dKd-ULBWa8mhNnZYO_murdgzK-PVvPbx7Qbe2QXzYwtNOg9ugyeg5g7zZ0WKE-o-_1yg6AmLrFix6YEHFyDCxFgF8sCKcJLA8p4Z7slmPOxGRy2HLmb7K2T3Bvipk2bjXK1qts6FUyauOCEhp3V3g7Icfdg11fUuLIlTHxVxNopKfej0fs57sQLP-Ecb5RpvU6ZdQOHroU4H4oTJMfnSSuXHK_8tXfveA1y9VZ7i4md9PtA8zzgzznO0UtrtWb53Pfzf5TPy-IfysfPv9dNu7rszuVZpl55jfWXrV_wJ-90cbp-pDfwVC5N1tqJN4HjvnxihO_Yet4qogV5gF6Op0NVpWONXZlXRVEdj7JpZd-fRN6emr5qOdDnVZ9q2aCmmlVx56PE8nL_OQRLTFUtciECSHEu8rzMykN1PFTl4Umc5OnUNMkh54FX-s221NWRVrMMxIdakX_3NJVEajCIsSTjy4X_JVdLnvxG_UijgjrS_w0qnJO0">