This is an archive of the discontinued LLVM Phabricator instance.

[mlir][linalg] Use attributes in named ops' indexing maps
ClosedPublic

Authored by antiagainst on Jan 8 2021, 12:47 PM.

Details

Summary

This commit adds support for parsing attribute uses in indexing
maps. These attribute uses are represented as affine symbols in
the resultant indexing maps because we can only know their
concrete value (which are coming from op attributes and are
constants) for specific op instances. The indxing_maps()
calls are synthesized to read these attributes and create affine
constants to replace the placeholder affine symbols and simplify.

Depends on D94240

Diff Detail

Event Timeline

antiagainst created this revision.Jan 8 2021, 12:47 PM
antiagainst requested review of this revision.Jan 8 2021, 12:47 PM

There are a few typos in the commit message.

Update commit message

antiagainst retitled this revision from [mlir][linalg] Use attributes in indexing maps to [mlir][linalg] Use attributes in named ops' indexing maps.Jan 12 2021, 8:32 AM
antiagainst edited the summary of this revision. (Show Details)
hanchung added inline comments.Jan 12 2021, 9:45 PM
mlir/tools/mlir-linalg-ods-gen/mlir-linalg-ods-gen.cpp
375

nit: return emitError...?

1948

Do we want to add a message to this assert, like assert(... && "expected ...")?

nicolasvasilache added inline comments.
mlir/tools/mlir-linalg-ods-gen/mlir-linalg-ods-gen.cpp
474

s/red/read

520

Could we please rephrase as:

The affine parser introduces new dims and symbols eagerly as they are discovered.
With the additional support for attr uses, not all ids are eagerly discovered.
For a parsed `id`, the resolution mechanism proceeds as follows:
1. Try to parse `id` as an attribute use.
2. If unsuccessful, try to match `id` to a known dim or symbol.
3. If still unsuccessful, eagerly create a new dim or symbol and add it to the known dims or symbols.

+/- what you find appropriate?

1964

replace symbols by the corresponding attribute value.

This revision is now accepted and ready to land.Jan 13 2021, 12:17 AM
antiagainst marked 5 inline comments as done.

Address comments

This revision was landed with ongoing or failed builds.Jan 13 2021, 7:08 AM
This revision was automatically updated to reflect the committed changes.