<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/77627>77627</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[mlir][spirv] Replace hardcoded attribute strings with op methods
</td>
</tr>
<tr>
<th>Labels</th>
<td>
good first issue,
mlir:spirv
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
antiagainst
</td>
</tr>
</table>
<pre>
Due to historical reasons we have quite some hardcoded strings for attribute names used in parser/printer and serializer/deserializer. Now in ODS we actually generate op methods for getting the names of attributes. It's better to replace the hardcoded strings for consistency. Specicially:
- [ ] Replace parser/printer attribute strings [here](https://github.com/llvm/llvm-project/blob/main/mlir/lib/Dialect/SPIRV/IR/SPIRVParsingUtils.h#L23-L50). For example, `branch_weights` can be replaced with `getBranchWeightsAttrName().strref()`.
- [ ] Check and replace such patterns in serializer too, e.g., [here](https://github.com/llvm/llvm-project/blob/main/mlir/lib/Target/SPIRV/Serialization/SerializeOps.cpp#L701-L743). Need to check all the files in serializer library. But don't need to change the autogenerated ones given those are consistent for sure due to autogen.
- [ ] Do the same for deserializer.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0VE9v48YP_TSjCxFBGlnS-qBDHMFAgCC7SH6_9lhQEiVNO55Rh1TS9NMXGsfrdNNLD71Y4JiPfx4ficxmckSNKg-qbBNcZfahQScGJzSOJen88Na0K4F4mA2LD6ZHC4GQvWN4JZjxheD31QgB-9Nmh6H3Aw3AEoybGEYfAEWC6VYhcHgihpVpAONgwcAUlD4uwTihAOgGYAoGrfkz_jHQ1Uzh0b9usK_t85Ybe1nR2jeYyFFAIfALnEhmP5zTTiRi3AQyXxL78VoLp3AvStcMHcmWXDwEWiz2FBH_3ErvHRsWcv1bCs8L9aY3WxGquFVZq7L33xtQ5QFU2cLTe8jPvX4n5RJflYeZAqmyVfrLLLLwFlUflT5ORua1S3t_Uvpo7cvlc7ME_yv1ovSxs75T-nhC47aPNVsya7a31qA9Oz1_u3_6Senj_dPF-IaBjZv-L8ZyOitdPOji5qHMlN6ncPQB6A88LZaUvgNVZV1A18-_vJKZZmFVZdCjg44u1A3wamTePCeSQ3T--ex7KxIe8URKf9lis4RA49lQVZb-yNvdTP1vURCXofDaz7DgNivHmw6u0gDxfiuQ0imNhf5XTP4Pw0QfiXx-rwHFePfBpq8Lp_2ybITWWX7zUO-KSOkj0bBJrT_3Z20U22gs_diTNV3A8JbCYRUYtui1gPsORzedhYqr-MsKDOAdMUzmhRzI7JkAA11VK1HEvAaC4bzX7-hP_Lc-Bmc8UcT8fROToSmGfbHHhJq8znb7rC5zncxNVnX7vshLPY5lOX4Zql1V0aixqIp9UeV5Yhqd6V2W51le6zLXaV5QNVbjLt_rEgus1C6jExqbblNJfZgSw7xSU9eVrhOLHVmON0vryfsBRhNYIPoorZW-U1rHmRW3vJjwsj2WbRKaOOVunVjtMmtY-JpBjNh4CCOwbFV5OGM_LPD1Hnze3Kj56_VJ1mCbfy272AIrfYyd_hUAAP__z_bhLw">