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

    <tr>
        <th>Summary</th>
        <td>
            [mlir][spirv] Support function argument decorations
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            help wanted,
            good first issue,
            mlir:spirv
      </td>
    </tr>

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

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

<pre>
    We need to support function argument decorations in `spirv.func` to allow for some pointer types. For example, the spec requires the following:

> If an OpFunctionParameter is a pointer (or array of pointers) in PhysicalStorageBuffer [storage class](https://htmlpreview.github.io/?https://github.com/KhronosGroup/SPIRV-Registry/blob/main/extensions/KHR/SPV_KHR_physical_storage_buffer.html#Storage_Class), then the function parameter must be decorated with exactly one of Aliased or Restrict.

> If an OpFunctionParameter is a pointer (or array of pointers) and its pointee type is a pointer in PhysicalStorageBuffer [storage class](https://htmlpreview.github.io/?https://github.com/KhronosGroup/SPIRV-Registry/blob/main/extensions/KHR/SPV_KHR_physical_storage_buffer.html#Storage_Class), then the function parameter must be decorated with exactly one of AliasedPointer or RestrictPointer.

Note that this is already supported with the `spirv.Variable` op using the following syntax:
```mlir
    %3 = spirv.Variable {aliased_pointer} :
      !spirv.ptr<!spirv.ptr<f32, PhysicalStorageBuffer>, Function>
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsVcGOqzYU_RqzuRoEdiDJgsXM5NH39KR2lJGmy8jgC7g1tmubyfD3lQnJNFVVVVWXlSIijjm-x-fcC9x72WvEihRPpDgkfAqDcdWv08Bd0hgxVz8jaEQBwYCfrDUuQDfpNkijgbt-GlEHENgaxyPmQWogZeatdO9pfJKUWSRzpcwZOuPAmxHBGqkDOgizRZ9CbRzgBx-tQkKfIQwI3mILDn-bpEO_IJ2Je0jdE_ZIsgPJrlf2Bb51wDX8ZOtV2wt3fMRYQXrgt3KE7owD7hyfwXRX2BO6j7pfhtnLlqvXYBzv8WnqusgpnvwFgFZx70lxIHQ3hGB9FEJrQushjMo6fJd4TnsZhqlJpYlLrL5_cF1szUho_X1wRhv_gzOTJbR-ffl2fHs4Yi99cDOhdaNMQ2g9cqkJrfEjoPbR40j9elwYb6fvX48nuwo_rUJPzSI9jbIIZet5Ts-LfLpfLdYXV69p2ptl4-QDNHiNFQWcZRhiQG1QMxiN0bxHJblHAcbBEX1wsg3pfx8L1wJk8CuGS8Pck_8P7t8F97L694f8Vuguxh9NQAgDDxAG6RfrlUMu5uv74FolarpN_ht3kjcK4_QbC5OXur8fYvCzDvzjc5bL7PIblXQXCACA0IIBYQe43xfI9olfznFaG4FsD3DbDeBCzi80Gxxhz3-67RiNhv5l8xD2Ja5d-zbe3qtMRMXEnu15glW-zVies2K_T4aqo5u8aAvKinwrMiqypilZvkMmmNhkhUhkRTPKchqvWcn26W5TMsrLXVGKhnaiJZsMRy5VqtT7mBrXJ9L7CattmWdloniDyi8vbEoHVBbOXAcUhMbTEEp7YwR00vkAC--2sBjLHhcLIlgcElfFGg_N1HuyyZT0wX9WDTKo5cuwEItDnKeFWxzg9Z98C5LJqepvxihWWv8erDO_YBsIrRfRcVSW8_4eAAD__4UqOmY">