This is an archive of the discontinued LLVM Phabricator instance.

[mlir][tosa] Add lowering for tosa.scatter to linalg
AbandonedPublic

Authored by rsuderman on Sep 7 2021, 3:30 PM.

Details

Summary

TOSA's scatter lowering is implemented by reducing accross the batch dimension.
It would be better to perform a write to the input per-input value however this
is not supported by our existing dialects. Includes a simple lit validation
test.

Diff Detail

Event Timeline

rsuderman created this revision.Sep 7 2021, 3:30 PM
rsuderman requested review of this revision.Sep 7 2021, 3:31 PM
mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp
2501

You should be able to compress those significantly:

using MapList = ArrayRef<ArrayRef<AffineExpr>>;
auto infer = [](MapList m) { return AffineMap::inferFromExprList(m); };
AffineExpr m, n, o, p;
bindDims(rewriter.getContext(), m, n, o, p);
SmallVector<AffineMap, 4> affineMaps = infer({m, n, o}, {m, p}, {m, p, o});
rsuderman updated this revision to Diff 371420.EditedSep 8 2021, 12:49 PM

Updated for Nicolas's comments.

rsuderman marked an inline comment as done.Sep 8 2021, 12:49 PM
nicolasvasilache accepted this revision.Sep 8 2021, 1:12 PM

Code looks good to me, I am not sure about the semantics of the op itself so someone else please cehck this.

This revision is now accepted and ready to land.Sep 8 2021, 1:12 PM
rsuderman abandoned this revision.Sep 1 2022, 1:53 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 1 2022, 1:53 PM