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

    <tr>
        <th>Summary</th>
        <td>
            [mlir] 'affine.load' op usage in different version
        </td>
    </tr>

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

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

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

<pre>
    I was trying to compile the following MLIR code`relu.mlir` to be executable.
```

module {
  func @relu(%arg0: memref<1x1x28x28xf32>) -> memref<1x1x28x28xf32> {
    %cst = arith.constant 0.000000e+00 : f32
    %0 = memref.alloc() {alignment = 16 : i64} : memref<1x1x28x28xf32>
    affine.for %arg1 = 0 to 1 {
      affine.for %arg2 = 0 to 1 {
        affine.for %arg3 = 0 to 28 {
          affine.for %arg4 = 0 to 28 {
            %1 = affine.load %arg0[%arg1, %arg2, %arg3, %arg4] : memref<1x1x28x28xf32>
            %2 = arith.cmpf olt, %1, %cst : f32
            %3 = arith.select %2, %cst, %1 : f32
            affine.store %3, %0[%arg1, %arg2, %arg3, %arg4] : memref<1x1x28x28xf32>
          }
        }
      }
    }
    return %0 : memref<1x1x28x28xf32>
  }
}
```
When I run `mlir-opt  --convert-affine-for-to-gpu relu.mlir`,  I got this error --
```
relu.mlir:9:18: error: 'affine.load' op index must be a dimension or symbol identifier
            %1 = affine.load %arg0[%arg1, %arg2, %arg3, %arg4] : memref<1x1x28x28xf32>
                 ^
relu.mlir:9:18: note: see current operation: %13 = "affine.load"(%arg0, %11, %12, %arg13, %arg14) {map = affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)>} : (memref<1x1x28x28xf32>, index, index, index, index) -> f32

```
Then I rewrite the `affine.load` op in line 9 to be 
```
%1 = "affine.load"(%arg0, %arg1, %arg2, %arg3, %arg4) {map = affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)>} : (memref<1x1x28x28xf32>, index, index, index, index) -> f32
```
But the same error occurs. I looked up the MLIR documentation, and  the syntax  is correct. It would be very nice to get some help with debugging this since I am not familiar with this area myself, thanks.

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzVVkuPozgQ_jXkUgLxCOlw4NCP7Kql2V1ptdIeRwYXxDsGI9tMkn-_ZUM6ZDad6ctKMy3S2Ljqq4e_KrtS_FS-woEZsPok-hasglp1g5AIdo_QKCnVwS389un1T1riGGxijXKMOik0jZ1GhYBHrEfLKolREL8E8SMtzc809f87xUdCDh6epjlAM_Y1BGsPGaTbIM2ZbuMge4QOO41NkD0nx-SYbt3TZGmQ7YK0gJDe70ssDQAQZm0sBNkLMC3sPqpVbyzrLcRR7P8wSJ_iGJxVB7DUjL3eZClilIzae1k4E0yKtu-wn7CTjQcQm3Xw8AL3I3izwJpG9Bg1SsMUeuKxfFaT6zBuCKd3hG-IZxfxdPtf-Rsa6-9p-BxNPs_KUjEO523Mn-aogvT57PNlmF2G6yD_cM4WltPlrnZDA0raGfRsctr6bzZ2AZEtIAxKrK0Hvmif8d5HmSM3Vmn0kLPK_xo_kez60zcfrqZXE4121P2Z3B8w-aZ9GVwX99977OEV9Eiom9g1hlANFiAMqdS-orbhlKKQmBVaFbbDCMse4vJA-q2y1HSEAdSaKBiGN41dFLPHgn7J1gXhVdwgSB8WTKQZqAFEz_EI3UhcoF7FgAsqWyNUD2THnLpKSRCcKlk0AvWPRPLJfL67F3uvLLq3QYR61Np1JDWgZpYinHKSJxPPgzS9yk666Lkzz89hJIsgkkUUyXpufx0bFjn5TFOKiPC4h-Ieh3sQnr317PfXXfhz4yShO93_edrOu4PZ2lu53mTSXzNt8UDVP513tLbMDx1vnj0g6RMU81l3-4A7U-T7Kf4YV37CJF9n5Gm0PqeGdTiXtKqJnyaipEulviCHcfAi_nLBVT2603SiLZlhPYcJ4URfjwDUGmpF_K4tQVg4qFFytyHUYk7QixrdBrVowSgyuUc5wIH6OnCsxr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