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

    <tr>
        <th>Summary</th>
        <td>
            [MLIR][Linalg] mlir-linalg-ods-yaml-gen generates code relying on textual parsing
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            mlir:linalg,
            mlir
      </td>
    </tr>

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

    <tr>
      <th>Reporter</th>
      <td>
          joker-eph
      </td>
    </tr>
</table>

<pre>
    ```
ArrayAttr Mmt4DOp::getIndexingMaps() {
  static const char memoizeAttr[] = "linalg.memoized_indexing_maps";
  ArrayAttr cached = getOperation()->getAttrOfType<ArrayAttr>(memoizeAttr);
  if (cached)
 return cached;

  MLIRContext *context = getContext();
  auto symbolBindings = getSymbolBindings(*this);
  SmallVector<AffineMap> maps;
 maps.push_back(llvm::cast<AffineMapAttr>(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5)[s0, s1, s2, s3, s4, s5] -> (d0, d2, d3, d5)>", context)).getValue());
  maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 6, 0));
 maps.push_back(llvm::cast<AffineMapAttr>(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5)[s0, s1, s2, s3, s4, s5] -> (d1, d2, d4, d5)>", context)).getValue());
  maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 6, 0));
 maps.push_back(llvm::cast<AffineMapAttr>(mlir::parseAttribute("affine_map<(d0, d1, d2, d3, d4, d5)[s0, s1, s2, s3, s4, s5] -> (d0, d1, d3, d4)>", context)).getValue());
  maps.back() = simplifyAffineMap(maps.back().replaceDimsAndSymbols({}, symbolBindings, 6, 0));
  cached = Builder(context).getAffineMapArrayAttr(maps);
 getOperation()->setAttr(memoizeAttr, cached);
  return cached;
}
```


The generated code for `getIndexingMaps()` relies on textual parsing to build affine maps: that is close to a layering violation to me: the C++ code involved outside of strict textual parsing phase should never rely on textual parsing for building IR entities. 

</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzsVl2P2yoQ_TXkZZTIBjsfD35wkl1ppa5Waqu-rjBMbFpsLMBRc3_9FeBsstt9v6p0JYs4-MzhzBk8hjun2gGxIuWelMcFn3xnbPXT_EK7xLFbNEZeKrLO5iura2v5pfbewnPvi-PLSFhNWN2ifxok_lZD-8xHR-iW0B2QzZ5kNYDz3CsBwgzOg-i4hR57o_7BQJSWBsKOQCjVauC6Xc3P5auaWV_7SEsJS5Q3HYKLDmWMb9G_jGi5V2ZIEpaEPbToA_Dl9P0yImGHt1DCHgjd3kuhuyu_OgGh28QdprMaLPrJDvN6CRehz1-evh7M4PG3B0Jrcb1NguYnSc6VnU_egLv0jdF7NUg1tO6K__ZuNobVvlPuLvpbz7X-gcIbG9I5ndSAz3wk7AGiSwkWblfj5LrXhotfhG61PvepWoI7fx95Z4ZWNmFGbl00RTWTx6iD8hgQSkHYgdCtzAg9gMzjSOPI4ljEsQyay72LKBdRLqJcRLmIcmWofqgT3BjvuSJLEBcnxdXOHaG7VYv-B9cTzu7eLIrJz3nHnciO4FQ_anW63Ayj2w-4lcVRc4FH1bt6kKkWsQibPdkco94P9TnAOgzZu_X_Tu_vuYr_vf8P9n3-nuuv8_6-Ge8npSXa0EXftAfhN_ff-nDSc6P5vI-71Mc_tuwD3Lr0rOKzTr05hvHuS5au7x1Ci0NYDCUIIxFOxgJZZ59-0sg6A4taoQMzQMhq4hrCnlFDC95AE7KGtGHmblyD77gH5UBo4zCgOGh-QRtizsromGiY7zHBEQ6E7gndJ0VqOBt9Rglm8k5JBHMC560S_g8JY8cdguvMpCUMeEYb9F4-UxvyjHLDn6evgINXXqFbAcnqhayY3LEdX2CVbwpW0DXdZouualAyUWa4K5omz09rzoXMKd0W2WlL141cqIpmtMwYy3OWFWy32obQQuSUUhS7rCRFhj1XehVezJWx7UI5N2GVM7bJi4XmDWoXTySUzu9lOhWkV-E6S2k4sdgqsCybqXWkyLRy3t14vfI6nm3CJ5qUR1LuvySm8giBZJmIl0a65YX3etni8LYdXDI_2Bcc-tPBxWR11Xkfi0zoI6GPrfLd1KyE6Ql9jI0n_SxHa36i8IQ-xmQdoY9zvueK_hsAAP__J_7m1Q">