This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Fix vectorize transform crashing on none-op operand
ClosedPublic

Authored by asaadaldien on Jan 22 2020, 4:59 PM.

Details

Summary

Not all operands have a defining operator. without this lowering the following will crash:

func @fill_func(%arg0 : memref<2x2xf32>, %arg1: f32) {
  linalg.fill(%arg0, %arg1) : memref<2x2xf32>, f32
  return
}

Diff Detail

Event Timeline

asaadaldien created this revision.Jan 22 2020, 4:59 PM
rriddle accepted this revision.Jan 22 2020, 5:08 PM
rriddle added inline comments.
mlir/lib/Transforms/Vectorize.cpp
1009

You can just change the dyn_cast to dyn_cast_or_null instead.

This revision is now accepted and ready to land.Jan 22 2020, 5:08 PM

Unit tests: pass. 62114 tests passed, 0 failed and 808 were skipped.

clang-tidy: fail. clang-tidy found 0 errors and 1 warnings.

clang-format: pass.

Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml

use dyn_cast_or_null

Unit tests: pass. 62114 tests passed, 0 failed and 808 were skipped.

clang-tidy: fail. clang-tidy found 0 errors and 1 warnings.

clang-format: pass.

Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml

Note that for the purpose of vectorizing linalg.fill I was thinking about creating a pattern similar to this: https://github.com/llvm/llvm-project/blob/master/mlir/lib/Dialect/Linalg/Transforms/LinalgTransforms.cpp#L192

In essence this is about creating a vectorization pattern for linalg.fill, not about converting to affine and using vectorization on that.
Note that the latter would also be a valid way but a bunch of things need to happen before it works and is not the shortest path.

Is there a test case you can add?

@rriddle This already landed (not sure why not showing that here!) the example in the summary I will added it as a test in a follow up diff.

nicolasvasilache resigned from this revision.Mar 13 2020, 11:42 AM
asaadaldien closed this revision.Sep 28 2020, 1:19 PM
Herald added a project: Restricted Project. · View Herald Transcript