Page MenuHomePhabricator

[mlir] Add the AffineScope trait to linalg.generic ops
Needs RevisionPublic

Authored by agostini01 on Mar 16 2021, 7:32 PM.

Details

Summary

This change enables using affine ops inside the body of a
linalg.indexed_generic operation.

This is in response to the discussion: https://llvm.discourse.group/t/should-linalg-indexed-generic-allow-for-affine-operations-on-its-body/2889

With the additional of AffineScope the following test started failing:

  • mlir/test/Dialect/Linalg/reshape_fusion.mlir
  • It fails because it swaps index for symbols on generated affine_map
  • Happens only on -linalg-fusion-for-tensor-ops

Diff Detail

Unit TestsFailed

TimeTest
80 msx64 debian > MLIR.Dialect/Linalg::reshape_fusion.mlir
Script: -- : 'RUN: at line 1'; /mnt/disks/ssd0/agent/llvm-project/build/bin/mlir-opt /mnt/disks/ssd0/agent/llvm-project/mlir/test/Dialect/Linalg/reshape_fusion.mlir -linalg-fusion-for-tensor-ops -split-input-file -verify-each=0 | /mnt/disks/ssd0/agent/llvm-project/build/bin/FileCheck /mnt/disks/ssd0/agent/llvm-project/mlir/test/Dialect/Linalg/reshape_fusion.mlir
100 msx64 windows > MLIR.Dialect/Linalg::reshape_fusion.mlir
Script: -- : 'RUN: at line 1'; c:\ws\w16c2-2\llvm-project\premerge-checks\build\bin\mlir-opt.exe C:\ws\w16c2-2\llvm-project\premerge-checks\mlir\test\Dialect\Linalg\reshape_fusion.mlir -linalg-fusion-for-tensor-ops -split-input-file -verify-each=0 | c:\ws\w16c2-2\llvm-project\premerge-checks\build\bin\filecheck.exe C:\ws\w16c2-2\llvm-project\premerge-checks\mlir\test\Dialect\Linalg\reshape_fusion.mlir

Event Timeline

agostini01 created this revision.Mar 16 2021, 7:32 PM
agostini01 requested review of this revision.Mar 16 2021, 7:32 PM
agostini01 abandoned this revision.Mar 16 2021, 7:34 PM

First time using arc. Uploaded the patch with a missing commit. I will create a new patch.

Added the missing commit

agostini01 retitled this revision from [mlir] Implement Lowring of affine.if with results to scf.if to [mlir] Add the AffineScope trait to linalg.generic ops.Mar 16 2021, 7:45 PM
agostini01 edited the summary of this revision. (Show Details)
agostini01 edited the summary of this revision. (Show Details)
agostini01 edited the summary of this revision. (Show Details)Mar 16 2021, 7:47 PM

Added Uday to this patch.

Note, the current changes still cause mlir/test/Dialect/Linalg/reshape_fusion.mlir to fail.
I will need a bit of help debugging it.

Sorry for the convoluted number of actions, it is my first patch with arc.

Remove affine.if to scf.if lowering from this revision

Update the patch

agostini01 edited the summary of this revision. (Show Details)Mar 17 2021, 4:15 PM
nicolasvasilache requested changes to this revision.Mar 24 2021, 7:57 AM
nicolasvasilache added inline comments.
mlir/test/Dialect/Linalg/affine.mlir
191

In-place transpose is incompatible with "parallel" semantics.
This would be a good candidate to evolve the semantics and allow a "permutable band" in linalg but changes are more profound than this revision.

You'll need another example.

This revision now requires changes to proceed.Mar 24 2021, 7:57 AM