Skip to content

[mlir][tosa] Remove vector unrolling support for apply_scale - #238010

Merged
banach-space merged 2 commits into
llvm:mainfrom
banach-space:andrzej/tosa/apply_scale
Nov 4, 2026
Merged

banach-space merged 2 commits into
llvm:mainfrom
banach-space:andrzej/tosa/apply_scale

Conversation

@banach-space

@banach-space banach-space commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

The vector unrolling support for tosa.apply_scale has no tests or
in-tree users, leaving its intended use unclear. This PR removes that
support ahead of the planned vector unrolling refactor, keeping the
refactor focused on demonstrated uses of the interface.

This PR removes that support ahead of the planned vector unrolling
refactor (#233408), keeping
the refactor focused on demonstrated uses of the interface.

This effectively reverts the following commit:

commit 81566001e0c8b072fa9d39be7dac1c007889d937
Author: Jakub Kuderski <[email protected]>
Date:   Mon Feb 13 16:51:37 2023 -0500

    [mlir][tosa] Enable `apply_scale` unrolling

The vector unrolling support for `tosa.apply_scale` has no tests or
in-tree users, leaving its intended use unclear. This PR removes that
support ahead of the planned vector unrolling refactor, keeping the
refactor focused on demonstrated uses of the interface.

This PR removes that support ahead of the planned vector unrolling
refactor (llvm#233408), keeping
the refactor focused on demonstrated uses of the interface.

This effectively reverts the following commit:
```
commit 8156600
Author: Jakub Kuderski <[email protected]>
Date:   Mon Feb 13 16:51:37 2023 -0500

    [mlir][tosa] Enable `apply_scale` unrolling
```
@llvmorg-github-actions llvmorg-github-actions Bot added mlir mlir:tosa bazel "Peripheral" support tier build system: utils/bazel labels Nov 2, 2026
@llvmorg-github-actions

Copy link
Copy Markdown

@llvm/pr-subscribers-mlir-tosa

Author: Andrzej Warzyński (banach-space)

Changes

The vector unrolling support for tosa.apply_scale has no tests or
in-tree users, leaving its intended use unclear. This PR removes that
support ahead of the planned vector unrolling refactor, keeping the
refactor focused on demonstrated uses of the interface.

This PR removes that support ahead of the planned vector unrolling
refactor (#233408), keeping
the refactor focused on demonstrated uses of the interface.

This effectively reverts the following commit:

commit 81566001e0c8b072fa9d39be7dac1c007889d937
Author: Jakub Kuderski &lt;kubak@<!-- -->google.com&gt;
Date:   Mon Feb 13 16:51:37 2023 -0500

    [mlir][tosa] Enable `apply_scale` unrolling

Full diff: https://github.com/llvm/llvm-project/pull/238010.diff

4 Files Affected:

  • (modified) mlir/include/mlir/Dialect/Tosa/IR/TosaUtilOps.td (+1-7)
  • (modified) mlir/lib/Dialect/Tosa/CMakeLists.txt (-1)
  • (modified) mlir/lib/Dialect/Tosa/IR/TosaOps.cpp (-7)
  • (modified) utils/bazel/llvm-project-overlay/mlir/BUILD.bazel (-1)
diff --git a/mlir/include/mlir/Dialect/Tosa/IR/TosaUtilOps.td b/mlir/include/mlir/Dialect/Tosa/IR/TosaUtilOps.td
index 9ba3c31613ff15..1929ea663f7cba 100644
--- a/mlir/include/mlir/Dialect/Tosa/IR/TosaUtilOps.td
+++ b/mlir/include/mlir/Dialect/Tosa/IR/TosaUtilOps.td
@@ -19,7 +19,6 @@ include "mlir/IR/OpBase.td"
 
 include "mlir/Interfaces/SideEffectInterfaces.td"
 include "mlir/Interfaces/LoopLikeInterface.td"
-include "mlir/Interfaces/VectorInterfaces.td"
 include "mlir/Dialect/Tosa/IR/TosaInterfaces.td"
 
 include "mlir/Dialect/Tosa/IR/TosaTypesBase.td"
@@ -27,8 +26,7 @@ include "mlir/Dialect/Tosa/IR/TosaOpBase.td"
 
 def Tosa_ApplyScaleOp :
   Tosa_Op<"apply_scale",
-          [Pure, DeclareOpInterfaceMethods<VectorUnrollOpInterface>] #
-          ElementwiseMappable.traits> {
+          [Pure] # ElementwiseMappable.traits> {
   let summary = "Rescale scalar operator for Tosa tensor operators";
 
   let description = [{
@@ -51,10 +49,6 @@ def Tosa_ApplyScaleOp :
     Tosa_IntLike:$output
   );
 
-  let extraClassDeclaration = [{
-    std::optional<SmallVector<int64_t, 4>> getIterationShapeToUnroll();
-  }];
-
   let assemblyFormat =
       "operands `rounding_mode` `` $rounding_mode attr-dict `:` "
       "functional-type(operands, results)";
diff --git a/mlir/lib/Dialect/Tosa/CMakeLists.txt b/mlir/lib/Dialect/Tosa/CMakeLists.txt
index 6404ca8fc5a561..579156c72e19a8 100644
--- a/mlir/lib/Dialect/Tosa/CMakeLists.txt
+++ b/mlir/lib/Dialect/Tosa/CMakeLists.txt
@@ -24,7 +24,6 @@ add_mlir_dialect_library(MLIRTosaDialect
   MLIRQuantUtils
   MLIRSideEffectInterfaces
   MLIRTensorDialect
-  MLIRVectorInterfaces
   MLIRViewLikeInterface
   )
 
diff --git a/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp b/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
index b5e8eb5b9314c5..6d1b75079065cd 100644
--- a/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
+++ b/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
@@ -5201,13 +5201,6 @@ LogicalResult WhileOp::inferReturnTypeComponents(
   return success();
 }
 
-std::optional<SmallVector<int64_t, 4>>
-ApplyScaleOp::getIterationShapeToUnroll() {
-  if (auto vt = llvm::dyn_cast<VectorType>(getType()))
-    return llvm::to_vector<4>(vt.getShape());
-  return std::nullopt;
-}
-
 static void printInitializationList(OpAsmPrinter &parser,
                                     Block::BlockArgListType blocksArgs,
                                     ValueRange initializers,
diff --git a/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
index 41f6f6998f21b9..95ed49b90bd26c 100644
--- a/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
@@ -12702,7 +12702,6 @@ td_library(
         ":LoopLikeInterfaceTdFiles",
         ":OpBaseTdFiles",
         ":SideEffectInterfacesTdFiles",
-        ":VectorInterfacesTdFiles",
     ],
 )
 

@llvmorg-github-actions

Copy link
Copy Markdown

@llvm/pr-subscribers-mlir

Author: Andrzej Warzyński (banach-space)

Changes

The vector unrolling support for tosa.apply_scale has no tests or
in-tree users, leaving its intended use unclear. This PR removes that
support ahead of the planned vector unrolling refactor, keeping the
refactor focused on demonstrated uses of the interface.

This PR removes that support ahead of the planned vector unrolling
refactor (#233408), keeping
the refactor focused on demonstrated uses of the interface.

This effectively reverts the following commit:

commit 81566001e0c8b072fa9d39be7dac1c007889d937
Author: Jakub Kuderski &lt;kubak@<!-- -->google.com&gt;
Date:   Mon Feb 13 16:51:37 2023 -0500

    [mlir][tosa] Enable `apply_scale` unrolling

Full diff: https://github.com/llvm/llvm-project/pull/238010.diff

4 Files Affected:

  • (modified) mlir/include/mlir/Dialect/Tosa/IR/TosaUtilOps.td (+1-7)
  • (modified) mlir/lib/Dialect/Tosa/CMakeLists.txt (-1)
  • (modified) mlir/lib/Dialect/Tosa/IR/TosaOps.cpp (-7)
  • (modified) utils/bazel/llvm-project-overlay/mlir/BUILD.bazel (-1)
diff --git a/mlir/include/mlir/Dialect/Tosa/IR/TosaUtilOps.td b/mlir/include/mlir/Dialect/Tosa/IR/TosaUtilOps.td
index 9ba3c31613ff15..1929ea663f7cba 100644
--- a/mlir/include/mlir/Dialect/Tosa/IR/TosaUtilOps.td
+++ b/mlir/include/mlir/Dialect/Tosa/IR/TosaUtilOps.td
@@ -19,7 +19,6 @@ include "mlir/IR/OpBase.td"
 
 include "mlir/Interfaces/SideEffectInterfaces.td"
 include "mlir/Interfaces/LoopLikeInterface.td"
-include "mlir/Interfaces/VectorInterfaces.td"
 include "mlir/Dialect/Tosa/IR/TosaInterfaces.td"
 
 include "mlir/Dialect/Tosa/IR/TosaTypesBase.td"
@@ -27,8 +26,7 @@ include "mlir/Dialect/Tosa/IR/TosaOpBase.td"
 
 def Tosa_ApplyScaleOp :
   Tosa_Op<"apply_scale",
-          [Pure, DeclareOpInterfaceMethods<VectorUnrollOpInterface>] #
-          ElementwiseMappable.traits> {
+          [Pure] # ElementwiseMappable.traits> {
   let summary = "Rescale scalar operator for Tosa tensor operators";
 
   let description = [{
@@ -51,10 +49,6 @@ def Tosa_ApplyScaleOp :
     Tosa_IntLike:$output
   );
 
-  let extraClassDeclaration = [{
-    std::optional<SmallVector<int64_t, 4>> getIterationShapeToUnroll();
-  }];
-
   let assemblyFormat =
       "operands `rounding_mode` `` $rounding_mode attr-dict `:` "
       "functional-type(operands, results)";
diff --git a/mlir/lib/Dialect/Tosa/CMakeLists.txt b/mlir/lib/Dialect/Tosa/CMakeLists.txt
index 6404ca8fc5a561..579156c72e19a8 100644
--- a/mlir/lib/Dialect/Tosa/CMakeLists.txt
+++ b/mlir/lib/Dialect/Tosa/CMakeLists.txt
@@ -24,7 +24,6 @@ add_mlir_dialect_library(MLIRTosaDialect
   MLIRQuantUtils
   MLIRSideEffectInterfaces
   MLIRTensorDialect
-  MLIRVectorInterfaces
   MLIRViewLikeInterface
   )
 
diff --git a/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp b/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
index b5e8eb5b9314c5..6d1b75079065cd 100644
--- a/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
+++ b/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
@@ -5201,13 +5201,6 @@ LogicalResult WhileOp::inferReturnTypeComponents(
   return success();
 }
 
-std::optional<SmallVector<int64_t, 4>>
-ApplyScaleOp::getIterationShapeToUnroll() {
-  if (auto vt = llvm::dyn_cast<VectorType>(getType()))
-    return llvm::to_vector<4>(vt.getShape());
-  return std::nullopt;
-}
-
 static void printInitializationList(OpAsmPrinter &parser,
                                     Block::BlockArgListType blocksArgs,
                                     ValueRange initializers,
diff --git a/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
index 41f6f6998f21b9..95ed49b90bd26c 100644
--- a/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
@@ -12702,7 +12702,6 @@ td_library(
         ":LoopLikeInterfaceTdFiles",
         ":OpBaseTdFiles",
         ":SideEffectInterfacesTdFiles",
-        ":VectorInterfacesTdFiles",
     ],
 )
 

@lhutton1

lhutton1 commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

cc @ziereis as a possible user of vector in tosa.apply_scale (based on #199924)

@FedericoBruzzone FedericoBruzzone left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you! But please wait for @ziereis :D

@lhutton1 lhutton1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@AGindinson AGindinson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM (on behalf of @ziereis too)

@banach-space

Copy link
Copy Markdown
Contributor Author

Thank you for the reviews. Let me revert the Bazel changes (pre-commit fails anyway) and then land it.

@banach-space

Copy link
Copy Markdown
Contributor Author

Thank you for the reviews. Let me revert the Bazel changes (pre-commit fails anyway) and then land it.

@banach-space
banach-space enabled auto-merge (squash) November 4, 2026 10:59
@banach-space
banach-space disabled auto-merge November 4, 2026 13:52
@banach-space
banach-space merged commit fd64c07 into llvm:main Nov 4, 2026
10 checks passed
@banach-space
banach-space deleted the andrzej/tosa/apply_scale branch November 4, 2026 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bazel "Peripheral" support tier build system: utils/bazel mlir:tosa mlir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants