[all-commits] [llvm/llvm-project] 4c640e: [mlir][linalg] Verify indexing map required attrib...

Lei Zhang via All-commits all-commits at lists.llvm.org
Tue Feb 9 05:51:48 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4c640e49c9553363bc0e6fcbdbfe8d678683db97
      https://github.com/llvm/llvm-project/commit/4c640e49c9553363bc0e6fcbdbfe8d678683db97
  Author: Lei Zhang <antiagainst at google.com>
  Date:   2021-02-09 (Tue, 09 Feb 2021)

  Changed paths:
    M mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td
    M mlir/lib/Dialect/Linalg/IR/LinalgInterfaces.cpp
    M mlir/test/mlir-linalg-ods-gen/test-linalg-ods-gen.tc
    M mlir/tools/mlir-linalg-ods-gen/mlir-linalg-ods-gen.cpp

  Log Message:
  -----------
  [mlir][linalg] Verify indexing map required attributes

Indexing maps for named ops can reference attributes so that
we can synthesize the indexing map dynamically. This supports
cases like strides for convolution ops. However, it does cause
an issue: now the indexing_maps() function call is dependent
on those attributes.

Linalg ops inherit LinalgOpInterfaceTraits, which calls
verifyStructuredOpInterface() to verify the interface.
verifyStructuredOpInterface() further calls indexing_maps().
Note that trait verification is done before the op itself,
where ODS generates the verification for those attributes.
So we can have indexing_maps() referencing non-existing or
invalid attribute, before the ODS-generated verification
kick in.

There isn't a dependency handling mechansim for traits.
This commit adds new interface methods to query whether an
op hasDynamicIndexingMaps() and then perform
verifyIndexingMapRequiredAttributes() in
verifyStructuredOpInterface() to handle the dependency issue.

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D96297




More information about the All-commits mailing list