[all-commits] [llvm/llvm-project] 286185: [mlir][Vector] Add utility for computing scalable ...

Benjamin Maxwell via All-commits all-commits at lists.llvm.org
Thu Mar 21 07:19:18 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2861856baf16e43a5e465e87022c6c2c2d238969
      https://github.com/llvm/llvm-project/commit/2861856baf16e43a5e465e87022c6c2c2d238969
  Author: Benjamin Maxwell <benjamin.maxwell at arm.com>
  Date:   2024-03-21 (Thu, 21 Mar 2024)

  Changed paths:
    A mlir/include/mlir/Dialect/Vector/IR/ScalableValueBoundsConstraintSet.h
    A mlir/include/mlir/Dialect/Vector/IR/ValueBoundsOpInterfaceImpl.h
    M mlir/include/mlir/InitAllDialects.h
    M mlir/include/mlir/Interfaces/ValueBoundsOpInterface.h
    M mlir/lib/Dialect/Vector/IR/CMakeLists.txt
    A mlir/lib/Dialect/Vector/IR/ScalableValueBoundsConstraintSet.cpp
    A mlir/lib/Dialect/Vector/IR/ValueBoundsOpInterfaceImpl.cpp
    M mlir/lib/Interfaces/ValueBoundsOpInterface.cpp
    A mlir/test/Dialect/Vector/test-scalable-bounds.mlir
    M mlir/test/lib/Dialect/Affine/TestReifyValueBounds.cpp

  Log Message:
  -----------
  [mlir][Vector] Add utility for computing scalable value bounds (#83876)

This adds a new API built with the `ValueBoundsConstraintSet` to compute
the bounds of possibly scalable quantities. It uses knowledge of the
range of vscale (which is defined by the target architecture), to solve
for the bound as either a constant or an expression in terms of vscale.

The result is an `AffineMap` that will always take at most one
parameter, vscale, and returns a single result, which is the bound of
`value`.

The API is defined as follows:

```c++
FailureOr<ConstantOrScalableBound>
vector::ScalableValueBoundsConstraintSet::computeScalableBound(
  Value value, std::optional<int64_t> dim,
  unsigned vscaleMin, unsigned vscaleMax,
  presburger::BoundType boundType, 
  bool closedUB = true,
  StopConditionFn stopCondition = nullptr);
```

Note: `ConstantOrScalableBound` is a thin wrapper over the `AffineMap`
with a utility for converting the bound to a single quantity (i.e. a
size and scalable flag).

We believe this API could prove useful downstream in IREE (which uses a
similar analysis to hoist allocas, which currently fails for scalable
vectors).



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list