<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/94864>94864</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[MLIR] Incorrect result for RuntimeVerifiableOpInterface on MemRef::ReinterpretCastOpInterface
</td>
</tr>
<tr>
<th>Labels</th>
<td>
mlir
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
chentong319
</td>
</tr>
</table>
<pre>
The upper bound check is wrong.
Simple example:
```
%reinterpret_cast = memref.reinterpret_cast %arg0 to offset: [0], sizes: [12, 64], strides: [64, 1] : memref<768xf32> to memref<12x64xf32>
```
Obvious, 768 = 12x64. But the result contains `assert(false, ...)`.
I did some investigation. The generated upper bounds for base and result are 668 and 732 . The indices used to compute the upper bound are [768] and [12, 64]. I think that the indices of last element should be [767] and [11, 63]. In general, the index of a dimension starts from 0 and ends at size-1.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxsk8GOpDYQhp_GXEqDjAFDHzj0TKellrJaaRLlGhm7AGeN3bKLySRPH5lmdidKJCSLv-yv_Fe5VEp29ogDa59ZeynURkuIg17QU_BzXZ2KMZi_hl8XhO1-xwhj2LwBvaD-BmAT_BmDn0vGL4yff7Hr3SHgu8orq88PmUl-fPsvMNFGtJ4w3iPS71olAlZfYMU14lT-NyZaFWcOFCBMU0Ji9RlY-8xZe2HiBZL9G9OhVSIrsvkIUbTme1A2WatYe4GsPPKx-qWT_ftUC1b_lHN8lyvxLpsj8L9Ovo5vNmwpQzvZ7x72MyU8bwS0IERMmyPQwZOyPgGTXKWEkZjoJ-US5rNlWTJxYpIfZTzKdANjDaSwIlj_honsrMgGX0LuxoweoyI0n_uSYAoRRpUQlDcf2VVEACn7XetqAQ-C9cZqTLAlNNm3Dut9I9zv_bnX-ThrnzvZ58Jlxr_rXMINaLH-G9CiHrY_0GEClzuIDlf0BGkJmzMwHsDuM7DagfUD6A9_LosHEd8zT4GxK_pkg4dEKlKCKYYV-A7CXANF-5N4qsrCDLU51SdV4FB1VdfLU8VFsQxG65PketKq7nmnkJ9q2VR1IxGxMa0u7CC4aLjkfdW1VSNKLbCrtZwEn4wwU8cajquyrnTubS1DnAub0obDqellUzg1okv7VAmxOhuZEHm-4pC3P43bnFjDnU2UfgDIktsn8cvPt9dcmpvXIUbU9NHJ3N3XzZNd8TeMdrJqdPj1fsvzMimNEDx8wfU1P98zq8-vP0bpRSX6tLPYohsWonueDSauTFxnS8s2ljqsTFzzpY7l6R7DH6iJietuMTFxfbh8G8Q_AQAA__-33lUv">