[all-commits] [llvm/llvm-project] b76d8f: [mlir][tosa] Verify zero-dim tensors in the input

Kai Sasaki via All-commits all-commits at lists.llvm.org
Mon Jul 10 17:22:17 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b76d8f7d976365a2668694deceff48133e78f529
  Author: Kai Sasaki <lewuathe at gmail.com>
  Date:   2023-07-11 (Tue, 11 Jul 2023)

  Changed paths:
    M mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
    M mlir/test/Dialect/Tosa/invalid.mlir

  Log Message:
  [mlir][tosa] Verify zero-dim tensors in the input

As TOSA does not support the tensor with zero dimensions, we can check the zero value for the static shape input.

Ideally, we should be able to check the tensor shape more broadly, such as using `CPred` in the TOSA type definition. But based on [[ https://discourse.llvm.org/t/where-can-we-put-the-shared-verification-among-multiple-dialect-ops/71806  | the discussion here
 ]] It makes input type verification complicated and hard to maintain and still only applies to the case the input is statically shaped. Therefore, in this change, we have put the zero dimension check in the verification of each op, which would be flexible and maintainable.

See: https://github.com/llvm/llvm-project/issues/63212

Reviewed By: eric-k256

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

More information about the All-commits mailing list