[Mlir-commits] [mlir] [NFC][mlir][tensor] Use `ValueRange` instead of `SmallVector` in `tensor::createPadHighOp` (PR #144397)

Fabian Mora llvmlistbot at llvm.org
Mon Jun 16 10:14:03 PDT 2025


https://github.com/fabianmcg created https://github.com/llvm/llvm-project/pull/144397

Use `ValueRange` instead of `SmallVector` in `tensor::createPadHighOp` for the `dynOutDims` arg.

>From fccd0f69310a5ffb5d2d56eaa9fd414543cf4472 Mon Sep 17 00:00:00 2001
From: Fabian Mora <fabian.mora-cordero at amd.com>
Date: Mon, 16 Jun 2025 17:11:16 +0000
Subject: [PATCH] [NFC][mlir][tensor] Use `ValueRange` instead of `SmallVector`
 in `tensor::createPadHighOp`

---
 mlir/include/mlir/Dialect/Tensor/Utils/Utils.h | 2 +-
 mlir/lib/Dialect/Tensor/Utils/Utils.cpp        | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/mlir/include/mlir/Dialect/Tensor/Utils/Utils.h b/mlir/include/mlir/Dialect/Tensor/Utils/Utils.h
index 1a4733df3f187..a1ce4e252c2f4 100644
--- a/mlir/include/mlir/Dialect/Tensor/Utils/Utils.h
+++ b/mlir/include/mlir/Dialect/Tensor/Utils/Utils.h
@@ -30,7 +30,7 @@ namespace tensor {
 // for _static_ dimensions.
 PadOp createPadHighOp(RankedTensorType resType, Value source, Value pad,
                       bool nofold, Location loc, OpBuilder &builder,
-                      SmallVector<Value> dynOutDims = {});
+                      ValueRange dynOutDims = std::nullopt);
 
 // Creates dim ops for each dynamic dimension of the ranked tensor argument and
 // returns these as values.
diff --git a/mlir/lib/Dialect/Tensor/Utils/Utils.cpp b/mlir/lib/Dialect/Tensor/Utils/Utils.cpp
index 11ae0108594dd..289296a07d9d3 100644
--- a/mlir/lib/Dialect/Tensor/Utils/Utils.cpp
+++ b/mlir/lib/Dialect/Tensor/Utils/Utils.cpp
@@ -24,8 +24,7 @@ using namespace mlir::tensor;
 
 PadOp mlir::tensor::createPadHighOp(RankedTensorType resType, Value source,
                                     Value pad, bool nofold, Location loc,
-                                    OpBuilder &b,
-                                    SmallVector<Value> dynOutDims) {
+                                    OpBuilder &b, ValueRange dynOutDims) {
 
   // This assumption simplifies the following logic without limiting what's
   // required _today_. If needed, we can relax it in the future.



More information about the Mlir-commits mailing list